Skip to content

[M2.3e2] Project token administration by project administrators - #121

Merged
samuelmbabhazi merged 5 commits into
mainfrom
feat/m2.3e2-project-token-admin
Nov 5, 2026
Merged

samuelmbabhazi merged 5 commits into
mainfrom
feat/m2.3e2-project-token-admin

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

What changed

M2.3e2: project administrators manage project-bound tokens, whoever created them. This completes M2.3e.

  • AccountMutationAuthority.reauthenticatedWith(context, otherUserId, ...). Verifies the caller's password and second factor while holding the caller's and the other account's locks, taken in canonical order. It changes no privileges and no security version.
  • ProjectApiTokenCommands:
    • list returns metadata, status (computed against the creator's current security version) and createdBy, never the secret or hash;
    • revoke rechecks live member.manage under both locks, is idempotent, and is audited as identity.api_token_revoked with the project's organization, the actor and the creator.
  • Store. listProject, findInProject and revokeInProject, all confined to the project ids.
  • Routes. Both are session-only, with RequireTenant('member.manage', 'project'):
    • GET /organizations/{o}/projects/{p}/api-tokens;
    • POST /organizations/{o}/projects/{p}/api-tokens/{id}/revoke (204), with Origin, CSRF, password and MFA. It joins the retry allowlist, which rejects every other api-tokens path.
  • Route matrix. Regenerated. The unit test now also forbids bearer access on api-tokens paths.
  • Contract and client. Regenerated.
  • Docs. The SPEC describes the routes, and the PLAN ticks M2.3e2 and M2.3e. apiTokenDto moved to the DTO file so both controllers share it.

How it was tested

  • Replay allowlist unit cases cover revoke accepted and list, detail, an invalid id and the environment level rejected.
  • New resource-tokens.integration.spec.ts case:
    • a project admin lists the owner's project token (with creator and status, without the secret) and revokes it;
    • the token then fails authentication;
    • the revocation is audited once, with the actor and the organization;
    • the second revocation is a no-op;
    • a viewer gets not-found on list and revoke, and a wrong password is refused;
    • the admin's security version is unchanged.
  • API unit tests (208) and the local gate pass.
  • Not run locally: the integration tests (no Docker). They run in CI-1.

Security considerations

  • No bearer access.
  • Revocation serializes with the creator's bearer authentication, as SPEC 8 requires ("Revocation ... use that same lock").
  • Secrets are never listed.

@samuelmbabhazi
samuelmbabhazi merged commit be68fcb into main Nov 5, 2026
@samuelmbabhazi
samuelmbabhazi deleted the feat/m2.3e2-project-token-admin branch November 5, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant