Repository navigation
chore: warn about input that 7.0 rejects - #660
Conversation
Five bug fixes planned for 7.0 turn input that 6.x accepts into an error: a Reference URI with no fragment, a Transform with no Algorithm, an InclusiveNamespaces element outside the exc-c14n namespace, a location.reference that selects a non-element, and isEmptyUri on an element that is not the document element. Print a DeprecationWarning for each, and list them in the README. Behavior is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
…input-7.0-rejects
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #660 +/- ##
==========================================
- Coverage 86.33% 86.30% -0.04%
==========================================
Files 9 9
Lines 1317 1336 +19
Branches 340 344 +4
==========================================
+ Hits 1137 1153 +16
- Misses 102 104 +2
- Partials 78 79 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #594, #620, #622, #629, #633.
Five bug fixes planned for 7.0 each turn input that 6.x accepts into an error. #648 covers the sixth, #647, in #649. Nothing warns about these five, so the first a caller would hear of any of them is 7.0 failing. This adds the warning that has to come first.
Each warning is a
DeprecationWarningprinted once per process. Nothing else changes: every input below is signed or verified exactly as before.ReferencewhoseURIis neither empty nor starts with#, which is resolved as a same-document IDXML_CRYPTO_REFERENCE_URI_WITHOUT_FRAGMENTTransformwith noAlgorithmattribute, which is skippedXML_CRYPTO_TRANSFORM_WITHOUT_ALGORITHMInclusiveNamespaceselement outside the exc-c14n namespace, whosePrefixListis applied, under aTransformor underCanonicalizationMethodXML_CRYPTO_INCLUSIVE_NAMESPACES_NAMESPACElocation.referencethat selects a text node, comment or processing instructionXML_CRYPTO_LOCATION_REFERENCE_NOT_ELEMENTisEmptyUri: trueon a reference whosexpathselects anything but the document elementXML_CRYPTO_EMPTY_URI_NOT_DOCUMENT_ELEMENTThe #633 warning matters most to existing users: xml-crypto 6.3.2 and earlier wrote such an element when signing with
xml-exc-c14n#WithCommentsand a prefix list, so documents signed that way stop verifying in 7.0. The warning says to sign them again.Left out on purpose
addReference()does not validatexpath, so a reference without one fails withXPath parse error#584 (addReference()withoutxpath): that reference already fails in 6.x, withXPath parse errorfromcomputeSignature(). 7.0 only names the error, so there is nothing to warn about.Algorithmverify without weakening consumers' algorithm checks #628 and Fail fast when aSignedXmlinstance is reused #631: what 7.0 will reject isn't decided in either, so there is nothing a warning could name yet.README
A new section under "Upgrading", "Input that 7.0 rejects", lists the five, with the specification text behind the four that follow one. The
location.referencerule is this library's own and not something XMLDSig requires, so that entry cites none.Tests
The warnings have no tests, like the other deprecations. Two tests are new, in
test/input-rejected-in-7.spec.ts, for the two inputs nothing exercised, so that 6.x keeps taking them until 7.0:Referenceloads past aTransformthat has noAlgorithm;Existing tests already cover the other three.
Checks
npm run build && npm test && npm run lintpass (552 tests).URI=""over the document element, and with aPrefixListprint no warning. Each of the five inputs above prints its own warning and no other.🤖 Generated with Claude Code
Summary by CodeRabbit
InclusiveNamespaceselements.