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
{{ message }}
Repository navigation
BUG-30: an approval in an environment the role does not cover answers forbidden, not environment-forbidden #141
In-ProgressWork started and not complete; the comment gives the pull request or the jobbugSomething isn't workingsev:lowA small defect, a defect no code path reaches yet, or a cleanupstatus:openNo fix yet
What is wrong: An approval in an environment that the caller's role does not cover returns 403 with the code forbidden. The route declares environment-forbidden for this case, and :reject returns environment-forbidden for the same caller and the same request. So a client cannot tell "no role" from "wrong environment" on an approval.
Where:cmapi/src/cmapi/routers/requests.py:125, in approve. It passes permitted=c.cfg.roles.allowed(...) to the ledger, and cmapi/src/cmapi/core/approvals.py:280-282 raises a plain forbidden. The route reject calls c.cfg.roles.require(who, "requests:reject", row.env), which gives the right code.
How to prove it: In cmapi/tests/service/test_review_c_authz.py, with the rnd_only fixture, a caller with the role appr-rnd approves a request of dev. The response code must be environment-forbidden. Today it is forbidden.
Measured or inferred: Measured on 2026-11-13 with the service suite's fixtures, on macOS, PostgreSQL 16 on 127.0.0.1:55432. :approve returned "code": "forbidden", "detail": "Missing permission requests:approve for this environment". :reject returned "code": "environment-forbidden", "detail": "Your roles grant requests:reject only in ['rnd'], not dev".
Severity: Low. The call is refused in both cases. Only the code and the text are wrong.
What must hold after the fix::approve returns 403 environment-forbidden with the environments that the role covers. A caller with no approving role still gets 403 forbidden. Each other check of the approval stays in its order: not-pending, already-approved, self-approval, not-eligible.
Research: Not necessary. The role policy's require already makes both answers (cmapi/src/cmapi/core/authz.py:157-165).
Solution (inline, not applied): Call c.cfg.roles.require(who, "requests:approve", row.env) in approve, at the place where reject calls it.
Class: No class. The fix brings the declared behaviour back and adds nothing.
In-Progress: the fix and its test are commit 99c4a42 on branch docs-authz, pushed, with no pull request yet. The test fails before the fix (code forbidden) and passes after it. A second reader checks it before the merge, because it changes an authorization answer.
In-ProgressWork started and not complete; the comment gives the pull request or the jobbugSomething isn't workingsev:lowA small defect, a defect no code path reaches yet, or a cleanupstatus:openNo fix yet
Activity
ephico2real2 commentedon Nov 13, 2026
In-Progress: the fix and its test are commit 99c4a42 on branch docs-authz, pushed, with no pull request yet. The test fails before the fix (code forbidden) and passes after it. A second reader checks it before the merge, because it changes an authorization answer.
docs/15: the Keycloak integration, and the second reader's record for #…