Skip to content

v0.4.0

Choose a tag to compare

@github-actions github-actions released this 09 Nov 03:43
· 4 commits to main since this release
a3022c8

Minor Changes

  • 307f05d: Carry roles, permissions and custom claims in provider tokens (#47).

    • New scopes permissions (roles, permissions, org_id, org_roles, org_permissions, or permissions_omitted) and custom_claims (every custom claim the API resolves for the user and the application). They appear in ID tokens, /userinfo, and a user's RFC 9068 access token for a resource when the grant holds the scope. The consent page describes both.
    • The values come from the API's /oidc/accounts/:id and the API signs only what it computes again, so the edge cannot add or change one. Reserved claim names are never released, and the permission claims are released whole or not at all.
    • When the API refuses a sign with claims_mismatch (a role or membership changed between the account read and the sign), the edge reads the account again and signs once more, so the token request succeeds with the new values. A second mismatch answers server_error (500) with a description. Other refusals are not retried.
    • org_id now names the session's active organization rather than the user's oldest membership. This changes org_id under the seamless scope too.
    • Needs a seamless-auth-api release that returns these claims and signs them. Against an older API none are released.
    • Depend on @seamless-auth/types ^0.40.0 for the shared reserved claim list, the account claims schema and the claims_mismatch refusal code.
  • 18b472c: The edge now follows the API's provider key rotation without a restart. It used to load the signing keys once at startup, so after the API rotated its active key every token request failed with unknown_key until the edge restarted, and /jwks and JWT access token introspection kept the startup keys. It now re-reads the keys every five minutes and at once when the API refuses a key as unknown (at most the request that meets the rotation fails), and /jwks serves the current set. Embedders can set the interval with the new signingKeyRefreshMs option (0 turns the timer off). A rotation to a key with a different algorithm is refused with a logged error and still needs a restart. SigningKeyRing is exported for custom setups.

  • 18b472c: TRUST_PROXY now takes a hop count (2 for a CDN in front of a load balancer) or a comma-separated list of proxy addresses and subnets (10.0.0.0/8, 172.16.0.5, or Express's loopback, linklocal and uniquelocal), and is passed to Express's trust proxy as is. Behind more than one proxy the edge used to forward the last proxy's address as the client IP, so users shared the API's per-IP rate limits and lockouts. true still means one hop and false none, so existing deployments are unchanged; a value that is neither a hop count nor valid addresses now stops the service at startup. Keep the container port reachable only through the proxy.

Patch Changes

  • bfff063: Depend on @seamless-auth/core and @seamless-auth/express ^0.26.0. On 0.x, ^0.23.0 stopped at 0.23, so the edge ran on 0.23 and an application installing the provider got a second, older copy of both. The edge now has the adapter fixes from 0.25: the CSRF origin check on form posts to the auth routes (seamless-auth-server#256), no replay of a completed bearer refresh rotation (#258), no client-chosen client IP under a trust proxy that trusts every address (#257), and a bundled adapter manifest with the v0.23 routes.

    The hosted pages build against @seamless-auth/react 0.20 and @seamless-auth/client 0.9. Client 0.8.2 sent body-less requests such as the passkey step-up start without a JSON content type or the transport header, and adapters from 0.25 refuse those with 415, so step-up needs the newer client.

  • 216b785: The confirmation for a native client now names the account as well as the client. GET /interaction/:uid/details returns account: { identifier } (the account's email, or its phone number if it has none), or account: null unless the browser is signed in as the interaction's account and the API can describe it. The hosted "Continue to ?" card shows the identifier, and with no account to name it offers only Cancel. If you serve your own pages through uiDir, show account.identifier beside the client name, send { "confirmed": true } only from a real click, and do not offer to continue when account is null.

  • 7858f18: A device client polling an expired device code faster than its interval now gets expired_token, so it stops, rather than slow_down on every poll. The poll throttle only tracks codes that have not expired. With an API that keeps expired device codes readable for a while (seamless-auth-api#542), the token endpoint answers expired_token for them; a code the API does not know still gets invalid_grant.

  • 7858f18: Errors the provider cannot send back to the app now render on the hosted pages, with your branding, instead of the library's default "oops! something went wrong" page. That covers an unknown client_id, an unregistered redirect_uri at /authorize, and a refused /session/end (an unregistered post_logout_redirect_uri, or an id_token_hint that cannot be read). The page shows the error code, the provider's description and a plain explanation, and answers with the hosted pages' CSP and no-store. A server error shows a generic description.

  • 7858f18: The hosted pages meet WCAG 2.2 AA with the default palette and a sound custom one (see docs/accessibility-audit.md).

    • The sign-in screens' mode toggle, error text and hovered button now take this service's palette, and follow hosted_ui branding, instead of fallback colors that fell below 4.5:1.
    • Text field edges are darker (#7a828e light, #8a93a0 dark) so they meet 3:1, which also darkens card borders.
    • Sign-out, device and error pages are titled for what they do rather than "Sign in to ".
    • The device code error is tied to the code field.
    • When the hosted pages render with a hosted_ui palette whose pairs fall below AA contrast, the service logs one warning naming each pair. Nothing is refused.
  • 18b472c: A failure while finishing a login no longer leaves a grant behind, and unexpected errors are answered as JSON. POST /interaction/:uid/login saves the grant before it reads the auth context; when that read failed (the API unreachable, say), the grant stayed and bound the first-party session to the client without a finished sign-in. The edge router also had no error handler, so such failures reached Express's default handler, which answers HTML with a stack trace whenever NODE_ENV is not production. They now answer 500 {"error":"server_error"} (logged by name and message), and a malformed request body answers its 4xx status with {"error":"invalid_request"}.

  • 18b472c: /session/end no longer signs a browser out of the hosted pages when it has no provider sign-in. The library ends an empty provider session without a confirmation page, and the edge used to clear the first-party adapter cookies on that automatic post, so any site that sent a browser to /session/end signed it out. The first-party session and its cookies are now ended only when the provider session had an account and the user confirmed on the hosted page.

  • 18b472c: A first-party native client (application_type: native) no longer gets a code without a click. Any program on the device can listen on a loopback port or claim a private-use scheme, so a signed-in user's browser could otherwise hand a code to it with no interaction (RFC 8252 section 8.6). The hosted pages now show a "Continue to " confirmation for every native client request, after sign-in and on later requests that ride the provider session, and POST /interaction/:uid/consent answers 403 confirmation_required for a native client's prompt unless the body is { "confirmed": true }. A custom hosted UI must send that body from the user's click. Web clients and device-flow approvals are unchanged.

  • 7858f18: A request object that asks for response_mode=form_post now gets its request_not_supported refusal by form post rather than in the query string. Request objects are still not supported. Only response_mode is read from the refused object, without verifying it, and only the value form_post changes anything: the error still goes only to the request's own redirect_uri once it is checked against the client's registered URIs, and no other value from the object is used or shown. This lets the Form Post OP conformance profile pass oidcc-unsigned-request-object-supported-correctly-or-rejected-as-unsupported.

  • 18b472c: The device poll throttle and the resume cookie check now match paths the way the provider's router does. A device client polling /token/ was never told slow_down, because the throttle only recognised the exact path /token; it now follows the provider's own routing, so every spelling the provider accepts is throttled. The check that a resumed authorization is the one the resume cookie names now also covers /authorize/<uid>/ and a differently cased /AUTHORIZE/<uid>.

  • abb4834: Depend on @seamless-auth/types ^0.36.0, which adds the session exchange contract.