T13.10: DPoP for the Okta Management API calls, auto-detected (D24)
This commit is contained in:
@@ -61,3 +61,36 @@ code is a short lower-case word.
|
||||
|
||||
**Not decided here:** how often the key is replaced. A key is registered on the Okta
|
||||
app and has no expiry that this code checks.
|
||||
|
||||
## D24: DPoP for the Okta Management API calls
|
||||
|
||||
**Asked by:** Matt Mabrey, 2026-10-16. **Extends:** D23. **Task:** T13.10.
|
||||
|
||||
**Why:** The first live token request with the service-app key ended with
|
||||
`error invalid_dpop_proof`. The Okta app requires DPoP (RFC 9449). With DPoP, every
|
||||
request carries a signed proof from a key that only the caller holds, so a stolen
|
||||
access token alone does not work. The choice was to ask the Okta admin to switch DPoP
|
||||
off, or to build it. Matt chose to build it.
|
||||
|
||||
**Decision:**
|
||||
|
||||
- `OKTA_SYNC_DPOP` is `auto` (default), `on` or `off`. In auto mode the sync asks for a
|
||||
plain Bearer token first. If Okta answers `invalid_dpop_proof`, the sync asks again with
|
||||
DPoP. So one build works whether the Okta app requires DPoP or not.
|
||||
- Each run makes its own throwaway EC P-256 key. It is held in memory only, never
|
||||
stored, logged or configured. The public half goes in each proof header.
|
||||
- Each request gets its own proof (ES256, `typ` dpop+jwt): `htm`, `htu` without the
|
||||
query, a one-time `jti`, `iat`, the server's latest `nonce`, and on an API call `ath`
|
||||
(a hash of the access token). The same key is used for the token request and the API
|
||||
calls. A new client assertion is built for every token attempt.
|
||||
- A nonce challenge is answered once per request, at the token endpoint and at the API.
|
||||
The token request is tried at most 4 times.
|
||||
- A DPoP-bound token is sent as `Authorization: DPoP <token>`. If the setting is `off`
|
||||
and Okta returns a DPoP-bound token, the sync stops with a clear message.
|
||||
|
||||
**Rules from D18 and D23 that stay:** fail closed; the key, the assertions, the proofs and
|
||||
the access token are never logged or put in an error message; an error carries the HTTP
|
||||
status and Okta's short error code only. The SSWS token path is unchanged.
|
||||
|
||||
**Not verified:** this has been tested only against a fake Okta that follows the RFC. The
|
||||
first run against the real tenant is the real test.
|
||||
|
||||
@@ -405,3 +405,20 @@ with a brace, but Python's strict JSON reader refused them (PowerShell accepted
|
||||
The loader now accepts control characters such as line breaks inside a string, curly quote marks and
|
||||
a trailing comma, removes spaces inside the key's number fields, and a real syntax error reports the
|
||||
line and column (position and rule only, never key text).
|
||||
|
||||
## T13.10: D24 DPoP for the Okta Management API
|
||||
|
||||
**Item:** D24 (`docs/waves/decisions-2026-10-16.md`). Extends T13.9.
|
||||
|
||||
**Done when:**
|
||||
|
||||
- [x] auto mode: a plain Bearer token is tried first; `invalid_dpop_proof` makes the sync retry with DPoP (`tests/okta_sync_dpop_check.py`)
|
||||
- [x] each proof verifies: header (`dpop+jwt`, ES256, public jwk only), signature, `htm`, `htu` without query, current `iat`, one-time `jti`, `ath` on API calls, same key for token and API calls
|
||||
- [x] nonce challenges at the token endpoint and at the API are answered once, and the retries are bounded
|
||||
- [x] paging: a new proof for every page
|
||||
- [x] mode `on` and mode `off`; a DPoP-bound token with mode off is refused; each run makes a new key
|
||||
- [x] no secret in any message or the startup line; the SSWS path is unchanged
|
||||
- [x] mutation checks: query kept in `htu`, `ath` omitted, `jti` reused, nonce not retried (token and API), private key in the proof header, and auto detection removed each make a test fail
|
||||
- [x] `.env.example`, `docker-compose.yml`, `DEPLOYMENT.md` updated
|
||||
|
||||
Result 2026-10-16: sandbox, strict fake Okta. Not yet run against the real tenant.
|
||||
|
||||
Reference in New Issue
Block a user