http_exceptions: insufficient permissions use 403 status code#178
Draft
DrPyser wants to merge 1 commit into
Draft
http_exceptions: insufficient permissions use 403 status code#178DrPyser wants to merge 1 commit into
DrPyser wants to merge 1 commit into
Conversation
Contributor
|
Build succeeded. ✔️ wazo-tox-py311 SUCCESS in 2m 39s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NOTE: before merging this,
See wazo-confd wazo-platform/wazo-confd#565 for example of impact and changes required.
Note
Low Risk
Low risk: changes only the HTTP status/message for insufficient-permission tokens and tightens unit test coverage; main risk is behavior change for clients that previously expected
401in this case.Overview
Updates
MissingPermissionsTokenAPIExceptionto respond with403 Forbidden(anderror_id='forbidden') rather than401 Unauthorizedwhen token validation fails due to missing permissions or invalid tenant.Extends
test_auth_verifierto assert the new 403 behavior for missing permissions and to explicitly assert401for invalid tokens, clarifying expected status codes per failure mode.Reviewed by Cursor Bugbot for commit 5318d23. Bugbot is set up for automated code reviews on this repo. Configure here.