Skip to content

Commit

Permalink
Introspection query is always allowed #9554
Browse files Browse the repository at this point in the history
Because we depend on introspection for at least:

- `<natural-relations>`
- `<natural-select-enum>`
- `NaturalEnumService`
- `NaturalLinkMutationService`
  • Loading branch information
PowerKiKi committed May 29, 2023
1 parent ecc05db commit 073e723
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/Api/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
use GraphQL\Server\ServerConfig;
use GraphQL\Server\StandardServer;
use GraphQL\Type\Schema;
use GraphQL\Validator\DocumentValidator;
use GraphQL\Validator\Rules\DisableIntrospection;
use Mezzio\Session\SessionMiddleware;
use Psr\Http\Message\ServerRequestInterface;
use Throwable;
Expand All @@ -27,20 +25,14 @@ class Server
private readonly ServerConfig $config;

/**
* @param bool $debug if true, allows the introspection query, and dumps stacktrace in case of error
* @param bool $debug if true, dumps stacktrace in case of error
*/
public function __construct(Schema $schema, bool $debug, array $rootValue = [])
{
GraphQL::setDefaultFieldResolver(new FilteredFieldResolver());

$debugFlag = DebugFlag::INCLUDE_DEBUG_MESSAGE | DebugFlag::INCLUDE_TRACE;

// Forbid introspection query in production mode, because our API is not meant to be publicly available
if (!$debug) {
$rule = new DisableIntrospection(DisableIntrospection::ENABLED);
DocumentValidator::addRule($rule);
}

$this->config = ServerConfig::create([
'schema' => $schema,
'queryBatching' => true,
Expand Down

0 comments on commit 073e723

Please sign in to comment.