Skip to main content
← Back to list
01Issue
FeatureShippedSwamp Club
Assigneesstack72

Relationships

#1300 Add serve, datastore, vault, and worker wildcard scopes to token registry (phase 4 prep, #960)

Opened by stack72 · 7/20/2026· Shipped 7/20/2026

Context

Pre-phase-4 addendum to #960. Adds 4 new wildcard scopes for team-based infrastructure operations that will be authenticated via collective tokens validated against whoami.

Same pattern as #1232 — one-file registry change + tests. No enforcement, no UI, no API changes.

What to change

lib/domain/collective-api-token/token-scope.ts

Add to VALID_SCOPES:

  • serve:*
  • datastore:*
  • vault:*
  • worker:*

Do NOT add entries to WILDCARD_EXPANSIONS — there are no sub-scopes yet. The wildcard is the only scope in each category for now. When sub-scopes are added later (e.g. serve:run, serve:read), they go into both VALID_SCOPES and WILDCARD_EXPANSIONS.

tests/domain/collective_api_token_test.ts

Add test cases for:

  • New wildcard scopes are accepted by TokenScopes.create()
  • hasScope() matches the wildcard directly (e.g. hasScope("serve:*") returns true)
  • isWildcard() returns true for all 4 new wildcards
  • Mixed scopes work (e.g. ["extensions:push", "serve:*", "vault:*"])
  • Sub-scopes that don't exist yet are still rejected (e.g. serve:run is invalid until added to the registry)

Validation approach

These scopes are validated via the existing whoami endpoint. A serve instance/datastore/vault/worker validates a collective token by calling whoami, confirming collectiveToken: true, checking the collective identity, and verifying the required * scope is present in the scopes array. No new endpoints needed.

What this does NOT change

  • No enforcement at routes
  • No UI changes
  • No API changes to token creation
  • No new endpoints
  • No changes to the entity, MongoDB, middleware, or cache

Verification

  • deno task check passes
  • deno task test passes
02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 4 MOREREVIEW+ 3 MOREPR_MERGED+ 1 MORENOTIFICATION_SKIPPED

Shipped

7/20/2026, 9:48:45 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack727/20/2026, 9:27:29 PM

Sign in to post a ripple.