test(xmlenc): add Phaos decrypt vectors#99
Conversation
- import the complete independent Phaos XML Encryption corpus - verify supported OAEP and AES-KW document decryption paths - classify legacy algorithms and key agreement as fail-closed Closes #98
|
| Filename | Overview |
|---|---|
| scripts/import-donor-fixtures.sh | Adds path validation, complete snapshot staging, atomic target replacement, and restoration on replacement failure. |
| tests/import_donor_fixtures.rs | Covers stale-file removal, path rejection, import failures, trailing separators, and directory-to-file transitions. |
| src/xmlenc/parse.rs | Reports unsupported agreement methods without discarding supported key candidates. |
| tests/xmlenc_donor_integration.rs | Adds end-to-end decryption and fail-closed classification for the Phaos vectors. |
Reviews (6): Last reviewed commit: "test(fixtures): gate importer suite on U..." | Re-trigger Greptile
|
Warning Review limit reached
Next review available in: 18 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change vendors the Phaos XML Encryption corpus, hardens directory-based fixture importing, explicitly handles unsupported ChangesPhaos XML Encryption coverage
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant PhaosTest
participant decrypt_document
participant XmlEncParser
participant KeyResolver
participant PhaosFixture
PhaosTest->>PhaosFixture: load encrypted XML and key material
PhaosTest->>decrypt_document: decrypt document
decrypt_document->>XmlEncParser: parse EncryptedData and KeyInfo
XmlEncParser->>KeyResolver: resolve encryption key
KeyResolver-->>decrypt_document: resolved key or classified failure
decrypt_document-->>PhaosTest: plaintext document or error
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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 |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b03e83323
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/import-donor-fixtures.sh`:
- Around line 30-32: Update the donor_path validation in the import fixture
script to reject root and normalized-path aliases, including empty or "."
components such as xmlenc/., xmlenc//, and xmlenc/./, before rm -rf can execute.
Preserve valid relative fixture paths and the existing parent-traversal
protection.
- Around line 36-46: The directory handling branch must build the complete
snapshot in a sibling temporary directory before touching the destination.
Update the `find`/copy loop to propagate enumeration and install failures, clean
up the temporary directory on error, and only replace `target` after successful
completion so failed imports leave the existing fixtures unchanged.
- Around line 47-50: Update the file-installation branch of the donor fixture
import flow to detect when the existing target is a directory and remove it
before calling install. Preserve the parent-directory creation and existing
behavior for regular file targets, ensuring a donor changing from a directory to
a file replaces the stale directory rather than installing inside it.
In `@tests/fixtures/xmlenc/01-phaos-xmlenc-3/Readme.txt`:
- Around line 10-13: Correct the `formate` typo in both PKCS#8 PrivateKeyInfo
descriptions in the fixture README, replacing it with `format` while leaving the
surrounding text unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: b2431135-7de6-43ef-91b5-d770db13ebc1
📒 Files selected for processing (79)
.gitattributesscripts/import-donor-fixtures.shsrc/xmlenc/parse.rstests/fixtures/xmlenc/01-phaos-xmlenc-3/Readme.txttests/fixtures/xmlenc/01-phaos-xmlenc-3/bad-alg-enc-element-aes128-kw-3des.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/dh-priv-key.dertests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-3des-kw-aes192.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-3des-kw-aes192.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-3des-kw-aes192.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes128-kw-3des.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes128-kw-3des.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes128-kw-3des.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes192-kw-aes256.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes192-kw-aes256.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes192-kw-aes256.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes256-kt-rsa1_5.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes256-kt-rsa1_5.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes256-kt-rsa1_5.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-ka-dh.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa1_5.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa1_5.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa1_5.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha1.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha1.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha1.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha256.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha256.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha256.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha512.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha512.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha512.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kw-3des.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kw-3des.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kw-3des.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-ka-dh.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kt-rsa1_5.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kt-rsa1_5.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kt-rsa1_5.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kt-rsa_oaep_sha1.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kt-rsa_oaep_sha1.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kt-rsa_oaep_sha1.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kw-aes128.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kw-aes128.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kw-aes128.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kw-aes256.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kw-aes256.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kw-aes256.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-ka-dh.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-kt-rsa_oaep_sha1.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-kt-rsa_oaep_sha1.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-kt-rsa_oaep_sha1.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-kw-aes192.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-kw-aes192.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-kw-aes192.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes256-ka-dh.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes256-kw-aes256.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes256-kw-aes256.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes256-kw-aes256.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-3des-kw-aes256.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-3des-kw-aes256.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-3des-kw-aes256.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes128-kw-aes192.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes128-kw-aes192.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes128-kw-aes192.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes192-kt-rsa1_5.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes192-kt-rsa1_5.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes192-kt-rsa1_5.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes256-kt-rsa_oaep_sha1.datatests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes256-kt-rsa_oaep_sha1.tmpltests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes256-kt-rsa_oaep_sha1.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/key.txttests/fixtures/xmlenc/01-phaos-xmlenc-3/keys.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/payment.xmltests/fixtures/xmlenc/01-phaos-xmlenc-3/rsa-priv-key.dertests/fixtures/xmlenc/01-phaos-xmlenc-3/rsa-priv-key.p12tests/fixtures/xmlenc/README.mdtests/fixtures_smoke.rstests/import_donor_fixtures.rstests/xmlenc_donor_integration.rs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af728d877f
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0784314063
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
AgreementMethodURIs without hiding usable key candidates and cover wrong-key, wrapped-key tampering, stale donor removal, failed imports, traversal, trailing directory separators, and directory-to-file transitionsValidation
cargo check --all-targets --all-featurescargo clippy --all-targets --all-features -- -D warningscargo nextest run --all-features(629 passed)cargo test --doc --all-features(4 passed)cargo fmt --all -- --checkbash -n scripts/import-donor-fixtures.shrustc --edition=2024 --test tests/import_donor_fixtures.rs --target wasm32-unknown-unknown --emit metadata(non-Unix compile gate)cargo package --allow-dirtyCloses #98