Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 84 additions & 86 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,90 @@ Most production-assurance changes only affect `Config.Assurance =
AssuranceProduction`. A development-assurance setup built on `memstore`
and `keys/ephemeral` needs only the steps not marked *production only*.

## v0.86.0
## v0.85.0

### Codes, refresh tokens and `auth_req_id`s are stored under digests covering the issuer (server, storage)

**Affects:** every server, once, at deploy. Most visibly a server
issuing refresh tokens (`offline_access`). No code changes.

**Why:** the digest an authorization code, a refresh token or a CIBA
`auth_req_id` is stored under (`NewAuthorizationCode.CodeHash`,
`NewRefreshToken.TokenHash`, `NewBackchannelAuthentication.AuthReqIDHash`)
didn't include the server's issuer. Two servers of different issuers
sharing one store found each other's records: the store spent the code
or the CIBA approval (or reported a code reused, revoking what it had
issued) before the server could refuse the record as another issuer's.
So one issuer's client could burn a code or `auth_req_id` the other
issued. Each digest is now taken over the issuer as well, behind a new
domain-separation prefix: a code, refresh token or `auth_req_id`
presented to a server of another issuer is unknown to the store, and
neither found nor consumed.

**What fails:** every value stored before the upgrade is under the old
digest, which the upgraded server no longer computes, so:

