Urgent.News

What's breaking now, across hundreds of outlets.

Tech

CBOR Web Tokens: make cnf validation a proof test, not a claim lookup

CBOR Web Tokens: make cnf validation a proof test, not a claim lookup A confirmation claim can look deceptively simple. The issuer places a cnf key in a CBOR Web Token (CWT), and the receiver is supposed to know that the presenter has a particular key. RFC 8747 defines this proof-of-possession pattern for CWTs, while RFC 8392 defines the base token format. Parsing both specifications correctly is…

CBOR Web Tokens necessitate treating confirmation claim validation as a rigorous test rather than a mere claim lookup. The issuer embeds a cnf key within a CBOR Web Token, and the recipient must confirm the presenter holds the corresponding key. However, parsing the relevant RFCs alone is insufficient for comprehensive enforcement. The recipient must authenticate the CWT signature, issuer, audience, expiration, intended use, and subsequently process the cnf as a CBOR map adhering to the expected member types.

The confirmation method dictates the subsequent actions, which must not rely solely on a bare key identifier to verify possession. The recipient should require a fresh proof, such as a signed request or challenge, tied to the ongoing transaction. Parsing the map's key types with caution is crucial, as two encodings yielding similar values may not represent identical wire formats. Mature COSE libraries should be employed, with unexpected confirmation members rejected, and a strict type and length policy enforced.

Audience binding is equally important, as a presenter may possess a legitimate key for one service but attempt to utilize it at another. The verifier must bind the proof to its own origin, method, path, and request body, where permitted. Employing signatures over generic bodies without specifying a service audience can lead to token replay at different endpoints.

Freshness controls, like nonce, timestamp, or a server-issued challenge, should remain separate from the CWT's expiration time. Following cryptographic success, a potential second failure mode arises: application developers may inadvertently extract permissions from the sub claim without realizing the presenter is now utilizing a distinct confirmation key.

The optimal approach is to derive the authorization subject from both the validated token and the validated presenter proof. If key rotation is underway, only keys belonging to the token issuer's current policy should be accepted, and the used key should be documented.

Operational checks should extend beyond the ideal scenario, encompassing scenarios such as tokens with missing cnf, incorrect CBOR types, proofs signed by disparate keys, and valid proofs replayed to alternative audiences. Logs must be inspected to verify that the raw CWT and proof are not fully logged. Metrics ought to monitor proof failures by reason but refrain from exposing key identifiers to broad log consumers.

The implementation record must specify the supported confirmation methods, accepted proof formats, clock skew handling, and nonce replay policies. Ultimately, the security decision resides with the service that comprehends the key's authorized proof, and this decision should be explicit in the implementation record.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Show DEV: An Open 20-Asset Prompt Planner & Validation Toolkit for MAGI-2 Video Generation

I wanted to be able to reopen a video job and see exactly which picture defined a character, which clip supplied a camera move, and when a sound was supposed to land.

  • Hugging Face Prompt Studio is a static browser planner for video generation
  • Planner supports 20 references across images, videos, and audio
  • Validator checks for malformed input, budget overruns, and type validity

More from Friday 27 November →