Repository navigation
Description
Summary
Add open Dynamic Client Registration to the AS as an option a Data Custodian switches on: a Third Party registers at POST /oauth2/register without an initial access token, and its client stays pending review until the DC approves it. This is the portal process most DCs use today (anyone applies; the DC investigates before the registration is complete), carried out with RFC 7591.
Decision (owner, 2026-11-30; recorded on #252):
- Registration mode is a setting,
token | open. The default istoken: the single-useclient.createinitial access token from the DC operator (espi_registrar), as today. Registration access token: issue it on RFC 7591 registration, renew via FB=36_40, and require it for ApplicationInformation #251 and Third Party: register itself via RFC 7591 dynamic client registration and manage its registration #252 are built in token mode first. openis opt-in per deployment.localmay use it, to make manual testing easy. Production profiles keeptokenunless the DC's policy choosesopen.- This issue follows Registration access token: issue it on RFC 7591 registration, renew via FB=36_40, and require it for ApplicationInformation #251 and Third Party: register itself via RFC 7591 dynamic client registration and manage its registration #252.
Why open mode is not the default
Without an initial access token, /oauth2/register becomes an anonymous write endpoint. Spring Security keeps open registration off by default for the same reason (OAuth2ClientRegistrationAuthenticationProvider.setOpenRegistrationAllowed, default false; RFC 7591 §3 leaves the choice to the server). The risks are:
- scripted mass registration that fills the client table;
- clients registered with a convincing
client_nameorlogo_uri, shown to customers on the consent screen; - redirect URIs that point at an attacker's site.
Every one of these must be closed before open can be used outside local.
Scope
- Setting:
espi.authserver.registration.mode: token | open, defaulttoken. Inopenmode,clientRegistrationSecurityFilterChainaccepts a request without a bearer token and the provider runs withsetOpenRegistrationAllowed(true). A request that does carry aclient.createtoken is still accepted. Startup logs the mode in force. - A dedicated
pending_reviewstatus. Do not reusesuspended, which means an approved client was stopped; mixing the two muddles the audit log, the reporting views (AS PostgreSQL reporting views count a client on a timed suspension or lock as active #355) and the admin's view.- A client registered in
openmode is storedpending_review. A client registered with an initial access token isactive, as today. - Enforcement already fails closed: under the AS: suspending or revoking a client has no effect: client_status is never checked at the token, authorization or introspection endpoints #345 rule, any stored status other than
activeorsuspendedis in force asrevoked, so a pending client gets no token, no authorization (no consent screen) and no active introspection. Namepending_reviewexplicitly inClientStatusService, keep it in force as not active, and test it on every endpoint AS: suspending or revoking a client has no effect: client_status is never checked at the token, authorization or introspection endpoints #345 covers. - Migrations on H2, MySQL and PostgreSQL. PostgreSQL's
client_statusis an enum (see fix(authserver): client management create, update and list filters fail on PostgreSQL's enum columns; H2 create writes missing columns #351).
- A client registered in
- Approval and rejection through the admin status API (fix(authserver): client management API: list always 500, status without reason 500s after applying, bulk logs raw ids, null scope saved; fix or retire the controller #344 PR 3):
pending_review→activeorrevoked, each audited with the administrator and a reason. Pending clients are listed and filterable. - Abuse limits on
/oauth2/registerinopenmode:- a maximum request size;
- a per-IP rate limit. Spring has none built in: use a library (e.g. Bucket4j) or document the reverse proxy or WAF limit a deployment must set;
- a cap on the number of pending clients, beyond which registration answers RFC 7591
invalid_client_metadataor 503 (to decide); - the shared metadata validator from fix(authserver): client management API: list always 500, status without reason 500s after applying, bulk logs raw ids, null scope saved; fix or retire the controller #344 PR 3:
httpsredirect URIs only (HTTPS with TLS 1.3 only on every AS, DC and TP interface (inbound and outbound) before deployment #298), ESPI scopes only, no admin scopes requested.
- Purge of clients still
pending_reviewafter a set period (configurable, e.g. 30 days), audited. It must not touch any other status. - Notifying the Third Party. RFC 7591 has no "pending" response: the registration answers 201 with
client_idand secret, and the token endpoint answersinvalid_clientuntil approval, which a TP cannot tell from wrong credentials (RFC 6749 keeps that error vague on purpose). So:- the DC notifies the TP of approval or rejection out of band, through the registration's
contacts; - the TP (Third Party: register itself via RFC 7591 dynamic client registration and manage its registration #252) shows "pending review" until its client_credentials request (
FB=34_35) succeeds; - the AS and TP docs describe this.
- the DC notifies the TP of approval or rejection out of band, through the registration's
- Docs: the two modes, the default, what a DC must configure before turning on
open(rate limit, purge period, pending cap), and the review process. - Tests:
tokenmode: a registration without a token is 401, as today;openmode: a registration without a token is 201 and storedpending_review; with aclient.createtoken it isactive;- a pending client is refused at
/oauth2/token,/oauth2/authorizeand introspection; after approval it works; after rejection it stays refused; - the rate limit, the size limit and the pending cap;
- the purge removes only expired pending clients;
- the setting defaults to
token, and the production profiles do not setopen.
Dependencies
- Registration access token: issue it on RFC 7591 registration, renew via FB=36_40, and require it for ApplicationInformation #251 (registration access token,
FB=36_40) and Third Party: register itself via RFC 7591 dynamic client registration and manage its registration #252 (TP registration) in token mode first. - fix(authserver): client management API: list always 500, status without reason 500s after applying, bulk logs raw ids, null scope saved; fix or retire the controller #344 PR 3 (one admin API and the shared registration validator), AS: suspending or revoking a client has no effect: client_status is never checked at the token, authorization or introspection endpoints #345 (status enforcement, done in PR fix(authserver): a suspended, revoked or locked client gets no token, authorization or active introspection (#345) #350), fix(authserver): client management create, update and list filters fail on PostgreSQL's enum columns; H2 create writes missing columns #351 (PostgreSQL enum binding).
- HTTPS with TLS 1.3 only on every AS, DC and TP interface (inbound and outbound) before deployment #298 (HTTPS with TLS 1.3 only) before
openis used outsidelocal.
🤖 Generated with Claude Code
Activity