Repository navigation
[M2.3d1] Require explicit route authority and tenant scope - #93
Merged
Merged
Conversation
5 tasks done
samuelmbabhazi
force-pushed
the
feat/m2.3c4c2-membership-queries
branch
from
November 5, 2026 14:53
0855a32 to
80bd3bc
Compare
samuelmbabhazi
changed the base branch from
feat/m2.3c4c2-membership-queries
to
main
November 5, 2026 14:54
samuelmbabhazi
force-pushed
the
feat/m2.3d1-explicit-route-authority
branch
from
November 5, 2026 14:55
eb9661e to
4563504
Compare
samuelmbabhazi
added a commit
that referenced
this pull request
Nov 5, 2026
## Task M2.3d2a, stacked on #93. Review in order; no automatic merge. Resource-command opt-in and token actor auditing follow in M2.3d2b. ## What changed and why API-token creation, authentication and private creation replay now intersect scopes with live tenant membership, ancestry and environment protection. Account-only profile tokens retain their existing behavior. The account mutation boundary accepts a token context only when the application command declares its required permission and target. It revalidates the exact credential and owner under the account lock held through the operation. Revocation after HTTP authentication therefore prevents command execution even when the account security version has not changed. Substituted principals are rejected before another account lock is acquired. Password/MFA privilege operations reject bearer contexts. ## Validation - API lint, typecheck, build and 126 unit/HTTP tests pass. - 26 PostgreSQL tests pass, including real restricted-role token HTTP flows, live role/protection changes, narrowed scopes, substituted credentials, revocation between transport and command, and existing ordered privilege locks/rollback. - Authority/authentication coverage: 99.04% statements, 98.8% branches, 100% functions/lines. - Local Semgrep: zero findings across the codebase and an explicit scan of all three new files. One existing generated Go rule timed out during the whole-tree scan; the new TypeScript files parsed completely. ## Security considerations No permission cache, user-supplied role metadata or credential fallback. Existing token rows remain hash-only. Live tenant reads use restricted database credentials and forced RLS. No new dependency, shell invocation or secret exposure path. Resource controllers are not exposed by this slice. ## CI execution blocked GitHub currently refuses to start jobs because of failed recent account payments or an insufficient spending limit. The account owner must resolve Billing & plans and rerun CI. Local checks above are not a substitute for a passing GitHub run. CodeQL remains separately disabled by repository configuration. ## Checklist - [x] M2.3d2a acceptance met and PLAN updated - [x] SPEC documents transactional token authority - [x] Relevant local checks and application coverage pass - [x] No new business mutation requiring an audit event - [x] Human review required; do not merge automatically
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.
Task
M2.3d1, stacked on #92. Review in order; no automatic merge. The resource controllers and command-boundary token checks follow in M2.3d2–d4.
What changed and why
Routes without an explicit anonymous, account or tenant declaration now reject even valid credentials. Existing identity controllers declare account access. Tenant declarations resolve canonical organization/project/environment ancestry from path parameters and require live resource authorization for sessions. Account declarations reject tenant parameters.
Bearer access remains opt-in and must match the route permission exactly. Authentication receives the resolved tenant target; request body/query fields cannot alter its scope. An inventory test checks every registered controller route for an access declaration.
Validation
Security considerations
A session alone no longer authorizes an undeclared route. Resource state is queried through the existing forced-RLS tenant boundary. Anonymous mutations retain Origin checks, session mutations retain CSRF and bearer authentication retains its quota. No new resource mutation endpoint, dependency, shell invocation or secret exposure path.
Checklist
CI execution blocked
GitHub Actions did not start the latest jobs. Its annotation reports failed recent account payments or an insufficient spending limit. No runner steps executed. The account owner must resolve Billing & plans and rerun the workflows; this is not a passing CI result. CodeQL remains separately disabled by repository configuration.