Skip to content

Commit 66012b0

Browse files
committed
fix CI
1 parent f2c09b6 commit 66012b0

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Controller/GraphQLiteController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ public function handleRequest(Request $request): Response
7878
if (json_last_error() !== JSON_ERROR_NONE) {
7979
throw new \RuntimeException('Invalid JSON received in POST body: '.json_last_error_msg());
8080
}
81+
if (!is_array($parsedBody)){
82+
throw new \RuntimeException('Expecting associative array from request, got ' . gettype($content));
83+
}
8184
$psr7Request = $psr7Request->withParsedBody($parsedBody);
8285
}
8386

DependencyInjection/GraphQLiteCompilerPass.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ public function process(ContainerBuilder $container): void
128128

129129
if ($disableLogin === false) {
130130
// Let's do some dark magic. We need the user provider. We need its name. It is stored in the "config" object.
131-
$provider = $container->findDefinition('security.firewall.map.config.'.$firewallName)->getArgument(5);
131+
$providerConfigKey = 'security.firewall.map.config.'.$firewallName;
132+
$provider = $container->findDefinition($providerConfigKey)->getArgument(5);
133+
if (!is_string($provider)){
134+
throw new GraphQLException('Expecting to find user provider name from ' . $providerConfigKey);
135+
}
132136

133137
$container->findDefinition(LoginController::class)->setArgument(0, new Reference($provider));
134138

@@ -191,6 +195,9 @@ public function process(ContainerBuilder $container): void
191195
// Let's register the mapping with UserInterface if UserInterface is available.
192196
if (interface_exists(UserInterface::class)) {
193197
$staticTypes = $container->getDefinition(StaticClassListTypeMapperFactory::class)->getArgument(0);
198+
if (!is_array($staticTypes)){
199+
throw new GraphQLException(sprintf('Expecting array in %s, arg #1', StaticClassListTypeMapperFactory::class));
200+
}
194201
$staticTypes[] = SymfonyUserInterfaceType::class;
195202
$container->getDefinition(StaticClassListTypeMapperFactory::class)->setArgument(0, $staticTypes);
196203
}
@@ -294,6 +301,9 @@ private function registerController(string $controllerClassName, ContainerBuilde
294301
{
295302
$aggregateQueryProvider = $container->findDefinition(AggregateControllerQueryProviderFactory::class);
296303
$controllersList = $aggregateQueryProvider->getArgument(0);
304+
if (!is_array($controllersList)){
305+
throw new GraphQLException(sprintf('Expecting array in %s, arg #1', AggregateControllerQueryProviderFactory::class));
306+
}
297307
$controllersList[] = $controllerClassName;
298308
$aggregateQueryProvider->setArgument(0, $controllersList);
299309
}
@@ -336,7 +346,14 @@ private function makePublicInjectedServices(ReflectionClass $refClass, Annotatio
336346
return $services;
337347
});
338348

349+
if (!is_array($services)){
350+
throw new GraphQLException('An error occurred in compiler pass');
351+
}
352+
339353
foreach ($services as $service) {
354+
if (!is_string($service)){
355+
throw new GraphQLException('expecting string as service');
356+
}
340357
if ($container->hasAlias($service)) {
341358
$container->getAlias($service)->setPublic(true);
342359
} else {

0 commit comments

Comments
 (0)