Skip to content

test(security): cover historical XML attacks - #263

Merged
polaz merged 1 commit into
mainfrom
test/#262-historical-security-corpus
Oct 21, 2026
Merged

polaz merged 1 commit into
mainfrom
test/#262-historical-security-corpus

Conversation

@polaz

@polaz polaz commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add an offline public-API regression corpus for historical XML security attack classes, with genuine positive controls and explicit secure/compatibility boundaries.
  • Document primary sources, protected invariants and expected refusal outcomes.
  • Gate DSig-dependent SPKI tests out of C14N-only builds.

Testing

Local MSRV workspace build, default/all-feature tests with SoftHSM, XSLT/all-backend tests, Clippy, formatting and doctests pass on macOS. Alloc-only host/thumb, shared PKIX thumb/WASM, real WASM C14N, and C14N-only all-target checks pass.

Closes #262

Summary by CodeRabbit

  • Security
    • Added coverage for historical XML security threats, including signature wrapping, duplicate IDs, entity expansion, unsafe external resources, and cryptographic attack patterns.
    • Added checks that enforce rejection policies, resource limits, secure URI handling, and pre-decryption protections.
  • Tests
    • Added deterministic regression tests across supported XML backends.
    • Added compatibility checks for valid security-sensitive behavior.
  • Documentation
    • Documented security invariants, test coverage, execution guidance, and compatibility boundaries.

Exercise public security boundaries with synthetic attack-class inputs, genuine positive controls and explicit compatibility policy. Document sources and outcomes, and gate DSig-only SPKI tests in C14N-only builds.

Closes #262
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T19:16:24.977340Z 338c8b7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: structured-world/xml-sec/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 34e39d0c-ef22-4630-9ee0-9f0d8b48988f
📥 Commits

Reviewing files that changed from the base of the PR and between a5f5f10 and 338c8b7.

📒 Files selected for processing: 4
  • docs/historical-security.md
  • docs/security-invariants.md
  • tests/historical_security.rs
  • tests/spki_key_structure.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

This change adds deterministic historical XML security regression tests for signatures, resource handling, parsing, XSLT, and XML encryption. It also documents the corpus and limits the SPKI key-structure test module to builds with the xmldsig feature.

Changes: Historical XML Security Tests

Layer / File(s) Summary
Signature and key validation
docs/historical-security.md, docs/security-invariants.md, tests/historical_security.rs, tests/spki_key_structure.rs
The documentation describes the regression corpus and its invariants. Tests cover signature wrapping, SAML assertion relocation, duplicate IDs, HMAC truncation, recursive RetrievalMethod handling, and RSA key bounds. The SPKI test module is gated on the xmldsig feature.
Resource and parser rejection
tests/historical_security.rs
Tests check rejection of disallowed reference and retrieval URIs before resource acquisition, and rejection of entity amplification and external entity declarations during parsing.
XSLT resource limits
tests/historical_security.rs
Feature-gated tests cover compatibility behavior, modern-policy rejection, workload limits, and preservation of pre-digest data.
XML encryption policy
tests/historical_security.rs
Feature-gated tests cover AES-GCM, compatibility AES-CBC, and CBC downgrade and padding cases rejected before requesting a decryption key.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 338c8

This PR adds offline security regression tests and documentation and limits one test file to builds with the xmldsig feature. It does not change runtime behavior. No merge-blocking issue was found.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 2 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding security tests for historical XML attacks.
Linked Issues check Passed Issue #262 is addressed by the new tests/historical_security.rs public-API corpus. The corpus covers wrapping and duplicate IDs, HMAC truncation, RetrievalMethod loops, external resources, entity …
Out of Scope Changes check Passed The changes stay within issue #262. The documentation records corpus scope and security invariants. The new tests provide the required regression cases and controls. The SPKI test feature gate prevent…
Full details: Linked Issues check

Explanation

Issue #262 is addressed by the new tests/historical_security.rs public-API corpus. The corpus covers wrapping and duplicate IDs, HMAC truncation, RetrievalMethod loops, external resources, entity and XSLT amplification, RSA bounds, and encryption downgrade or padding probes. docs/historical-security.md records a source, invariant, expected result, and positive control for each class. The tests exercise Modern, SecureSaml, and explicit compatibility policies, and the test module is gated on xmldsig and c14n. The documented commands and the PR test report cover backend, feature, lint, MSRV, and alloc-only validation. tests/spki_key_structure.rs is now gated on xmldsig, which supports C14N-only builds.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #262. The documentation records corpus scope and security invariants. The new tests provide the required regression cases and controls. The SPKI test feature gate prevents an unrelated compile failure in C14N-only builds and supports the requested feature validation. No production policy surface or cryptographic implementation is added.

Full details: Docstring Coverage

Explanation

Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 2 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@polaz
polaz merged commit 873516d into main Oct 21, 2026
60 checks passed
@polaz
polaz deleted the test/#262-historical-security-corpus branch October 21, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(security): cover historical XML attack classes

1 participant