You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem we are having once an authenticated user access to an authorized resource, that response gets cached by ResponseCache and after that other users can access to that cached response even if those users are not authorized to access that resource.
For example: The endpoint /users/1024 returns information about the user id 1024. This information is Authorized only to that user.
But since it gets cached; this response now is visible by users other than the user id 1024. Meaning, after the response was cached, all the users can view the response of the request to the /users/1024 endpoint.
Is there a way to return cached content only after the validation of the authorization policy?
If not; is there a workaround you can suggest for this issue.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
We are implementing Laravel's Authorization via Policies: https://laravel.com/docs/8.x/authorization#writing-policies
We apply the policies via Middleware in the routes. For example:
The problem we are having once an authenticated user access to an authorized resource, that response gets cached by ResponseCache and after that other users can access to that cached response even if those users are not authorized to access that resource.
For example: The endpoint
/users/1024
returns information about the user id 1024. This information is Authorized only to that user.But since it gets cached; this response now is visible by users other than the user id 1024. Meaning, after the response was cached, all the users can view the response of the request to the
/users/1024
endpoint.Is there a way to return cached content only after the validation of the authorization policy?
If not; is there a workaround you can suggest for this issue.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions