Repository navigation
Description
Reconciliation — 2026-10-05
- Existing application credentials/workload bindings have canonical persistence and narrowing tests: workload binding SQL tests; credential lifecycle tests.
The reusable foundation is delivered; the generic resource API/service-grant relationship described below is not established by those tests. User delegation grants, capability catalogs and Alia machine-key scopes do not substitute for ApplicationServiceGrant. Keep this issue and its eight integrated acceptance criteria open.
Part of #873. Depends on the accepted design in #874.
Goal
Add the durable Oxy API model for services exposed by one registered Application and access granted to another registered Application, without duplicating application identity or overloading user OAuth scopes.
Required entities
Implement repository-conventional equivalents of:
Resource service API
A resource application can publish a versioned service contract containing:
- Resource
applicationId. - Stable API/service key and version.
- Human name and description.
- Closed scope/capability vocabulary with safe descriptions.
- Environment availability.
- Status: draft, active, deprecated or retired.
- Approval and publication audit.
- Optional documentation and endpoint metadata that contains no secret.
Scope names are namespaced to the resource API and must not collide semantically with user OAuth scopes.
Application service grant
Represent:
- Consumer application id.
- Resource application id.
- Resource API/version.
- Environment.
- Granted scopes.
- Status: pending, active, suspended, revoked, expired or equivalent.
- Requester, approver, reason and terms/evidence where required.
- Effective, expiry, suspended and revoked timestamps.
- Optional constraints and quotas whose semantics are explicit.
- Append-only audit history.
Credential binding
Let a service credential be narrowed to an approved subset of:
- Resource applications.
- Resource APIs.
- Environments.
- Scopes.
A credential cannot expand its owning application's grants. Empty binding behavior must be decided by #874 and represented explicitly rather than inferred differently in several code paths.
Authorization and lifecycle
- Only callers with the correct account/application permissions can request or manage outgoing access.
- Resource owners or Oxy staff approve access according to the policy selected by ADR: define canonical application principals, resource audiences and service grants #874.
- Platform-trusted classification alone does not create a grant.
- Deleting or suspending either application blocks new authorization safely.
- Revoking one grant does not revoke unrelated credentials or grants.
- Rotating a credential preserves its grant bindings only through an explicit, auditable operation.
- Retiring an API version prevents new grants while preserving historical audit and migration state.
- No application-name or domain string is used as a foreign key.
- Environment boundaries are enforced by database constraints and services.
- Effective permission is always the intersection selected by ADR: define canonical application principals, resource audiences and service grants #874.
API surface
Add typed, permissioned operations for:
- Listing resource APIs exposed by an application.
- Creating/publishing/deprecating a resource API and scopes.
- Requesting and approving a grant.
- Listing outgoing and incoming grants.
- Updating scope subsets without rewriting history silently.
- Suspending, revoking and expiring access.
- Binding and unbinding service credentials.
- Reading safe effective-access summaries.
- Operator audit and consistency checks.
- Seeding official relationships idempotently.
Security and privacy
- Public application metadata does not expose private grants or credential bindings.
- Secrets are never stored in grant rows.
- Audit records contain stable ids and bounded reasons, not raw tokens.
- A consumer cannot enumerate grants belonging to unrelated applications.
- Grant APIs use the existing account-owned application RBAC rather than adding per-grant membership.
- Staff-only approval and override actions are explicit and audited.
- Cross-environment grants are structurally impossible or rejected before persistence.
- Database indexes support token mint checks without broad table scans.
Migration
- Preserve the existing
applicationsandapplication_credentialsids. - Do not move service permissions into a second application record.
- Provide an idempotent seed/reconcile path for official applications such as Mercaria and Moovo.
- Do not create a production grant merely because both applications are first party.
- Existing Oxy Pay scope behavior is migrated through the dedicated rollout issue in this epic.
- Add consistency reports for dangling, cross-environment, overbroad and retired-version bindings.
Acceptance criteria
- The existing Mercaria and Moovo application ids can be linked by one production service grant.
- Several Mercaria credentials can be narrowed differently without creating several Mercaria applications.
- User OAuth scope data remains unchanged by the grant.
- Grant, credential and application suspension/revocation have independent, tested outcomes.
- Unauthorized callers cannot enumerate or modify another account's grants.
- The token mint can resolve effective permissions with one authoritative service path.
- Real-database tests cover uniqueness, lifecycle, environment isolation, narrowing, rotation and deletion behavior.
- The model has no duplicate local application registry or synthetic service principal.
Activity