Repository navigation
feat(auth): enforce the role matrix on every data route (M2c, #94) - #101
Merged
Merged
Conversation
PERMISSIONS in api/auth.py maps each action to the roles allowed it; allow(action) returns 403 for any other signed-in role. docs/ROLES.md shows the same table and tests/test_roles.py fails if they drift, then tries every role against every route. Requests without a session keep the shared-key access. Isolation tests now use tenant admins, so they check isolation at the highest privilege. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019YPoXzBSj89ZHgw7nfTmbB
Owner
Author
|
Role matrix approved as proposed by the product owner on 26 Oct. Generated by Claude Code |
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.
Fixes #94. This is part 3 of ART Milestone 2 (BR-36; the roles come from ADR-0003).
The matrix (also in
docs/ROLES.md)This is my recommended default and needs your sign-off. I picked it for three reasons:
Changing it means editing one line in
PERMISSIONSand the matching row in the doc. The test fails if the two disagree.How
PERMISSIONSinapi/auth.pymaps each action to the roles allowed to do it.allow(action)is a route dependency that returns 403 to any other signed-in role. It reuses the request'stenant_scoperesult, so the session is looked up only once.Evidence
All runs are against local PostgreSQL 16.
scripts/test_report.py --strict)tests/test_roles.pyscripts/lint.shGenerated by Claude Code