- **Every refresh token issued before the upgrade stops working.**
`RefreshAccessToken` answers `invalid_grant` ("refresh_token is
invalid, expired, or already used"), as for a token that never
existed, and `RevokeToken` treats it as unknown too. Clients must get a new one through a new
authorization: the end user signs in (and consents) again. Access
tokens already issued are unaffected and run out their lifetime.
- Authorization codes in flight at deploy (issued, not yet redeemed)
fail once: the exchange answers `invalid_grant` and the client starts
the authorization again. Codes live `Limits.AuthorizationCodeLifetime`
(a minute at most). A pre-upgrade code presented again after the
upgrade is unknown rather than reused, so it no longer revokes the
tokens issued from it; those tokens were issued at most a code
lifetime before the upgrade, and expire as usual.
- CIBA requests in flight at deploy fail once: a poll answers
`invalid_grant` and the client starts a new request.
- Rows a `GrantStore`, `BackchannelAuthenticationStore` or
`GrantRegistry` holds for the old digests are no longer reachable
through the server and expire as usual. `ListGrants` may still list
a pre-upgrade grant until its entry expires, and `RevokeListedGrant`
still revokes it.

**What to change:** nothing in code, and no store migration: `memstore`,
`sqlstore` and any custom store key records by whatever digest the
server hands them. Plan the deploy: expect every refresh-token holder
to re-authorize, and tell client operators (or their users) that a
one-time sign-in is coming. A store shared by servers of different
issuers needs nothing more; each server now sees only its own records.

### A reused code's access token is revoked under an issuer-namespaced key too (server, resource)

**Affects:** a deployment with its own `server.RevocationSink` or
`resource.RevocationChecker` that does more than store and compare keys
exactly, such as one that only accepts keys shaped like a jti or an
opaque token's hex hash, or limits a key's length.

**Why:** the server revoked a reused code's access token under the
token's own key alone (a JWT's `jti`, an opaque token's hex SHA-256).
With servers of different issuers sharing one revocation store, one
issuer's revoked `jti` would refuse another issuer's token with the same
`jti`. The server now also revokes it under that key namespaced by its
issuer: `access-token:`, the issuer's length in bytes, `:`, the issuer,
then the token's key. It still writes the raw key as well, so a resource
server that hasn't been upgraded, or a checker that knows only the raw
form, keeps refusing the token. `resource.Verifier` asks about the
namespaced key (when the resolver reports the token's issuer) and then
the raw one, so a record an older server wrote still refuses the token.
A later release will stop writing and checking the raw key.

**What fails:** nothing for `memstore`, `sqlstore` or any store that
keeps keys as given and compares them exactly; such a store holds one
more record per reused code. A sink that refuses the new key makes a
code reuse's revocation report a failure
(`AuditEventRevokeReusedAuthorizationCode` with
`AuditOutcomeFailure`), though the raw key is still written.

**What to change:** make a custom sink accept any key (an opaque
token's namespaced key runs about 30 bytes longer than the
`code-grant:` keys it already stores for the same issuer), and a custom
checker answer the namespaced key from what the sink stored, as it
answers every other key. Don't rely on the raw key alone: it will be
dropped.

### A `one_of` on an omitted `authorization_details_types` bounds the types registered (federation)

Expand Down Expand Up @@ -119,91 +202,6 @@ or signer, under every verb and in `log/slog`.

**What to change:** nothing, unless a test matched the old output.

## v0.85.0

### Codes, refresh tokens and `auth_req_id`s are stored under digests covering the issuer (server, storage)

**Affects:** every server, once, at deploy. Most visibly a server
issuing refresh tokens (`offline_access`). No code changes.

**Why:** the digest an authorization code, a refresh token or a CIBA
`auth_req_id` is stored under (`NewAuthorizationCode.CodeHash`,
`NewRefreshToken.TokenHash`, `NewBackchannelAuthentication.AuthReqIDHash`)
didn't include the server's issuer. Two servers of different issuers
sharing one store found each other's records: the store spent the code
or the CIBA approval (or reported a code reused, revoking what it had
issued) before the server could refuse the record as another issuer's.
So one issuer's client could burn a code or `auth_req_id` the other
issued. Each digest is now taken over the issuer as well, behind a new
domain-separation prefix: a code, refresh token or `auth_req_id`
presented to a server of another issuer is unknown to the store, and
neither found nor consumed.

**What fails:** every value stored before the upgrade is under the old
digest, which the upgraded server no longer computes, so:

- **Every refresh token issued before the upgrade stops working.**
`RefreshAccessToken` answers `invalid_grant` ("refresh_token is
invalid, expired, or already used"), as for a token that never
existed, and `RevokeToken` treats it as unknown too. Clients must get a new one through a new
authorization: the end user signs in (and consents) again. Access
tokens already issued are unaffected and run out their lifetime.
- Authorization codes in flight at deploy (issued, not yet redeemed)
fail once: the exchange answers `invalid_grant` and the client starts
the authorization again. Codes live `Limits.AuthorizationCodeLifetime`
(a minute at most). A pre-upgrade code presented again after the
upgrade is unknown rather than reused, so it no longer revokes the
tokens issued from it; those tokens were issued at most a code
lifetime before the upgrade, and expire as usual.
- CIBA requests in flight at deploy fail once: a poll answers
`invalid_grant` and the client starts a new request.
- Rows a `GrantStore`, `BackchannelAuthenticationStore` or
`GrantRegistry` holds for the old digests are no longer reachable
through the server and expire as usual. `ListGrants` may still list
a pre-upgrade grant until its entry expires, and `RevokeListedGrant`
still revokes it.

**What to change:** nothing in code, and no store migration: `memstore`,
`sqlstore` and any custom store key records by whatever digest the
server hands them. Plan the deploy: expect every refresh-token holder
to re-authorize, and tell client operators (or their users) that a
one-time sign-in is coming. A store shared by servers of different
issuers needs nothing more; each server now sees only its own records.

### A reused code's access token is revoked under an issuer-namespaced key too (server, resource)

**Affects:** a deployment with its own `server.RevocationSink` or
`resource.RevocationChecker` that does more than store and compare keys
exactly, such as one that only accepts keys shaped like a jti or an
opaque token's hex hash, or limits a key's length.

**Why:** the server revoked a reused code's access token under the
token's own key alone (a JWT's `jti`, an opaque token's hex SHA-256).
With servers of different issuers sharing one revocation store, one
issuer's revoked `jti` would refuse another issuer's token with the same
`jti`. The server now also revokes it under that key namespaced by its
issuer: `access-token:`, the issuer's length in bytes, `:`, the issuer,
then the token's key. It still writes the raw key as well, so a resource
server that hasn't been upgraded, or a checker that knows only the raw
form, keeps refusing the token. `resource.Verifier` asks about the
namespaced key (when the resolver reports the token's issuer) and then
the raw one, so a record an older server wrote still refuses the token.
A later release will stop writing and checking the raw key.

**What fails:** nothing for `memstore`, `sqlstore` or any store that
keeps keys as given and compares them exactly; such a store holds one
more record per reused code. A sink that refuses the new key makes a
code reuse's revocation report a failure
(`AuditEventRevokeReusedAuthorizationCode` with
`AuditOutcomeFailure`), though the raw key is still written.

**What to change:** make a custom sink accept any key (an opaque
token's namespaced key runs about 30 bytes longer than the
`code-grant:` keys it already stores for the same issuer), and a custom
checker answer the namespaced key from what the sink stored, as it
answers every other key. Don't rely on the raw key alone: it will be
dropped.

## v0.84.0

### A JWT access token's `client_sub` claim no longer sets `ClientSubject` (resource)
Expand Down
Loading