-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
AccessDeniedHttpException in FramentListener leads to status 500 instead of 403 #11663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't think that FragmentListener or AccessDeniedHttpException are responsible. Can you provide a full stack trace ? or a fork of SE with this beahvior ? |
@fmeynard I think there is a bug with the handling of exceptions when they are thrown in the listeners in some cases |
exactly. throwing AccessDeniedHttpException is correct, but this should |
I can't reproduce: I managed to throw an AccessDeniedHttpException in FragmentListener by faking a call to a fragment with an unsafe method, I got a 403 status as required. |
I don't know if it is linked... |
@jeremyFreeAgent but AccessDeniedException is handled by the exception controller of the Security component when you are behind a configured firewall. |
@stof so it is a bad practice to throw a AccessDeniedException in a controller outside the pattern of a configured firewall? |
@jeremyFreeAgent careful, the exception dbu was referring to is an AccessDeniedHttpException not an AccessDeniedException. AccessDeniedHttpException extends HttpException which implements HttpExceptionInterface so the handleException function is supposed to take its status (403) and not send a 500... |
@fgueguen True, that why I said:
|
yes. The AccessDeniedException is related to the Security component, asking it to check whether you could have a chance to authenticate with a higher level before giving you a 403 (if you are an anonymous or remembered user, it will ask you to authenticate instead). |
I'm having a look at this during the Hackday at Madrid. |
…iedHttpException in kernel request listener
…iedHttpException in kernel request listener
After poking around for a while, I cannot reproduce this bug. At least not as a generic bug with how the system handles I PR'd the tests, maybe someone else can figure out if there is some specific scenario where this bug happens. |
played around with this again. i use a stock symfony 2.5 kernel and generated a fragment url, then curl that with the esi capability. i have security configured so that _fragment is not in the paths allowed by my user. in prod (!) environment, i get this stack trace as response: `
|
The only thing that looks suspect to me is |
@dbu I just tried to reproduce this issue and I'm not experiencing the same behaviour (Symfony 2.6). Since I'm second person who can't reproduce it, please re-create your issue on a fork of Symfony SE and provide instructions how to trigger the error. |
Sorry for not following up on this. i now tried this again. the problem is in symfony 2.3. can you try these steps?
Then try to send a request with a non-safe method: The problem also exists with symfony 2.5 but that is already past its support period. |
@dbu yept, that did the job. Thanks, I'll be looking into this! The problem doesn't exist in >=2.6 anymore. |
Closing as this issue isn't present in any maintained release. |
when the AccessDeniedHttpException is thrown in FragmentListener i get a status 500 page, instead of a 403 page.
The text was updated successfully, but these errors were encountered: