Skip to content

enable_introspection not working with env variable #1211

Description

@medhki

using an env variable to disable/enable introspection is not woking as should be

overblog_graphql:
    security:
        query_max_depth: 20
        enable_introspection: '%env(bool:GRAPHQL_ENABLE_INTROSPECTION)%'

the issue is related to the set setSecurity method in the OverblogGraphqlExtension.

private function setSecurity(array $config, ContainerBuilder $container): void
{
    $executorDefinition = $container->getDefinition(Executor::class);
    if ($config['security']['enable_introspection']) {
        $executorDefinition->addMethodCall('enableIntrospectionQuery');
    } else {
        $executorDefinition->addMethodCall('disableIntrospectionQuery');
    }

    foreach ($config['security'] as $key => $value) {
        $container->setParameter(sprintf('%s.%s', $this->getAlias(), $key), $value);
    }
}

at compile time the $config['security']['enable_introspection'] is a placeholder like
env_53efa566b94c30e2_bool_GRAPHQL_ENABLE_INTROSPECTION_7b26115e46b824a8dd0e86467640739b
which will always evaluates to true

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions