Skip to content

PPT-2536: introspection + OIDC id_token specs (IR-01/02/07, OI-01/02/03/07) - #17

Merged
camreeves merged 1 commit into
masterfrom
PPT-2536-p1-introspect-oidc
Jul 31, 2026
Merged

PPT-2536: introspection + OIDC id_token specs (IR-01/02/07, OI-01/02/03/07)#17
camreeves merged 1 commit into
masterfrom
PPT-2536-p1-introspect-oidc

Conversation

@camreeves

Copy link
Copy Markdown
Contributor

P1 coverage for introspection/revocation and OIDC id_token. Test-only.

IR-02 — the introspection bypass is ABSENT from current code. It was real (authenticate_introspection_caller returned "" for bearer callers and the guard short-circuited on the empty string, letting any bearer holder read any token's active/client_id/scope/exp) and was fixed in 67114b2. The new spec pins it from the attacker's side: exact 401 + invalid_token, none of the four disclosed fields present, and the victim app's own successful introspection run in the same example as a positive control so the 401 cannot pass vacuously.

OI-03 — no defect. Both Authly.jwt_decode and UserJWT.decode pin RS256 explicitly. Verified by forging alg=none and RS256→HS256 (keyed on the published public key) variants of a live token and asserting rejection at four surfaces, with the genuine token accepted at the same four.

IR-03 was already fully covered in token_meta_spec.cr (lines 99, 142, 157, 175) — reported, not duplicated. The matrix's ◐ should be ✅.

Defects pinned as pending, not silently skipped

  • IR-07 — a revoked refresh token is still redeemable. validate_code! never consults the token store and the refresh jti is never persisted, so POST /auth/revoke and logout do not end a session; the token keeps minting access tokens for 30 days. Doorkeeper had no such gap. Naive enforcement would break RF-05 (P0 double-submit tolerance), so it needs the refresh jti linked to the access-token row.
  • OI-02 — id_token carries no exp/iat, both REQUIRED by OIDC Core §2. Interop only; nothing in PlaceOS consumes the id_token.

201 examples, 0 failures, 4 pending — green on crystal latest and unstable.

🤖 Generated with Claude Code

Implements PPT-2536 test-matrix rows IR-01, IR-02, IR-07 and OI-01, OI-02,
OI-03 plus the issuer half of OI-07. 26 examples, 3 pending.

IR-02 is the security regression test for the empty-client-id introspection
bypass fixed in 67114b2: before that commit
`authenticate_introspection_caller` handed back an empty string as the caller's
client id and the cross-client guard skipped itself, so any holder of any valid
access token could read back another application's token state, client_id,
scope and exp. The new example asserts the exact rejection (401 /
`invalid_token`), asserts the rejection body carries none of those four fields
and never contains the victim's client id, and runs the owner's successful
introspection in the same example as a positive control so the 401 cannot pass
vacuously. Companion examples cover the two literal empty-identity shapes
(`client_id=` in the body, HTTP Basic with an empty user part).

IR-01 enumerates the three caller-authentication failures Doorkeeper
distinguished - no credentials -> 400 invalid_request, bad client -> 401
invalid_client, bad bearer -> 401 invalid_token - with the WWW-Authenticate and
Cache-Control headers each carries. IR-03 was already fully covered by
token_meta_spec.cr and is not duplicated.

OI-01/OI-02 assert claim *values*, not presence: `iss` is exactly the legacy
POS issuer, `aud` is exactly the requesting client_id, and `sub` is the
resource owner's user id and provably not the jti, the client id or the
audience - the invariant the Code#jwt and Grant#generate_id_token adapter
patches exist to preserve. The same subject is asserted across the id_token,
the access token and userinfo. OI-03 forges alg=none and RS256-as-HS256
(keyed on the published public key) variants of a live access token and
asserts every JWT-consuming surface rejects them, with the genuine token
accepted at those same surfaces as the control.

Two known gaps are recorded as pending rather than asserted as correct:
revocation does not cascade between an access token and its refresh token in
either direction (IR-07), and the id_token carries no exp/iat (OI-02).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@camreeves
camreeves merged commit 8af4ba3 into master Jul 31, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant