Repository navigation
fix: include document PIs in empty-URI XML signatures - #645
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughCanonicalization now processes document nodes and their canonical children. For empty-URI references with document-level processing instructions, ChangesDocument-level processing instruction handling
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant SignedXml
participant Utils
participant Canonicalizer
SignedXml->>Utils: Check for a document-level processing instruction
Utils-->>SignedXml: Return whether a non-XML instruction exists
SignedXml->>Canonicalizer: Pass the Document for an affected empty-URI reference
Canonicalizer->>Utils: Check which document children to canonicalize
Canonicalizer-->>SignedXml: Return canonicalized document content
Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue was identified in the document-level processing-instruction change. It is ready for normal merge checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change strengthens signature coverage for document-level processing instructions. The main remaining risk is compatibility: existing signatures containing these instructions and custom transforms that assume an element may require coordinated upgrades. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #645 +/- ##
==========================================
+ Coverage 85.20% 86.36% +1.15%
==========================================
Files 9 9
Lines 1244 1283 +39
Branches 319 335 +16
==========================================
+ Hits 1060 1108 +48
+ Misses 111 100 -11
- Partials 73 75 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
xmldom parses the XML declaration as a processing-instruction node, which is why isCanonicalDocumentChild has to filter it by target. The shortened comment only said that Canonical XML excludes the declaration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Security impact
An empty-URI signature could verify after a document-level
xml-stylesheetinstruction was changed, because verification previously dereferenced only the document element. This issue remains at the merged head of #642 and is fixed here using library code only.Regression and validation
The public-API regression test signs a document with a stylesheet instruction using the repository's test key, then changes only its stylesheet URL. Before the fix, the original signature verified and the tampered document also verified (
expected true to be false). After the fix, tampering fails verification for both tested transform orders. Added-PI tampering also fails. All four canonicalizers match the C14N section 3.1 example.npm run buildnpm test -- --reporter dot --no-colors(550 passing)npm run lintgit diff --checkSummary by CodeRabbit