Repository navigation
feat(oidc): let a backend client send account notices for its linked public clients - #565
Merged
Merged
Conversation
…public clients Adds oidc_client_links with admin routes under /admin/applications/:id/links, an optional clientId on POST /applications/account-notices, and noticeActionOrigins on applications. Amends ADR 0001 D14. Closes #547
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.
Closes #547. Implements ADR 0002, N4 and N5.
What
Client links. A new
oidc_client_linkstable (composite primary key, foreign keys that cascade on delete, a reverse index onlinkedClientId, no self links) and admin routes:GET /admin/applications/:id/linksreturns{ links, linkedFrom }.PUT /admin/applications/:id/links/:linkedIdis idempotent, needs step-up, and is audited asadmin_oidc_application_link_added.DELETE /admin/applications/:id/links/:linkedIdneeds step-up and is audited asadmin_oidc_application_link_removed.A link is refused unless the acting application is confidential, the linked one is a different public application, and both are first-party or both third-party (third-party links also need
third_party_clients_enabled). The same rules are checked again every time a link is used, so disabling a client or moving it across the first-party boundary ends the link's effect at once. Deleting an application removes its links in both directions. Every application response now listslinks,linkedFromandnoticeActionOrigins.Notices through a link.
POST /applications/account-noticestakes an optionalclientId. When it is set, the caller must hold a link to that client, and the grant check (hasOidcGrantForUser) and the template ([<linked name>] ...,Sent by <linked name> through <instance>) use the linked client. A missing link, a disabled linked client or a link that breaks the rules answers the same404 notice_unknown_useras an unknown user. The caller'sclient_credentials,notices:send,noticesEnabledand rate limits still apply, and the action link is checked against the caller's origins. The auth event recordsclientId(the caller) andsentForClientId.noticeActionOriginsonoidc_clients: barehttpsorigins, never loopback, unique, at most 20. They are set on application create orPATCH(step-up, audited). An action link may point at these or at the caller'shttpsredirect origins.ADR 0001 D14 is amended, ADR 0002's issue table is updated,
docs/admin-operations.mdgains a Links section, andopenapi.jsonandadapter-manifest.jsonare regenerated (the three link routes are access passthroughs).Contract
This changes the contract. It adds routes, a request field and response fields, and nothing is removed or renamed.
@seamless-auth/types0.35 does not carry the new shapes yet, so the API extends the published schemas locally insrc/schemas/oidcApplications.*.tsandsrc/schemas/applicationNotices.requests.ts, markedTODO(seamless-auth-types#148). Response validation would strip the new fields otherwise.Follow-ups
clientIdon the notice request,noticeActionOrigins, the new auth event types. The API then drops its local copies.noticeActionOrigins.noticeActionOriginsflags.Checks
npm run typecheck,npm run lint,npm run format:checkandnpm run buildpass.npm run coveragepasses: 171 files, 2798 tests. Lines are at 99.24% and branches at 95.77%.tests/integration/oidc/oidcClientLinks.spec.tscovers the link routes, every refusal including both directions across the first-party boundary, idempotence and audit.accountNotices.spec.tscovers sending for a linked client, the same 404 for an unlinked or missing client, a disabled linked client, one moved across the first-party boundary or made confidential, and action links checked against the caller.oidcApplications.spec.tscoversnoticeActionOriginsvalidation and auditing, and link cleanup on delete.tests/postgreslink specs pass there: the real lookup, idempotent creation, the self-link check constraint, and cascades from both sides. One existing spec there,application resources, fails the same way onmainin that local database (system config validation), so it is unrelated to this change.