Skip to content

[M2.3d2a] Enforce live token authority inside command locks - #96

Merged
samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.3d2a-live-token-authority
Nov 5, 2026
Merged

samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.3d2a-live-token-authority

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

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

  • M2.3d2a acceptance met and PLAN updated
  • SPEC documents transactional token authority
  • Relevant local checks and application coverage pass
  • No new business mutation requiring an audit event
  • Human review required; do not merge automatically

@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.3d1-explicit-route-authority branch from eb9661e to 4563504 Compare November 5, 2026 14:55
@samuelmbabhazi
samuelmbabhazi changed the base branch from feat/m2.3d1-explicit-route-authority to main November 5, 2026 14:55
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.3d2a-live-token-authority branch from fad5372 to 611464c Compare November 5, 2026 14:56
@samuelmbabhazi
samuelmbabhazi merged commit 4f74e20 into main Nov 5, 2026
2 of 11 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m2.3d2a-live-token-authority branch November 5, 2026 14:56
samuelmbabhazi added a commit that referenced this pull request Nov 5, 2026
## Task

M2.3d2b, stacked on #96. Completes the transactional token-authority
slice; resource HTTP endpoints follow in M2.3d3. Review in order; no
automatic merge.

## What changed and why

Organization settings and project/environment creation/settings declare
their own token permission and exact target at the account mutation
boundary. The transport carries only the authenticated principal and a
redacted credential; request-body identity fields are ignored. Audits
identify the API token used.

Individual resource reads support scoped tokens. Catalog and
member/binding collections remain session-only because filtering by the
owner's permissions alone would widen a narrow token's visible results.
Organization creation and password/MFA privilege operations remain
session-only.

## Validation

- API/web/domain lint, typechecks, unit tests and builds pass; Go tests
and protobuf lint pass.
- All 207 PostgreSQL integration tests pass across 36 files.
- Six restricted-PostgreSQL resource-token scenarios pass: all five
settings commands and audit actors, read-only denial, scope isolation,
collection denial, revocation between authentication and command,
concurrent revocation blocked until the write/audit commits, and
rollback on audit failure.
- Eight Chromium/HTTPS/PostgreSQL browser scenarios pass.
- Semgrep reports zero findings across all eight changed TypeScript
files, with complete parsing. Generated OpenAPI remains unchanged.

## Security considerations

The command determines permission and target, and checks the exact token
under the owner account lock held through audit persistence. Revocation
cannot pass that lock during a command; later use is denied. No token
scope is broadened by owner privileges or collection filtering. No new
dependency, shell invocation or secret exposure path.

## CI execution blocked

GitHub 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 are recorded separately from
this blocked remote validation. CodeQL remains separately disabled by
repository configuration.

## Checklist

- [x] M2.3d2b acceptance met; M2.3d2 completed in PLAN
- [x] SPEC documents credential propagation, token audit actors and
session-only collections
- [x] Local workspace and browser checks pass
- [x] Real PostgreSQL concurrency and rollback tested
- [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