Giter VIP home page Giter VIP logo

fusio-impl's Introduction

Fusio implementation

About

Fusio is an open source API management platform which helps to create innovative API solutions. This repository contains the Fusio backend code. More information about Fusio at https://www.fusio-project.org/

Status

This overview shows all Fusio related composer dependencies and the build status:

Package Status
fusio/impl Status
fusio/cli Status
fusio/model Status
fusio/engine Status
fusio/adapter-amqp Status
fusio/adapter-beanstalk Status
fusio/adapter-cli Status
fusio/adapter-elasticsearch Status
fusio/adapter-fcgi Status
fusio/adapter-file Status
fusio/adapter-graphql Status
fusio/adapter-http Status
fusio/adapter-memcache Status
fusio/adapter-mongodb Status
fusio/adapter-php Status
fusio/adapter-redis Status
fusio/adapter-smtp Status
fusio/adapter-soap Status
fusio/adapter-sql Status
fusio/adapter-stripe Status
fusio/adapter-util Status
fusio/adapter-worker Status

fusio-impl's People

Contributors

chriskapp avatar dataforce-troy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fusio-impl's Issues

Delete route doesn't delete it in the db

When deleting a route via the UI, it doesn't get deleted from the db.
I believe the problem was that there was a fk contraint check that prevented it form deleting child records.
I have changed my db but think this should be fixed in a future release.
Thanks

GET Url can't be longer than 255 character

I'm love fusio API management.

{
"success": false,
"title": "Doctrine\DBAL\Exception\DriverException",
"message": "An exception occurred while executing 'INSERT INTO fusio_log (routeId, appId, userId, ip, userAgent, method, path, header, body, date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["66", null, null, "192.168.8.1", "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/58.0.3029.110 Safari\/537.36", "GET", "\/xxxxx?filter=%5B%22%5B%5C%22codefication%5C%22,%5C%22contains%5C%22,%5C%22Te%5C%22%5D%22,%22and%22,%5B%5B%22DK%22,%22%3D%22,%22D%22%5D,%22or%22,%5B%22DK%22,%22%3D%22,%22K%22%5D%5D%5D&sort=%7B%22selector%22:%22DK%22,%22desc%22:false,%22isExpanded%22:true%7D&userData=%7B%7D", "Authorization: \nHost: fusio.apotek.com\nConnection: keep-alive\nCache-Control: max-age=0\nUpgrade-Insecure-Requests: 1\nUser-Agent: Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/58.0.3029.110 Safari\/537.36\nAccept: text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,\/;q=0.8\nAccept-Encoding: gzip, deflate, sdch\nAccept-Language: en-US,en;q=0.8,id;q=0.6\nCookie: gvc=918vr2431394544826301", null, "2017-06-07 21:29:36"]:\n\nSQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'path' at row 1 in /var/www/fusio.apotek.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 115",
"trace": "#0 /var/www/fusio.apotek.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(128): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))\n#1 /var/www/fusio.apotek.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1015): Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), 'INSERT INTO fus...', Array)\n#2 /var/www/fusio.apotek.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(714): Doctrine\DBAL\Connection->executeUpdate('INSERT INTO fus...', Array, Array)\n#3 /var/www/fusio.apotek.com/vendor/fusio/impl/src/Logger.php(73): Doctrine\DBAL\Connection->insert('fusio_log', Array)\n#4 /var/www/fusio.apotek.com/vendor/fusio/impl/src/Controller/SchemaApiController.php(152): Fusio\Impl\Logger->log('66', NULL, NULL, '192.168.8.1', Object(PSX\Http\Request))\n#5 /var/www/fusio.apotek.com/vendor/psx/framework/src/Filter/ControllerExecutor.php(48): Fusio\Impl\Controller\SchemaApiController->onLoad()\n#6 /var/www/fusio.apotek.com/vendor/psx/framework/src/Filter/FilterChain.php(79): PSX\Framework\Filter\ControllerExecutor->handle(Object(PSX\Http\Request), Object(PSX\Http\Response), Object(PSX\Framework\Filter\FilterChain))\n#7 /var/www/fusio.apotek.com/vendor/psx/framework/src/Filter/UserAgentEnforcer.php(41): PSX\Framework\Filter\FilterChain->handle(Object(PSX\Http\Request), Object(PSX\Http\Response))\n#8 /var/www/fusio.apotek.com/vendor/psx/framework/src/Filter/FilterChain.php(79): PSX\Framework\Filter\UserAgentEnforcer->handle(Object(PSX\Http\Request), Object(PSX\Http\Response), Object(PSX\Framework\Filter\FilterChain))\n#9 /var/www/fusio.apotek.com/vendor/psx/framework/src/Loader/Loader.php(158): PSX\Framework\Filter\FilterChain->handle(Object(PSX\Http\Request), Object(PSX\Http\Response))\n#10 /var/www/fusio.apotek.com/vendor/psx/framework/src/Loader/Loader.php(126): PSX\Framework\Loader\Loader->executeController(Object(Fusio\Impl\Controller\SchemaApiController), Object(PSX\Http\Request), Object(PSX\Http\Response))\n#11 /var/www/fusio.apotek.com/vendor/psx/framework/src/Dispatch/Dispatch.php(120): PSX\Framework\Loader\Loader->load(Object(PSX\Http\Request), Object(PSX\Http\Response), Object(PSX\Framework\Loader\Context))\n#12 /var/www/fusio.apotek.com/public/index.php(30): PSX\Framework\Dispatch\Dispatch->route(Object(PSX\Http\Request), Object(PSX\Http\Response))\n#13 {main}",
"context": "111 case '1566':\n112 return new Exception\NotNullConstraintViolationException($message, $exception);\n113 }\n114 \n115 return new Exception\DriverException($message, $exception);\n</b>116 }\n117 \n118 /**\n119 * {@inheritdoc}\n"
}

Make logs optional for specific routes

+1 to disable logging on specific routes or actions.

Currently using react where the suggested approach is to use bcrypt :

  1. password is saved as a hash in db.
  2. the same password never generates the same hash
  3. client for auth sends pass in clear text via ssl and bcrypt validates the clear password against the hash.

Seems that this is the standard option so that a hash to hash comparison is avoided as it is not a safe method.

However, that will mean the password will be shown in clear text in the logs..

Also, the fact that the logs are not rotated seems to me a problem awaiting to explode at some point due to storage, performance etc..

More details here:
https://dev.to/silvenleaf/password-hashing-with-bcrypt-easiest-explanation-5gpg

Alert message points to incorrect file for config changes {configuration.php} [scratched head at 3am]

Hi, just letting you know that in the latest version [3.1.1 at this time] , the Alert message shown when a user has not enabled the market_place or php_sandbox etc. says to change the setting in the configuration.php file however those settings must be changed in the .env file in the root directory.

I was searching everywhere for the proper configuration.php file and eventually found out that it's the .env file.

Also I installed via the web installer method.

Hopefully this helps save time incase som1 has the same issue.

cheers

Screenshot 2022-07-11 183414

Screenshot 2022-07-11 183611

Make version tag configurable

Tried to open a PR but no access :(

Would like to change getSubmittedVersionNumber() in src/Controller/Filter/AssertMethod.php:108 to this:

    private function getSubmittedVersionNumber(RequestInterface $request)
    {
        $versionKey = getenv('API_VERSION_KEY') ?: 'Accept';
        $versionRegex = getenv('API_VERSION_REGEX') ?: '^application\/vnd\.([a-z.-_]+)\.v([\d]+)\+([a-z]+)$';
        $versionIdx = intval(getenv('API_VERSION_MATCH_IDX')) ?: 2;
        $accept  = $request->getHeader($versionKey);
        $matches = array();

        preg_match("/{$versionRegex}/", $accept, $matches);

        return isset($matches[$versionIdx]) ? $matches[$versionIdx] : null;
    }

This allows me to setup my .env file like this, so I can override the default application/vnd* header:

API_VERSION_KEY="Version"
API_VERSION_REGEX="^(\d+)$"
API_VERSION_MATCH_IDX=1

So I can simplify things and just pass Version: 3 for a given API version.

In my opinion, the way we're checking for a version indicates some adherence to the JSON API standard. In reality, we can pass whatever we want in the Accept header as long as it loosely adheres to the regex. For example, this header: Accept: application/vnd.pirates.v1+monkeys allows us to successfully extract the "v1" version number and get a good, expected response back from the server.

If I'm using Fusio as my API gateway, my clients may interpret the application/vnd.api.v1+json header to mean that I am implementing the JSON API standard. Given the fact that I can omit a Accept: application/vnd* header to Fusio and still get a successful response back indicates we're not fully implementing the JSON API standard, per this requirement.

Having the capability to override the default version behavior can help eliminate any confusion about the type of standard we're implementing, and it gives users more flexibility in customizing their product for their end users.

Thanks for the consideration!

Unable to set operationId in route definitions

Currently not possible to set the 'operationId' for a route in the route definition yaml file.

This is useful because the auto generated operationId is not very clean and can be quite long.

When exporting the OpenAPI schema definition to other doc generating tools like ReDoc, Postman, Redocly etc, these tools use the operationId as the name for the route in the docs. I would like to be able to define these names within my route definitions in Fusio.

Fixed by #8

System UserAdd command password restrictions

I am using the docker example (modified) and the command useradd in this library is causing:

In Validator.php line 97:
Password must contain only printable ascii characters (0x21-0x7E)  

This is because I have spaces in my password. The printable character range of ascii characters includes spaces (0x20) so why are they not allowed or within the range described by the error? Range 0x20-0x7E is printable.

https://www.systutorials.com/ascii-table-and-ascii-code/

Deploy.php doesn't support JSON Schema with "$ref": "#/definitions/"

I'm generating my JSON Schema with PHP Annoations inside my Model class (See apioo/psx-schema#4).
If I use the @Items(@Ref("FooClass")) Annotation the JSON Schema Generator uses the "#/definitions" syntax to link the Definition of FooClass.
Example output:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "urn:schema.phpsx.org#",
  "definitions": {
    "Objectbfb8a532": {
      "type": "object",
      "properties": {
        "id": {},
      },
    }
  },
  "type": "object",
  "properties": {
    "urlReports": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Objectbfb8a532"
      }
    }
  },
}

Sadly I can't import this result with php bin/fusio deploy because only the file:///xyz.json scheme is supported in Deploy.php:268.

The following change enables #/definitions/ in Deploy.php:

if ($uri->getScheme() == 'file') {
    $data->{$key} = $this->resolveRefs($basePath . '/' . $uri->getPath());
} else if (empty($uri->getScheme()) && 0 === stripos($data->{$key}->{'$ref'}, '#/definitions/')) {
    // Ref is inside the current file, do not resolve
    continue;
} else {
    throw new RuntimeException('Scheme ' . $uri->getScheme() . ' is not supported');
}

I did not test if this causes problems during API requests, backend actions, etc. !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.