Repository navigation
spec: v0.1.25.13 — dual-auth on createBudget, createPolicy, updatePolicy - #36
Merged
amavashev merged 2 commits intoApr 13, 2026
Merged
Conversation
Adds AdminKeyAuth as an alternative on three previously tenant-only
write endpoints so admin operators can provision budgets and policies
on behalf of tenants from the dashboard:
- POST /v1/admin/budgets (createBudget)
- POST /v1/admin/policies (createPolicy)
- PATCH /v1/admin/policies/{policy_id} (updatePolicy)
Matches the existing dual-auth pattern on listBudgets / listPolicies
(read) and POST /v1/admin/budgets/fund (write). Dashboard had no path
to create budgets/policies — only freeze / unfreeze / fund / update
were exposed — because it authenticates with X-Admin-API-Key only.
Schema additions for admin-on-behalf-of routing:
- BudgetCreateRequest gains optional tenant_id
- PolicyCreateRequest gains optional tenant_id
Required when calling with AdminKeyAuth, MUST NOT be set when calling
with ApiKeyAuth (rejected with 400 INVALID_REQUEST). updatePolicy
needs no body change because policy_id pins the owning tenant.
Audit-log requirement: admin-key-driven calls record
actor_type=ADMIN_ON_BEHALF_OF so security review can distinguish
admin-driven creates from tenant self-service.
Backward compatible: purely additive. Tenant-key callers see no change.
Spectral lint: 0 errors, 64 pre-existing warnings (none touched by
this change).
…tas extension
CI drift check failed because merged/cycles-openapi-admin-merged.yaml
wasn't regenerated after the v0.1.25.13 base-spec change. Fixed via
`make merge`.
Also extended the v0.1.25.13 dual-auth treatment to
updatePolicyActionQuotas in cycles-governance-extensions-v0.1.26.yaml
— this extension overrides PATCH /v1/admin/policies/{policy_id} with
action_quotas / risk_class_quotas / allowed_action_kinds /
denied_action_kinds. Without the same AdminKeyAuth alternative, admin
operators could update policy name/scope (via base updatePolicy) but
not action quotas (via the v0.1.26 extension override) — inconsistent.
policy_id pins the owning tenant in both cases, so no body change is
needed.
Lint: 0 errors across all touched specs (168 pre-existing warnings,
none from this change).
This was referenced Apr 13, 2026
Closed
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.
5 of 6 tasks
amavashev
deleted the
spec/admin-dual-auth-budget-policy-create-v0.1.25.13
branch
June 18, 2026 17:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds `AdminKeyAuth` as an alternative on three previously tenant-only write endpoints so admin operators can provision budgets and policies on behalf of tenants from the dashboard:
Matches the existing dual-auth pattern on `listBudgets` / `listPolicies` (read) and `POST /v1/admin/budgets/fund` (write). The dashboard previously had no path to create budgets or policies — only freeze / unfreeze / fund / update were exposed — because it authenticates exclusively with `X-Admin-API-Key`.
Schema changes
Required when the caller uses `AdminKeyAuth` (server needs to know which tenant owns the new resource). MUST NOT be set when using `ApiKeyAuth` (tenant is implicit from the key; server rejects with 400 INVALID_REQUEST if both present).
`updatePolicy` needs no body change — `policy_id` in the path already pins the owning tenant.
Audit logging
Admin-key-driven calls to these endpoints MUST record `actor_type=ADMIN_ON_BEHALF_OF` (existing audit field, new enum value the server emits). Lets security review distinguish admin-driven creates from tenant self-service.
Backward compatibility
Purely additive. Existing ApiKeyAuth callers see no change. Tenant-key request bodies that omitted `tenant_id` continue to work and remain spec-conformant.
Lint
`npx spectral lint cycles-governance-admin-v0.1.25.yaml` — 0 errors, 64 pre-existing warnings (none touched by this change).
Downstream PRs (in order)
Test plan