Skip to content

fix(breg): admit the RFC 9068 typ pair as one token type - #983

Open
jeremi wants to merge 1 commit into
mainfrom
fix/oidc-typ-rfc9068-pair
Open

fix(breg): admit the RFC 9068 typ pair as one token type#983
jeremi wants to merge 1 commit into
mainfrom
fix/oidc-typ-rfc9068-pair

Conversation

@jeremi

@jeremi jeremi commented Sep 10, 2026

Copy link
Copy Markdown
Member

What

The access-token verifier profile pinned exactly one typ header value. RFC 9068 lets an issuer emit either at+jwt or application/at+jwt for the same access-token media type and requires resource servers to accept both (RFC 9068 §4), so an operator pinned to one string rejected a compliant issuer that used the other spelling — the difference surfaced only as a generic token refusal after switching providers.

registry-platform-oidc gains two public helpers:

  • access_token_typ_set(configured) — the allowed_typ list a single configured type admits: the pair for either spelling of the access-token media type, the value itself for anything else.
  • is_access_token_typ_pair(values) — recognises the one two-element shape that still names a single token type.

BREG builds its verifier profile through the expansion (OidcVerifierConfig::token_verifier_config) and its profile validation (admits_one_access_token_type) accepts a single valid value or exactly the RFC 9068 pair, refusing every other shape. Relay, Mint and Evidence profiles are unchanged.

Verification

  • cargo test --locked -p registry-platform-oidc — 52 passed, including two new unit tests for the expansion and the pair predicate (order, casing, single, duplicate, triple, mixed shapes).
  • cargo test --locked -p registry-breg --features runtime --test http_auth — 25 passed. New: a token with typ: at+jwt and the same token with typ: application/at+jwt are both accepted under one configuration (for either configured spelling), while typ: JWT under that configuration and the platform TokenTypeNotAllowed refusal are asserted. Extended: the constructor now also refuses a blank single value and the pair plus an extra value, next to the existing two-semantics refusal.
  • cargo test --locked -p registry-breg --features runtime,tooling --test startup_http — 8 passed; issuer_portability unchanged (1 pre-existing ignore).
  • cargo clippy --locked -p registry-platform-oidc -p registry-breg --all-targets ... clean under default, runtime, runtime,tooling and schema feature sets; cargo fmt --check clean.

Docs

  • docs/operate/breg: the token-verification table now states that either RFC 9068 spelling is accepted when accessTokenType names the access-token media type.
  • Changelog entry under Unreleased.

Closes #981.

The verifier profile pinned exactly one typ string, so an issuer
emitting the other RFC 9068 spelling of the same access-token media
type was refused until an operator edited accessTokenType - a config
tripwire, not a semantic choice. RFC 9068 section 4 requires resource
servers to accept both at+jwt and application/at+jwt and reject every
other value.

registry-platform-oidc gains access_token_typ_set(), which expands a
configured type to its admitted spellings, and
is_access_token_typ_pair(), which recognises the one two-element
allowed_typ shape that still names a single token type. BREG builds
its profile through the expansion and validates the pair shape instead
of requiring exactly one element, so JWT next to at+jwt is still
refused while either spelling of the media type is accepted under one
configuration. Relay, Mint and Evidence profiles are unchanged.

Closes #981.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-10T18:30:59.532010Z 813489b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 813489bef7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1946 to +1949
/// The one admitted access-token `typ` semantics. Configuring the
/// RFC 9068 access-token media type as `at+jwt` or
/// `application/at+jwt` admits both spellings of that one type; any
/// other value (for example `JWT`) admits only that exact value.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Regenerate the runtime schema after changing its description

With the schema feature enabled, schemars copies this new field documentation into the generated accessTokenType.description, but products/breg/generated/runtime/runtime.schema.json still has no such description. Consequently, committed_runtime_schema_matches_generated_bytes and products/breg/scripts/check-generated.sh will deterministically fail; regenerate and commit the runtime schema with this change.

AGENTS.md reference: AGENTS.md:L384-L387

Useful? React with 👍 / 👎.

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.

OIDC verifier profile should accept the RFC 9068 at+jwt typ pair

1 participant