Repository navigation
feat: manage webhooks, login hooks, custom claims and audit sinks from the CLI - #359
Merged
Merged
Conversation
…m the CLI Adds seamless webhooks, seamless hooks, seamless claims and seamless audit-sinks over the auth API v0.23 admin routes. Signing secrets are printed once, when issued. A second secret rotation inside the 24 hour overlap, deletes, and claim removals ask first. hooks set and audit-sinks update change only what a flag names. A failed test call exits 1. An instance before v0.23 answers with a message naming the release it needs. Part of #343
This was referenced Nov 8, 2026
Bccorb
marked this pull request as ready for review
November 8, 2026 03:30
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.
Needs auth API v0.23, which is not released. Every command here calls routes from seamless-auth-api #580 (webhooks), #582 (audit sinks), #583 (login hooks) and #584 (custom claims). Those PRs are open and the API release is held (seamless-auth-api#566), so nothing here has run against a real instance. Against v0.22 and earlier each command exits 1 with "This instance has no webhooks. Webhooks need Seamless Auth API v0.23 or later." (and the same for login hooks, custom claims and audit sinks), as #356 does for permissions.
Part of #343 (webhooks and hooks). With #356 this covers the issue's list, plus custom claims and audit sinks so the whole v0.23 admin API can be driven from the CLI.
What
Four instance-management commands, all with
--json:How
src/core/admin.tsusecall(), so every write (includingtestandredeliver, which the API treats as writes) gets the step-up retry and a 403 goes throughforbidden().unsupported()now takes the message, so each feature names itself on a pre-v0.23 instance.@seamless-auth/types0.40.0 schemas (bumped from 0.38), loosened. The event catalogue, the failure reasons and the audit sink kinds grow by addition, so those fields accept any string: a newer API does not break an older CLI'slist. Failure reasons print as the API's code, somisconfigured(a sink setting that cannot be used, such as an unset_AUDIT_SINK_SECRETenv var) shows asfailing: misconfiguredandTest record failed: misconfigured, which a test covers.details.issues; those are added to the message (Could not update webhook (400: invalid_request), url must use https.).webhooks create,rotate-secreton both, andhooks setwhen it creates the hook.--jsonincludes them.--forceskips).hooks setandaudit-sinks updatestart from the current record. The API replaces a hook's settings whole and fills defaults, so without thishooks set pre_token --disablewould also reset the timeout and failure mode. A new hook gets a note that it fails closed.claims setreplaces the whole set like the API. It reads the current set and asks before removing a claim, asroles setdoes. Reserved names, bad names, nesting past 3 and the 1 KiB budget are refused before the request, with readable messages for the name rules.testexits 1, with or without--json.WRITABLE_KEYSis untouched.Verification (at 8f662a0)
npm run coverage(also the pre-commit hook): 88 files passed, 2 skipped; 2104 tests passed, 28 skipped. Statements 99.04%, branches 96.78%, functions 98.47%, lines 99.32%, above the floor. The four new command files are at 100% lines.npm run buildpasses.npm run check:types-current:@seamless-auth/types "^0.40.0" is current (latest 0.40.0).npm run check:pinspasses.feat/custom-claimsandfeat/audit-sinks.Not run: no live run against an instance, since the API PRs are unreleased and unmerged. No committed e2e, same as #356.