Skip to content

spec: admin-on-behalf-of dual-auth on reservations (list/get/release) - #37

Merged
amavashev merged 1 commit into
mainfrom
spec/admin-reservations-dual-auth-v0.1.25.14
Apr 13, 2026
Merged

amavashev merged 1 commit into
mainfrom
spec/admin-reservations-dual-auth-v0.1.25.14

Conversation

@amavashev

Copy link
Copy Markdown
Contributor

Summary

Stage 2 of the dashboard ops gap rollout — gives admin operators read access and force-release capability against reservations. Mirrors the dual-auth pattern established for createBudget / createPolicy / updatePolicy in governance-admin v0.1.25.13.

Changes

Three reservation operations gain `AdminKeyAuth` as an alternative security scheme:

  • `GET /v1/reservations` (listReservations)
  • `GET /v1/reservations/{id}` (getReservation)
  • `POST /v1/reservations/{id}/release` (releaseReservation)

Plus: new `AdminKeyAuth` security-scheme declaration (X-Admin-API-Key header — same header the governance-admin spec already uses).

Deliberately NOT exposing

  • `createReservation` — admin shouldn't reserve on tenant's behalf
  • `commitReservation` — committing takes from tenant's budget but admin's key would be the actor in the tenant's audit trail (footgun)
  • `extendReservation` — same reasoning

Force-release is the only legitimate admin lifecycle action.

Semantic delta on `listReservations.tenant`

  • ApiKeyAuth: unchanged — optional, validation-only against effective tenant
  • AdminKeyAuth: REQUIRED as a filter; omitting → 400 INVALID_REQUEST

Same single-param dual-semantic shape as governance-admin's admin reads (listBudgets, listPolicies). Avoids adding a parallel `tenant_id` and inconsistent naming.

Audit logging

Admin-driven `releaseReservation` MUST record `actor_type=admin_on_behalf_of` (existing audit field, value already used on createBudget/createPolicy). NORMATIVE in the spec text.

Backward compatibility

Purely additive. Existing ApiKey callers see zero behavior change. No schema modifications — `ReleaseRequest` already has the optional `reason` field.

Lint

`npx spectral lint cycles-protocol-v0.yaml` — 0 errors, 20 pre-existing warnings (none from this change).
`npx spectral lint merged/cycles-openapi-protocol-merged.yaml` — 0 errors, 44 pre-existing warnings.
`make merge` regenerated; merged artifact committed (drift check passes).

Downstream PRs (sequential)

  1. [spec] this PR — must merge first.
  2. [server] cycles-server-admin v0.1.25.16 — `ADMIN_ALLOWED_ENDPOINTS` gets the 3 entries; ReservationController branches on auth context; `actor_type=admin_on_behalf_of` audit/event tagging on admin-release.
  3. [dashboard] cycles-dashboard v0.1.25.22 — new `ReservationsView` with tenant filter + force-release action; sidebar entry.

Test plan

  • `npx spectral lint` — clean on both source + merged
  • `make merge` regenerated and committed (no drift)
  • Server team validates `ADMIN_ALLOWED_ENDPOINTS` plumbing maps cleanly to existing AuthInterceptor pattern

cycles-protocol-v0 revision 2026-04-13. Stage 2 of the dashboard ops
gap rollout — gives admin operators read access and force-release
capability against reservations, mirroring the dual-auth pattern
established for createBudget / createPolicy / updatePolicy in the
governance-admin spec v0.1.25.13.

Three reservation operations gain AdminKeyAuth as an alternative:
  GET   /v1/reservations            (listReservations)
  GET   /v1/reservations/{id}       (getReservation)
  POST  /v1/reservations/{id}/release (releaseReservation)

createReservation / commitReservation / extendReservation remain
ApiKeyAuth-only by design — admin acting on those is a footgun
(committing on behalf of a tenant takes from the tenant's budget but
the tenant's audit trail wouldn't show their key as the actor).
Force-release is the only legitimate admin lifecycle action.

