Skip to content

feat(symfony): expose voter reasons - #8448

Open
nozarashi20 wants to merge 1 commit into
api-platform:mainfrom
nozarashi20:feat/symfony-voter-reasons
Open

feat(symfony): expose voter reasons#8448
nozarashi20 wants to merge 1 commit into
api-platform:mainfrom
nozarashi20:feat/symfony-voter-reasons

Conversation

@nozarashi20

@nozarashi20 nozarashi20 commented Aug 12, 2026

Copy link
Copy Markdown
Q A
Branch? main
Tickets Closes #7331
License MIT
Doc PR n/a

This PR exposes reasons provided by Symfony voters in denied HTTP responses when %kernel.debug% is enabled. GraphQL behavior is unchanged.

A fresh AccessDecision is captured for every is_granted() call without changing the result of the security expression.

An explicit security message configured on the operation still takes priority. Otherwise, the voter reason is used as the response detail in debug mode. When debug mode is disabled, the response remains generic (Access Denied.), while the voter reason is preserved in the exception message so that it is available to Symfony's exception logging.

ResourceAccessCheckerInterface is unchanged. Existing custom resource access checkers continue to work and fall back to Access Denied. when no captured voter reason is available.

@nozarashi20
nozarashi20 force-pushed the feat/symfony-voter-reasons branch from ba9f7eb to 0ed0686 Compare August 24, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security] Support voter reasons in the "access denied" responses

1 participant