Skip to content

[M2.3d2b] Authorize scoped tokens at resource command boundaries - #100

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

samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.3d2b-resource-token-authority

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

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

  • M2.3d2b acceptance met; M2.3d2 completed in PLAN
  • SPEC documents credential propagation, token audit actors and session-only collections
  • Local workspace and browser checks pass
  • Real PostgreSQL concurrency and rollback tested
  • Human review required; do not merge automatically

@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.3d2a-live-token-authority branch from fad5372 to 611464c Compare November 5, 2026 14:56
@samuelmbabhazi
samuelmbabhazi changed the base branch from feat/m2.3d2a-live-token-authority to main November 5, 2026 14:56
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.3d2b-resource-token-authority branch from 32f3990 to 6186b55 Compare November 5, 2026 14:57
@samuelmbabhazi
samuelmbabhazi merged commit 01e5fc4 into main Nov 5, 2026
1 of 6 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m2.3d2b-resource-token-authority branch November 5, 2026 14:58
samuelmbabhazi added a commit that referenced this pull request Nov 5, 2026
## Task

M2.3d3a, stacked on #100. Review in order; no automatic merge. Resource
mutation retries and write endpoints follow in M2.3d3b/c.

## What changed and why

Expose six GET endpoints for organization discovery and nested
organization/project/environment catalogs and details. Session catalogs
retain live SQL filtering before bounded cursor pagination. Detail
endpoints additionally accept the matching scoped API token. Path DTOs
require canonical UUIDv7 ancestry; collection queries reject unknown
fields and malformed pagination.

Responses contain explicit settings and ISO timestamps. OpenAPI and the
TypeScript client are generated from the controllers. API quotas apply
to session reads; bearer requests keep the quota already consumed by
authentication instead of being counted twice.

## Validation

- API lint, typecheck, build and 127 unit/HTTP tests pass, including the
registered-route declaration inventory and single-consumption bearer
quota regression.
- Five restricted-PostgreSQL HTTP scenarios cover all six routes,
pagination, environment-only parent navigation, sibling/foreign
ancestry, missing authentication, forged query fields, scoped tokens,
revocation and quota headers.
- Generated API/client and web lint/typechecks pass; inspected OpenAPI
distinguishes session-only collections from session-or-bearer details.
- Semgrep reports zero findings across all new route/DTO/integration
files and the quota guard, with complete parsing.
- Parent checkpoint passed all 207 integration tests, eight Chromium
scenarios, Go tests and protobuf lint.

## Security considerations

Resource parameters come only from the validated route and are checked
against current tenant state. Collection endpoints cannot broaden a
bearer token's visibility. No resource mutation, new dependency, shell
invocation or secret exposure path.

## CI execution blocked

GitHub currently refuses to start jobs because of failed recent account
payments or an insufficient spending limit. Resolve Billing & plans and
rerun CI before treating remote validation as complete. CodeQL remains
separately disabled by repository configuration.

## Checklist

- [x] M2.3d3a acceptance met; PLAN/SPEC updated
- [x] Generated contract and client committed without manual edits
- [x] Local checks and HTTP/tenant acceptance pass
- [x] No new business mutation requiring audit
- [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