Semantic delta on listReservations.tenant query param: REQUIRED as a
filter (not validation) under AdminKeyAuth; unchanged under
ApiKeyAuth. Same single-param dual-semantic shape as the
governance-admin admin reads (listBudgets, listPolicies). Omitting
under AdminKeyAuth MUST 400 INVALID_REQUEST.

Audit-log requirement (NORMATIVE) on admin-driven release:
actor_type=admin_on_behalf_of, matching the existing tag the server
emits for createBudget / createPolicy. Callers SHOULD populate the
optional `reason` body field with a structured tag for grep-ability.

New security scheme declaration: AdminKeyAuth (apiKey,
X-Admin-API-Key header) — same header the governance-admin spec
already uses, so admin operators authenticate with one key against
both planes. ReleaseRequest schema unchanged (already has optional
`reason` field — no body change needed).

Backward compatible: ApiKey-only callers see no behavior change.

Spectral lint: 0 errors on both the source spec and the regenerated
merged artifact (merged/cycles-openapi-protocol-merged.yaml). 44 pre-
existing warnings, none from this change.
@amavashev
amavashev merged commit b602a42 into main Apr 13, 2026
1 check passed
amavashev added a commit that referenced this pull request Apr 14, 2026
…ard-compat)

Additive spec extension reserving the contract for tenant-role
introspect. No server implementation required in this revision;
no downstream repos touched. Purely forward-compatibility stake
so future multi-role clients don't re-litigate the capability
shape or drift across implementations.

Changes (all additive, zero wire impact on existing admin callers):

1. Security block on GET /v1/auth/introspect gains ApiKeyAuth
   alongside existing AdminKeyAuth. Same dual-auth pattern used
   for budgets/policies (#36), reservations (#37), and webhooks (#40).

2. AuthIntrospectResponse schema gains three fields, populated only
   when auth_type=tenant:
   - tenant_id (REQUIRED under tenant auth; MUST be absent under admin)
   - scope_filter (OPTIONAL; non-empty when key has scope restrictions)
   - auth_type enum gains value "tenant" alongside existing "admin"

3. Also surfaces the optional manage_* / view_reservations capability
   flags that servers have been returning for several releases (pre-
   existing wire behavior, now formally documented in the schema).

4. NORMATIVE capability-derivation table added to the capabilities
   schema description. Servers MUST derive the capabilities map from
   a tenant key's permissions per the published rules. Guarantees any
   future server or client produces identical capability maps from
   identical permission sets. Admin-plane views (view_tenants,
   view_api_keys, view_audit, view_overview) only fire on admin:*
   permissions, so default tenant keys cannot accidentally access
   admin-only pages.

5. Scope-filtered keys documented as NOT altering the capability map —
   filters constrain which records are visible at each endpoint, not
   whether a page is accessible. Enforcement stays server-side.

Non-goals (explicit to prevent scope creep when implementation lands):
- No tenant-scoped /v1/admin/overview (admin-only).
- No tenant-scoped /v1/admin/audit/logs (admin-only).
- No admin-on-behalf-of introspect of a specific tenant key.

Version: editorial 0.1.25.14 -> 0.1.25.15. semantic_base unchanged
at 0.1.25.9 (no wire-breaking change). cycles-spec-index.yaml
editorial pin bumped to match.

Gates:
- spectral lint: 0 errors (64 pre-existing warnings unchanged)
- merge_specs.py: idempotent (rerun produces no further diff)
- yaml.safe_load parses cleanly
- ApiKeyAuth count: +1 (41 total, was 40)

Implementation impact: none required. Compliant servers continue
returning admin-only introspect until they explicitly extend to
ApiKeyAuth. Rollout is opt-in; this revision just reserves the
shape.
@amavashev
amavashev deleted the spec/admin-reservations-dual-auth-v0.1.25.14 branch June 18, 2026 17:19
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