Skip to content

http_exceptions: insufficient permissions use 403 status code#178

Draft
DrPyser wants to merge 1 commit into
masterfrom
403-insufficient-permissions
Draft

http_exceptions: insufficient permissions use 403 status code#178
DrPyser wants to merge 1 commit into
masterfrom
403-insufficient-permissions

Conversation

@DrPyser

@DrPyser DrPyser commented May 5, 2026

Copy link
Copy Markdown
Contributor

NOTE: before merging this,

  • evaluate if we're okay exposing permission errors as 403 (already visible in response body)
  • evaluate impact on each impacted wazo service (minimally, create PR with Depends-On on this one to find what breaks in tests)

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 401 in this case.

Overview
Updates MissingPermissionsTokenAPIException to respond with 403 Forbidden (and error_id='forbidden') rather than 401 Unauthorized when token validation fails due to missing permissions or invalid tenant.

Extends test_auth_verifier to assert the new 403 behavior for missing permissions and to explicitly assert 401 for 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.

@wazo-community-zuul

Copy link
Copy Markdown
Contributor

Build succeeded.
https://zuul.wazo.community/zuul/t/local/buildset/0030727fd19d462baf9d000e85040486

✔️ wazo-tox-py311 SUCCESS in 2m 39s
✔️ tox-linters SUCCESS in 2m 31s
✔️ wazo-tox-integration-py311 SUCCESS in 5m 46s
✔️ debian-packaging-bookworm SUCCESS in 2m 20s

@DrPyser DrPyser removed the mergeit label May 5, 2026
@DrPyser DrPyser marked this pull request as draft May 14, 2026 19:05
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.

1 participant