Repository navigation
Follow RFC 9597 for CWT Claims in COSE headers - #708
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #708 +/- ##
==========================================
+ Coverage 97.06% 97.07% +0.01%
==========================================
Files 32 32
Lines 3476 3490 +14
==========================================
+ Hits 3374 3388 +14
Misses 102 102 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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>
5cac2f4 to
79453cf
Compare
|
Thanks @achamayou! Verified locally: all tests pass with both cbor2 5.x and 6.x, and pre-commit is clean. No major issues, so I'm merging this. Since the label change is breaking, I plan to release it as v4.0.0. Let me know if that's a problem for CCF. |
Thank you, yes a 4.0.0 makes sense, I agree. It is not at all a problem for CCF, we will update as soon as it's available. |
|
Hi @achamayou, I've released v4.0.0, which includes your RFC 9597 and RFC 9864 updates. Thanks for your contributions! Since it's a major release, I also took the chance to include several changes that are hard to make outside a major version bump, such as dropping Python 3.10. |
|
@dajiaji many thanks for releasing so quickly, and for reviewing and accepting the PRs! I will pick up the update on the CCF side now. |
draft-ietf-cose-cwt-claims-in-headers-06, which python-cwt implements, was published as RFC 9597 (Standards Track, June 2024). This PR proposes bringing the library in line with the final RFC. It was written with the help of AI, but I reviewed all changes and believe them to be correct.Label reassignment (breaking change)
During IETF Last Call, IANA noted that the label requested by draft-06,
13, had already been assigned, so draft-07 moved the request to the next free label,15.kcwt(RFC 9528, EDHOC)COSEHeaders.CWT_CLAIMSchanges from13to15.13is no longer interpreted as CWT Claims, since it now meanskcwt. Previously, a kcwt-shaped (non-map) value under13madeCWT.decode()raise anAttributeError. This PR does not attempt to add RFC 9528 support.13are no longer cross-checked and should be re-issued with15. README and CHANGES call this out.Checks required by RFC 9597 §2
These requirements are the same in draft-06 and the RFC, but were only partly implemented:
==1,1.0andTruediffer; map key order does not matter)ValueErrorAttributeErrorValueErrorThe error message for a protected-header mismatch is unchanged.
no_verify=Truestill skips these checks, and a claim that appears only in the header is still accepted. Headers of individual signers and recipients are not checked.Not included
COSE.decode*. This would be a broader behaviour change.kcwt(13) andkccs(14) from RFC 9528, andtyp(16) from RFC 9596.Docs
decode()checks, and links to the RFC's recommendations.CWT.decodedocstring are updated.Testing
tests/test_cwt.pycover:no_verify;main.cwt/cwt.pyandcwt/enums.py;pre-commit run --all-filespasses;-n -Wpasses;poetry buildsucceeds.