Skip to content

feat: fill the extensibility schema gaps found by the API and provider - #158

Merged
Bccorb merged 2 commits into
mainfrom
feat/wave4-consumer-gaps
Nov 8, 2026
Merged

Bccorb merged 2 commits into
mainfrom
feat/wave4-consumer-gaps

Conversation

@Bccorb

@Bccorb Bccorb commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Collects what the Wave 4 consumer PRs had to work around locally. They build on fells-code/seamless-auth-api#580, #582, #583, #584 and #585 and fells-code/seamless-auth-oidc-provider#63, all open and unreleased.

Part of #148 (the two link event types only; the link and notice schemas there are still to do).

What it adds

  • AUTH_EVENT_TYPES: session_created (#580), custom_claims_omitted (#584), and admin_oidc_application_link_added / admin_oidc_application_link_removed (already on API main). Found by diffing the list against src/schemas/authEvent.types.ts on feat/oidc-provider-claims and feat/audit-sinks, and checking every type: '...' the API writes on both branches. A new test keeps the list sorted and free of duplicates.
  • OidcAccountClaimsSchema: optional permissions, permissions_omitted (true only), org_roles, org_permissions, and customClaims (custom claim values, defaulting to {} so an older API still parses). Matches what #585 returns from GET /oidc/accounts/:id and what seamless-auth-oidc-provider#63 extends locally. Additive, so OIDC_EDGE_CONTRACT_VERSION stays at 3.
  • OidcSignRefusalCodeSchema: claims_mismatch, which #585 (590caa1) now answers from /oidc/sign for every account-claim mismatch, so the provider reads the account again and retries once. OIDC_EDGE_CONTRACT_VERSION stays at 3. An older provider (main) parses refusals with the shared OidcSignRefusalSchema; an unknown code fails that parse and becomes OidcApiError(403, '/oidc/sign'), which #signOrRefuse rethrows. The sign failed the same way for the subject_mismatch the API sent before, since only session_revoked and unknown_key get special handling. Bumping would stop every older provider from starting against the new API, which is worse than a less specific log line.
  • CustomClaimValueSchema: no longer z.json(). It is spelled out as three nested levels of string, number, boolean, null, array and record, which accepts and refuses exactly what z.json() plus the depth check did. Values nested too deep still get the message must not nest deeper than 3 levels. CustomClaimSourceSchema.claims uses it too, so the source and list responses can be described without overflowing the generator. PreTokenHookResultSchema keeps z.json(): the API checks hook claim depth itself, so it can audit the failure, and that schema never goes into the OpenAPI document.
  • CalloutFailureSchema: misconfigured, for a destination whose own configuration cannot be used, such as an audit sink naming a _AUDIT_SINK_SECRET env var that is not set. #582 reports that as refused today.
  • LoginDeniedErrorSchema ({ error: 'login_denied', message?: string }) and LoginHookUnavailableErrorSchema ({ error: 'login_hook_unavailable' }), the 403 and 503 bodies from #583's loginHookRefusal.

@asteasolutions/zod-to-openapi (^9.1.0, the API's version) is now a dev dependency. src/schemas/customClaim/openapi.test.ts generates components for every schema that carries a claim value, the way the API does it, and also checks that a plain z.json() still overflows (so the test shows why the values are spelled out). Against main's customClaim/schema.ts the generation test fails with RangeError: Maximum call stack size exceeded.

Notes for consumers

  • CustomClaimValue is now a type nested three levels deep rather than zod's JSONType. Nothing in the API or provider branches names the type, but code that assigns an arbitrary JSONType to it would need a parse.
  • customClaims on account claims is held to the custom claim value rules, where the local extensions used z.unknown(). The API already holds static and hook claims to the same depth limit, so a valid response is unchanged.
  • The admin console's FAILURE_TEXT: Record<CalloutFailure, string> (seamless-auth-admin-dashboard#343) needs a misconfigured entry once it takes this release.

Local workarounds to drop once published

  • seamless-auth-api feat/oidc-provider-claims (#585): OidcAccountClaimsResponseSchema and the claims_mismatch extension of OidcSignRefusalSchema in src/schemas/oidcEdge.responses.ts, and the CLAIMS_MISMATCH / SignRefusalCode union in src/services/oidcSigning.ts.
  • seamless-auth-api feat/custom-claims (#584): the wrappers in src/schemas/customClaim.schemas.ts.
  • seamless-auth-api feat/audit-sinks (#582): report unusable sink settings as misconfigured instead of refused (SinkRefused in src/lib/auditSinkTransport.ts).
  • seamless-auth-oidc-provider feat/provider-token-claims (feat(oauth): return returnTo from the callback and restrict its scheme #63): the .extend in OidcProviderAccountSchema (src/accountClaims.ts), and SignRefusalSchema in src/apiClient.ts plus the CLAIMS_MISMATCH / SignRefusalCode union in src/errors.ts.
  • seamless-auth-admin-dashboard feat/webhooks-hooks-claims-sinks (#343) and main: PENDING_EVENT_TYPES in src/lib/eventLabels.ts.

Checks

  • npm test: 33 files, 708 tests passed
  • npm run lint: clean
  • npm run typecheck: clean
  • npm run build: clean
  • npm run format:check: All matched files use Prettier code style!
  • npm run test:zod-floor: zod 4.5.0 ok with both bundler and NodeNext resolution

Not run: building the API or provider against this package. Their local workarounds come out in follow-ups once this is published.

Adds the audit event types the API writes, the permission and custom
claims on OidcAccountClaimsSchema, a non-recursive custom claim value
the OpenAPI generator can describe, the misconfigured callout failure,
and the login hook refusal bodies.
@Bccorb
Bccorb merged commit e531f89 into main Nov 8, 2026
5 checks passed
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