Skip to content

test(xmlenc): add Phaos decrypt vectors#99

Merged
polaz merged 18 commits into
mainfrom
test/#98-phaos-xmlenc-interop
Jul 22, 2026
Merged

test(xmlenc): add Phaos decrypt vectors#99
polaz merged 18 commits into
mainfrom
test/#98-phaos-xmlenc-interop

Conversation

@polaz

@polaz polaz commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

  • import the complete independent Phaos XML Encryption corpus through a fixture workflow that validates and normalizes paths, then atomically replaces complete donor snapshots
  • decrypt supported RSA-OAEP and AES Key Wrap vectors through the full parser, resolver, cipher, and document-replacement pipeline
  • exhaustively classify all 25 ciphertext vectors, keeping Triple-DES, RSA-PKCS#1 v1.5 encryption, AES-192, legacy key wrapping, and Diffie-Hellman agreement fail-closed
  • report unsupported AgreementMethod URIs 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 transitions

Validation

  • cargo check --all-targets --all-features
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo nextest run --all-features (629 passed)
  • cargo test --doc --all-features (4 passed)
  • cargo fmt --all -- --check
  • bash -n scripts/import-donor-fixtures.sh
  • rustc --edition=2024 --test tests/import_donor_fixtures.rs --target wasm32-unknown-unknown --emit metadata (non-Unix compile gate)
  • cargo package --allow-dirty

Closes #98

- 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
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds the Phaos XML Encryption corpus and exercises it through the full decryption pipeline. The main changes are:

  • Imports and classifies 25 Phaos encryption vectors.
  • Stages complete donor snapshots before replacing existing fixtures.
  • Rejects unsafe fixture paths and preserves existing snapshots on import failure.
  • Reports unsupported agreement methods while retaining usable key candidates.
  • Adds parser, importer, smoke, and end-to-end integration tests.

Confidence Score: 5/5

This looks safe to merge.

Complete snapshot replacement removes files deleted by the donor. Directory-to-file imports replace the old directory and its stale contents. Snapshot construction failures leave the existing fixture unchanged.

No blocking issue remains in the updated import flow.

T-Rex T-Rex Logs

What T-Rex did

  • The contract-validation run completed with exit code 0 and all tests passing (10 passed, 0 failed, 0 ignored).
  • A validation log was captured that records the exact command, working directory, exit code, and the per-test outcomes for review.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

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

Comment thread scripts/import-donor-fixtures.sh
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@polaz, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 18 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 55407910-bb59-4cc4-8282-b3afb9913fe5

📥 Commits

Reviewing files that changed from the base of the PR and between 0784314 and 97767ad.

📒 Files selected for processing (1)
  • tests/import_donor_fixtures.rs
📝 Walkthrough

Walkthrough

The change vendors the Phaos XML Encryption corpus, hardens directory-based fixture importing, explicitly handles unsupported AgreementMethod elements, and adds interoperability, classification, and negative-path tests for XML Encryption decryption.

Changes

Phaos XML Encryption coverage

Layer / File(s) Summary
AgreementMethod rejection
src/xmlenc/parse.rs
AgreementMethod entries require an Algorithm attribute and produce explicit unsupported-algorithm or missing-attribute errors while preserving supported key-material precedence.
Fixture import and corpus
scripts/import-donor-fixtures.sh, tests/import_donor_fixtures.rs, tests/fixtures/xmlenc/*, tests/fixtures_smoke.rs
Fixture imports validate paths and replace directory snapshots; the Phaos corpus adds encrypted vectors, plaintext inputs, keys, documentation, whitespace rules, and updated count metadata.
Phaos interoperability tests
tests/xmlenc_donor_integration.rs
Tests decrypt supported RSA-OAEP and AES-KW vectors, classify the full corpus, and verify wrong-key and wrapped-key tampering failures.

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
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 68.42% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy the linked issue goals: corpus import, supported decrypts, fail-closed unsupported cases, negative tests, and documentation.
Out of Scope Changes check ✅ Passed The changes appear scoped to the Phaos xmlenc corpus, import workflow, parser behavior, tests, and supporting docs only.
Title check ✅ Passed The title is concise and accurately summarizes the added Phaos decrypt vectors and related xmlenc test coverage.
Description check ✅ Passed The description matches the PR, covering the new corpus import workflow, decryption tests, and fail-closed cases.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/#98-phaos-xmlenc-interop

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 commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/xmlenc/parse.rs Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between f8ca8e5 and 2b03e83.

📒 Files selected for processing (79)
  • .gitattributes
  • scripts/import-donor-fixtures.sh
  • src/xmlenc/parse.rs
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/Readme.txt
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/bad-alg-enc-element-aes128-kw-3des.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/dh-priv-key.der
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-3des-kw-aes192.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-3des-kw-aes192.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-3des-kw-aes192.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes128-kw-3des.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes128-kw-3des.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes128-kw-3des.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes192-kw-aes256.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes192-kw-aes256.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes192-kw-aes256.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes256-kt-rsa1_5.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes256-kt-rsa1_5.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-content-aes256-kt-rsa1_5.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-ka-dh.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa1_5.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa1_5.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa1_5.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha1.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha1.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha1.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha256.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha256.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha256.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha512.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha512.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kt-rsa_oaep_sha512.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kw-3des.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kw-3des.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-3des-kw-3des.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-ka-dh.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kt-rsa1_5.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kt-rsa1_5.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kt-rsa1_5.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kt-rsa_oaep_sha1.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kt-rsa_oaep_sha1.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kt-rsa_oaep_sha1.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kw-aes128.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kw-aes128.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kw-aes128.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kw-aes256.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kw-aes256.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes128-kw-aes256.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-ka-dh.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-kt-rsa_oaep_sha1.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-kt-rsa_oaep_sha1.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-kt-rsa_oaep_sha1.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-kw-aes192.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-kw-aes192.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes192-kw-aes192.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes256-ka-dh.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes256-kw-aes256.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes256-kw-aes256.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-element-aes256-kw-aes256.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-3des-kw-aes256.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-3des-kw-aes256.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-3des-kw-aes256.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes128-kw-aes192.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes128-kw-aes192.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes128-kw-aes192.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes192-kt-rsa1_5.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes192-kt-rsa1_5.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes192-kt-rsa1_5.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes256-kt-rsa_oaep_sha1.data
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes256-kt-rsa_oaep_sha1.tmpl
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/enc-text-aes256-kt-rsa_oaep_sha1.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/key.txt
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/keys.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/payment.xml
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/rsa-priv-key.der
  • tests/fixtures/xmlenc/01-phaos-xmlenc-3/rsa-priv-key.p12
  • tests/fixtures/xmlenc/README.md
  • tests/fixtures_smoke.rs
  • tests/import_donor_fixtures.rs
  • tests/xmlenc_donor_integration.rs

Comment thread scripts/import-donor-fixtures.sh Outdated
Comment thread scripts/import-donor-fixtures.sh Outdated
Comment thread scripts/import-donor-fixtures.sh
Comment thread tests/fixtures/xmlenc/01-phaos-xmlenc-3/Readme.txt
Comment thread scripts/import-donor-fixtures.sh

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread scripts/import-donor-fixtures.sh
@polaz

polaz commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread tests/import_donor_fixtures.rs
@polaz

polaz commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 97767ad72e

ℹ️ 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".

@polaz
polaz merged commit 93ff852 into main Jul 22, 2026
10 checks passed
@polaz
polaz deleted the test/#98-phaos-xmlenc-interop branch July 22, 2026 11:18
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(xmlenc): add Phaos decrypt interoperability

1 participant