Skip to content

feat: add schemas for webhooks, login hooks, custom claims and audit sinks - #156

Merged
Bccorb merged 1 commit into
mainfrom
feat/extensibility-schemas
Nov 8, 2026
Merged

Bccorb merged 1 commit into
mainfrom
feat/extensibility-schemas

Conversation

@Bccorb

@Bccorb Bccorb commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Closes #146.

Shared schemas for v0.23 Wave 4, as agreed in API ADR 0005 (webhooks, login hooks, custom claims, SIEM streaming). The API consumes its route schemas from this package, so this lands first, as in Wave 3.

What is here

  • Callouts (callout/schema.ts): CalloutUrlSchema (http or https, no userinfo, no fragment; reachability is the API's call at connect time), CalloutFailureSchema (coarse failure reasons that never reveal a resolved address), CalloutSecretSchema (a Standard Webhooks whsec_ secret of 32 bytes), and the test call response.
  • Webhooks (webhook/): routes, the ten-type event catalog plus webhook.test, one payload schema per type, the versioned envelope as a discriminated union, endpoint, delivery and dead letter schemas. webhook/constants (no Zod) holds header names, the 300 s replay tolerance, the 24 h rotation overlap and the retry schedule, for the verifyWebhook work in seamless-auth-server#269.
  • Login hooks (loginHook/): one hook per trigger (post_login, pre_token), 2 s default timeout capped at 5 s, fail closed by default. The call body carries no token, code or secret. A post_login result that tries to add claims fails to parse.
  • Custom claims (customClaim/): claim sets per instance role, organization role and OIDC client, names ^[a-z][a-z0-9_]{0,63}$, JSON values up to depth 3, 1 KiB per set in UTF-8 bytes. customClaim/reserved (no Zod) holds the reserved list for the API and the provider (feat(config): let a deployment ask authenticators to identify themselves #47) to share.
  • Audit sinks (auditSink/): OTLP and syslog settings, sink status, and AuditExportEventSchema (the seamless-auth-events/1 line). Sink credentials name env vars ending _AUDIT_SINK_SECRET and are never stored. No UDP transport.
  • Audit event types for managing and running all four.

Beyond the ADR text

  • The reserved claim list also covers act and may_act (RFC 8693), since a hook asserting a delegation chain would be as misleading as one asserting email.
  • Deliveries are at /admin/webhook-deliveries rather than under /admin/webhooks, so the delivery routes cannot collide with /admin/webhooks/:id.
  • The retry schedule totals 41.6 hours. The ADR said "about 41"; the ADR text is corrected before it lands in the API.

Checks

npm test (675 passed), npm run lint, npm run build, npm run format:check and npm run test:zod-floor (zod 4.5.0 under bundler and NodeNext resolution) all pass locally.

No system_config keys are added, so the CLI WRITABLE_KEYS test is unaffected.

@Bccorb
Bccorb merged commit 10ac02a into main Nov 8, 2026
5 checks passed
@Bccorb
Bccorb deleted the feat/extensibility-schemas branch November 8, 2026 00:30
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.

feat: schemas for webhooks, login hooks, custom claims and audit sinks

1 participant