Repository navigation
Conversation
draft-ietf-cose-cwt-claims-in-headers-06 is now RFC 9597. IANA assigned label 15 to the CWT Claims header parameter; the draft's requested label 13 went to kcwt (RFC 9528). COSEHeaders.CWT_CLAIMS is now 15 and 13 is no longer interpreted as CWT Claims. CWT.decode() now checks the CWT Claims header parameter in both the protected and unprotected headers of every COSE layer of a nested CWT, not only the protected header of the innermost layer. Header and payload claim values must be identical CBOR data items. A parameter that is not a map, or that occurs in both the protected and unprotected header, is rejected with ValueError. Update README and CHANGES accordingly. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
achamayou
force-pushed
the
achamayou-rfc9597-cwt-claims-plan
branch
from
November 8, 2026 16:31
5a9d178 to
5cac2f4
Compare
Owner
Author
|
Superseded by dajiaji#708. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
draft-ietf-cose-cwt-claims-in-headers-06, which this library implements, was published as RFC 9597 (Standards Track, June 2024). This PR brings the library into compliance with the final RFC.Label reassignment (breaking change)
COSE_MessagesCOSEHeaders.CWT_CLAIMSchanges from13to15.13is no longer read as CWT Claims. Interpreting it that way would be wrong now that it means kcwt. Before this change,CWT.decode()raised an uncaughtAttributeErrorwhen label 13 held a kcwt-shaped (non-map) value.13are no longer cross-checked and should be re-issued with15. The README and CHANGES document this.Fixes for requirements already in the draft
The normative MUSTs are the same in draft-06 and RFC 9597, but the implementation only partly followed them:
Encrypt0(MAC0/Sign1(claims))with claims in the outer header is the RFC's main use caseValueErrorAttributeErroron non-mapValueErrorThe error message for a protected-header mismatch is unchanged.
no_verify=Truestill skips all claim checks. A claim that appears only in the header, not in the payload, is still accepted.Deliberately out of scope
COSE.decode*(RFC 9052 §3). This is a broader behaviour change.typ(16),kcwt(13) andkccs(14) support. The README mentions usingtypthrough its integer label, as RFC 9597 recommends.1,1.0andTrueare not identical (map key order does not matter).Docs
decode()checks, and add the RFC's recommendations: put the parameter in the protected header, header claims are not encrypted, don't act on headers before verification, detached payloads, andtyp. It also notes that the parameter can be used with any COSE message.CWT.decodedocstring are updated.Testing
New tests cover: label 15 on the wire; label 13 ignored (kcwt-shaped and legacy draft values); unprotected match and mismatch; duplicate across buckets; non-map values in both buckets; claims absent from the payload; structured values (
audlist,cnfmap);no_verify; nested outer/inner layers; and strict CBOR comparison (1, 1.0 and True differ; map key order does not matter).Checked against the old code: 17 of the new tests fail there, and the positive cases pass.
Full suite: 1531 passed.
black, isort, flake8 and blacken-docs (versions from
.pre-commit-config.yaml) pass. mypy reports the same 12 errors as before this change, none in the files touched here.Headers of individual signers (
COSE_Signature) and recipients are not checked; RFC 9597's identical-values rule is about the header of the CWT.