. * * In accordance with Section 7(b) of the GNU Affero General Public License * version 3, these Appropriate Legal Notices must retain the display of the * "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably * feasible for technical reasons, the Appropriate Legal Notices must display * the words "Supercharged by SuiteCRM". */ namespace App\Security; use GraphQL\Validator\DocumentValidator; use GraphQL\Validator\Rules\DisableIntrospection; class GraphqlIntrospectionManager { /** * @var bool|null */ private $graphqlShowDocs; /** * @param bool|null $graphqlShowDocs */ public function __construct( ?bool $graphqlShowDocs ) { $this->graphqlShowDocs = $graphqlShowDocs; } /** * Enable/disable graphql introspection * @return void */ public function configure(): void { $env = $_ENV ?? []; $appEnv = $env['APP_ENV'] ?? 'prod'; $showDocs = $this->graphqlShowDocs ?? ($appEnv === 'dev'); if ($showDocs === false) { DocumentValidator::addRule(new DisableIntrospection()); } } }