Skip to content

IBX-11507: Critical errors logged when browsing BackOffice as user with limited permissions#100

Open
Sztig wants to merge 3 commits into
4.6from
IBX-11507-log-pollution-fix
Open

IBX-11507: Critical errors logged when browsing BackOffice as user with limited permissions#100
Sztig wants to merge 3 commits into
4.6from
IBX-11507-log-pollution-fix

Conversation

@Sztig

@Sztig Sztig commented May 12, 2026

Copy link
Copy Markdown
Contributor
🎫 Issue IBX-11507

Description:

This is a "hotfix" for excessive error logging when using backoffice as a user with limited permissions. The fix is not perfect as it silences the logging entirely.

Alternatives considered:
Make ArgumentsException extend UserWarning and remove the previous exception

  • silences logging entirely
  • loses stack trace
  • possible BC break?

Catch ArgumentsException in resolvers and re-throw as UserError/return null

  • would need to patch every resolver that calls findSingle
  • changes what callers receive ergo BC break?

The underlying issue is that we are no matter what querying all the info about content so depending on the permissions, other users will throw different errors in the logs while the backoffice functions as intended.
Fixing this by checking permissions seems to be too expensive/complex of a fix.

@ViniTou

ViniTou commented May 14, 2026

Copy link
Copy Markdown
Contributor

This is no way to go, we cant just disable all logging.

Is it possible to use Monolog\Handler\AbstractProcessingHandler for it, and maybe check for namespace/class (Ibexa\GraphQL\DataLoader\Exception\ArgumentsException) or stacktrace in given exception, and when it match graphql we then ignore it?

or even better maybe we can easly configure it to log those into specific channel?

@Sztig

Sztig commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

I've done some test and something like this seem to work - how about we log it under the default app.DEBUG or new channel like graphql.DEBUG instead of app.CRITICAL so it is still being logged but not in the production?

@konradoboza

konradoboza commented May 21, 2026

Copy link
Copy Markdown
Contributor

@Sztig if what you meant is logging GraphQL issues in a separate channel then I think we should indeed go for it.

@konradoboza

Copy link
Copy Markdown
Contributor

Also, CI on PHP 7.4 is fixed, feel free to rebase this PR.

@Sztig Sztig force-pushed the IBX-11507-log-pollution-fix branch from 271ebdb to 9b5d841 Compare May 22, 2026 11:46
@Sztig

Sztig commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

So I have went with this approach - I have added new channel called graphql and through a listener send all the ArgumentsException exceptions there.
While it doesn't stop logging these exceptions, muting them specifically is now very easy.

@mateuszbieniek mateuszbieniek marked this pull request as ready for review June 30, 2026 12:09
'dir' => $container->getParameter('kernel.project_dir') . self::SCHEMA_DIR_PATH,
];
$container->prependExtensionConfig('overblog_graphql', $graphQLConfig);
$container->prependExtensionConfig('monolog', ['channels' => ['graphql']]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary, if you use autowiring/autoconfiguration from MonologBundle, AFAIR, see the next diff comment.


Ibexa\GraphQL\EventListener\ArgumentsExceptionListener:
arguments:
$logger: '@monolog.logger.graphql'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try rather tagging this as

tags:
    - { name: monolog.logger, channel: ibexa.graphql }

Notice that I changed the channel name to ibexa.graphql so it follows the Product convention.

What I don't remember is if you need to use LoggerAwareTrait and implement LoggerAwareInterface for these pieces to work together. If it can be avoided and constructor can inject non-nullable LoggerInterface, then let's skip it.

return;
}

$this->logger->critical(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there was a discussion about whether it should be critical or debug. To me it feels like a debug if it comes from lack of permissions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test coverage.

@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants