Skip to content

[M2.3d1] Require explicit route authority and tenant scope - #93

Merged
samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.3d1-explicit-route-authority
Nov 5, 2026
Merged

samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.3d1-explicit-route-authority

Conversation

@samuelmbabhazi

@samuelmbabhazi samuelmbabhazi commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • API lint, typecheck, build and 126 unit/HTTP tests pass.
  • All 90 identity PostgreSQL integration tests pass with the new route guard.
  • Malformed/missing/surplus ancestry, undeclared routes, revoked live authority, mismatched bearer permissions, CSRF and session fallback are covered.
  • The parent quota correction passed its five PostgreSQL tests and all eight Chromium browser scenarios; no quota limits were weakened.
  • Go tests and protobuf lint passed at the preceding application checkpoint; no Go/protobuf changes here. CI reruns the complete workspace and integration/browser suites.

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

  • M2.3d1 acceptance met and PLAN updated
  • SPEC documents explicit declarations and path authority
  • Relevant local lint, types, unit and integration checks pass
  • No new state change requiring an audit event
  • Human review required; do not merge automatically

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.

@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.3c4c2-membership-queries branch from 0855a32 to 80bd3bc Compare November 5, 2026 14:53
@samuelmbabhazi
samuelmbabhazi changed the base branch from feat/m2.3c4c2-membership-queries to main November 5, 2026 14:54
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.3d1-explicit-route-authority branch from eb9661e to 4563504 Compare November 5, 2026 14:55
@samuelmbabhazi
samuelmbabhazi merged commit 4be5a11 into main Nov 5, 2026
2 of 11 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m2.3d1-explicit-route-authority branch November 5, 2026 14:55
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant