Skip to content

build: move repository tooling to one Rust crate - #334

Closed
polaz wants to merge 16 commits into
mainfrom
build/#333-rust-tooling
Closed

polaz wants to merge 16 commits into
mainfrom
build/#333-rust-tooling

Conversation

@polaz

@polaz polaz commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Repository tooling now uses two things: Bash to sequence commands and one Rust
crate, xml-sec-tools, for every piece of logic. Node, Python and Perl are gone
from repository tooling; the only JavaScript left is what the platform needs
(the clean-build-output action's post: step and the dashboard's browser
code).

  • CI planning and gates: ci-blocks, check-features, hardening,
    pkcs11-tests, pedantic-lints, documentation, shared-pkix and
    wasm-c14n (the WebAssembly smoke module runs in the wasmi interpreter
    instead of a Node host).
  • Security corpus and fuzzing: security-corpus (its disposition table is now
    data in tests/fixtures/security/dispositions.json) and fuzz-security.
  • Benchmarks: bench-latency, bench-compare, bench-cli, bench-library,
    bench-regression, bench-identity, bench-dashboard, bench-xslt and
    competitor-lock. Reports are read with float_roundtrip, so measurements
    copied from earlier runs keep their exact digits.
  • XSLT: libxslt-fixtures (XSLTMark databases from a port of upstream
    dbgen.pl) and xslt-conformance.
  • XAdES corpus: xades check | corpus | dss | binding | fixtures | package.
    DSS reports and fixtures are read with xml-sec's own DOM; every command runs
    in its own process group with a deadline that stops the group.
  • Donors and oracles: donor-fixtures (including the CLI runner snapshot),
    install-xmlsec1, kernel-examples and fetch-standards.
  • Release: publish-crate.

Script tests and the Rust integration tests that drove Bash scripts
(tests/import_donor_fixtures.rs, tests/install_xmlsec1.rs,
tools/xmlsec1/tests/import_snapshot.rs) become tests of the tool, using a
recorded process runner instead of fake commands on PATH. No CI job sets up
Node anymore.

The first commit carries the Rust kernel-example generator that PR #331 also
contains; whichever lands second drops it.

Testing

Each replaced script was checked against the original on the same inputs
before removal:

  • ci-blocks, check-features, hardening, pedantic-lints,
    shared-pkix, fuzz-security: identical command plans and outputs with
    recorded tools; security-corpus check reproduces audit.json byte for byte.
  • Benchmarks: on the published Pages data, bench-dashboard output is byte
    identical and bench-regression differs only in its generated time. A full
    local bench-compare validated 336 command-line and 144 library cases, and a
    bench-latency smoke run completed.
  • xades check passed live: 100 independent octet vectors, DSS default and
    strict-policy expectations. The corpus inventory is unchanged except for the
    edited documents.
  • libxslt-fixtures --check, donor-fixtures (default, --xmlenc-corpora
    and --cli --check) reproduce the committed fixtures exactly.
  • xades fixtures writes templates identical to the original generator's
    apart from the certificate digests of new random keys.
  • install-xmlsec1 built the oracle from the pinned donor and reuses a valid
    cache; xslt-conformance --cache-managed passed against it.
  • cargo nextest run -p xml-sec-tools (202 tests), cargo clippy -p xml-sec-tools --all-targets -D warnings, cargo fmt --all --check and
    documentation docs pass locally on macOS. Linux and Windows run in CI.

Not run live: publish-crate (it would publish) and fetch-standards (it
would overwrite the local reference corpus); both are covered by tests with
recorded processes.

Closes #333

polaz added 16 commits October 29, 2026 15:11
- Repository tooling logic moves into one workspace crate,
  xml-sec-tools, run with cargo; shell scripts only sequence commands.
- Its first subcommand, kernel-examples, replaces the Perl generator of
  the embedded parsers' documentation tests with the same output,
  including the documented item's cfg, and its checks are unit tests.
- ci-blocks replaces scripts/ci-test-blocks.mjs with the same profiles,
  command lines, group markers and failure messages.
- Its tests, including the workflow wiring checks, run with nextest in
  the hardening job.
- check-features, hardening and pkcs11-tests replace their shell
  scripts; profile tables, the verification-only graph gate, coverage
  flag remapping and the token store setup are Rust with unit tests.
- The coverage report check runs inside hardening, and the coverage
  environment listing is parsed instead of evaluated by a shell.
- The runner-image action is a composite action; the workflow and
  action contracts are Rust tests.
- pedantic-lints, documentation and shared-pkix replace their Node and
  shell scripts with the same checks; the metadata selection, example
  tampering and suppression scanner are Rust with the original tests.
- Process execution is one trait shared by the subcommands.
- security-corpus replaces the Node corpus checker; the reviewed
  dispositions become a data file beside the audit, and the generated
  audit and inventory stay byte-identical.
- fuzz-security replaces the shell runner with the same seed selection,
  smoke budget, evidence files and cleanup rules; its runner tests run
  on Linux and macOS.
The competitor harness lockfile still pinned xml-sec 0.2.0 while the
workspace is at 0.3.0. Refreshing only that entry leaves every
competitor dependency as locked.

Part of #333
Every benchmark runner and report is now a subcommand of xml-sec-tools:

- bench-latency replaces benchmark-security.sh
- bench-compare and competitor-lock replace benchmark-compare.sh and
  refresh-competitor-lock.sh
- bench-cli and bench-library replace compare-security.mjs and
  compare-library.mjs
- bench-regression, bench-identity and bench-dashboard replace
  compare-regression.mjs, build-identity.mjs and
  build-benchmark-dashboard.mjs
- bench-xslt replaces benchmark-xslt.mjs

The Node tests move to nextest. CI, the benchmark container and the
runbooks call the subcommands, and the benchmark jobs no longer set up
Node. Reports read with serde_json's float_roundtrip, so measurements
copied from an earlier run keep their exact digits.

Part of #333
The six Python scripts of the XAdES interoperability corpus become the
xades subcommand of xml-sec-tools:

- xades check runs the live gate: inventory, harness tests, libxmlsec1
  and probe verification, golden octets, DSS default and strict-policy
  expectations
- xades corpus, dss, binding and package replace xades-interop.py,
  xades-dss.py, investigate-xades-dss.py and package-xades-interop.py
- the harness tests move from test-xades-interop.py to nextest

DSS reports and signed fixtures are read with xml-sec's own DOM. Every
command runs in its own process group with a deadline; a timeout stops
the group and keeps the streams read so far. The corpus archive stays
reproducible: fixed owner, group and times.

CI calls the subcommand, the corpus documentation names the new
commands and the corpus inventory covers the updated documents.

Part of #333
- libxslt-fixtures replaces import-libxslt-oracle-fixtures.sh. The
  XSLTMark databases come from a port of upstream dbgen.pl, so the
  import no longer needs Perl; tests pin the port and the case manifest
  to the committed corpus byte for byte. The pinned commit is read from
  its compatibility file.
- xslt-conformance replaces check-xslt-conformance.sh; its admission
  and failure-propagation tests move from Node to nextest.
- wasm-c14n replaces test-wasm-c14n.sh. The smoke module runs in the
  wasmi interpreter instead of a Node host.

Process steps can now remove inherited variables, which the conformance
gate uses to refuse a sliced corpus. No CI job sets up Node anymore.

Part of #333
publish-crate replaces .github/scripts/publish-crate.sh, which read the
package version with jq. The release still uploads a version only when
crates.io does not show it, and still treats an upload that becomes
visible after a failed publish command as success. Tests cover both and
a version that never appears.

Part of #333
donor-fixtures replaces import-donor-fixtures.sh, which corrected the
Phaos README with sed. Each target is still staged completely beside
itself and swapped in, so a failed import keeps the last known-good
snapshot; path validation, the Merlin and Phaos corrections and the
corpora.sha256 inventory are unchanged.

The importer's integration tests move from tests/import_donor_fixtures.rs
into the tool's tests. Importing from the pinned donor reproduces the
committed fixtures, including the corpus inventory, byte for byte.

Part of #333
donor-fixtures --cli [--check] replaces
import-xmlsec1-cli-fixtures.sh. The snapshot still copies only assets
tracked and unchanged at the pinned donor commit, records that commit,
keeps runner scripts executable, and --check reports drift without
touching the snapshot.

Its tests move from tools/xmlsec1/tests/import_snapshot.rs into the
tool and no longer need the donors checkout: each builds a throwaway
donor repository. The Bash version's guard against a signal between its
two mv calls has no counterpart: promotion is now two renames in one
process, and a failed rename restores the previous snapshot.

Part of #333
xades fixtures replaces generate-xades-fixtures.sh, whose templates
were heredocs. OpenSSL still issues the test chain and xmlsec1 still
signs every template; the templates themselves are now built by the
tool. Run side by side, both generators write byte-identical templates
apart from the certificate digests of their random keys.

xades corpus --generate calls the generator directly, the corpus
archive carries its source instead of the script, and the corpus
documents and inventory name the new command.

Part of #333
install-xmlsec1 replaces scripts/install-xmlsec1.sh. Behavior is kept:
a cached prefix is reused only after its version and transforms pass
again, the source must resolve to the pinned commit (exported from a
local checkout or fetched), the modern profile builds a private,
digest-checked OpenSSL, and a new build replaces the previous one only
after validation, which otherwise restores it.

The build directory now lives beside the prefix, so promotion is a
rename on one file system. Process steps can run in a given directory,
which OpenSSL's Configure needs.

The installer's integration tests move from tests/install_xmlsec1.rs
into the tool, driving it through a recorded toolchain instead of fake
commands on PATH. CI, the fuzz workflows, the benchmark comparison and
the oracle cache key use the subcommand.

Part of #333
- fetch-standards replaces scripts/fetch-standards.sh, which parsed
  docs/standards-sources.tsv in a shell read loop. Downloads, the PDF
  payload check, RFC status records, SHA256SUMS and the retrieval time
  are unchanged; the inventory is now sorted.
- The SHA-3 vector and Merlin key importers check their archive digest
  with shasum --check instead of cutting the hash out of its output, so
  they stay plain command sequences.

Part of #333
The process-group test moves a background job out of the command's
group with job control. Not every sh offers job control to scripts, so
the case runs under bash explicitly.

Part of #333
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 168 files, which is 68 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 3826acb and 57ad95e.

Files ignored due to path filters: 1
  • benchmarks/competitors/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 168
  • .github/actions/runner-image/action.yml
  • .github/actions/runner-image/identity.mjs
  • .github/actions/xmlsec-oracle-cache/action.yml
  • .github/scripts/publish-crate.sh
  • .github/workflows/benchmark-comparison.yml
  • .github/workflows/ci.yml
  • .github/workflows/fuzz.yml
  • .github/workflows/release.yml
  • .gitignore
  • AGENTS.md
  • Cargo.toml
  • benchmarks/Dockerfile
  • crates/xml-sec-xades/tests/basic.rs
  • crates/xml-sec-xslt/README.md
  • docs/README.md
  • docs/benchmarks.md
  • docs/ci-hardening.md
  • docs/cli.md
  • docs/crypto-providers.md
  • docs/cve-audit.md
  • docs/cve-inventory.md
  • docs/features.md
  • docs/migration-libxmlsec1.md
  • docs/standards-audit.md
  • docs/xml-backend-patches.md
  • docs/xslt-conformance.md
  • docs/xslt-performance.md
  • fuzz/README.md
  • interop/xades/PROVENANCE.md
  • interop/xades/README.md
  • interop/xades/SHA256SUMS
  • interop/xades/dss-investigation/README.md
  • scripts/benchmark-compare.sh
  • scripts/benchmark-security.sh
  • scripts/benchmark-xslt.mjs
  • scripts/benchmark-xslt.test.mjs
  • scripts/build-benchmark-dashboard.mjs
  • scripts/build-identity.mjs
  • scripts/build-identity.test.mjs
  • scripts/check-coverage-report.mjs
  • scripts/check-documentation.sh
  • scripts/check-documentation.test.mjs
  • scripts/check-features.sh
  • scripts/check-features.test.mjs
  • scripts/check-hardening.sh
  • scripts/check-hardening.test.mjs
  • scripts/check-pedantic-lints.mjs
  • scripts/check-pedantic-lints.test.mjs
  • scripts/check-shared-pkix.sh
  • scripts/check-shared-pkix.test.mjs
  • scripts/check-xades-interop.py
  • scripts/check-xslt-conformance.sh
  • scripts/check-xslt-conformance.test.mjs
  • scripts/ci-cache.test.mjs
  • scripts/ci-test-blocks.mjs
  • scripts/ci-test-blocks.test.mjs
  • scripts/compare-library.mjs
  • scripts/compare-library.test.mjs
  • scripts/compare-regression.mjs
  • scripts/compare-regression.test.mjs
  • scripts/compare-security.mjs
  • scripts/compare-security.test.mjs
  • scripts/fetch-standards.sh
  • scripts/fuzz-security.sh
  • scripts/fuzz-security.test.mjs
  • scripts/generate-xades-fixtures.sh
  • scripts/import-donor-fixtures.sh
  • scripts/import-libxslt-oracle-fixtures.sh
  • scripts/import-merlin-original-keys.sh
  • scripts/import-sha3-bit-vectors.sh
  • scripts/import-xml-backends.sh
  • scripts/import-xmlsec1-cli-fixtures.sh
  • scripts/install-xmlsec1.sh
  • scripts/investigate-xades-dss.py
  • scripts/package-xades-interop.py
  • scripts/refresh-competitor-lock.sh
  • scripts/security-corpus.mjs
  • scripts/security-corpus.test.mjs
  • scripts/security-dispositions.mjs
  • scripts/test-pkcs11.sh
  • scripts/test-wasm-c14n.sh
  • scripts/test-xades-interop.py
  • scripts/xades-dss.py
  • scripts/xades-interop.py
  • scripts/xml-kernel-examples.pl
  • src/parser_roxmltree/documentation_tests.rs
  • src/parser_xmloxide/documentation_tests.rs
  • tests/benchmark_contract.rs
  • tests/fixtures/security/dispositions.json
  • tests/fixtures/xmldsig/README.md
  • tests/fixtures/xmlenc/README.md
  • tests/import_donor_fixtures.rs
  • tests/install_xmlsec1.rs
  • tests/pkcs11.rs
  • tools/xml-sec-tools/Cargo.toml
  • tools/xml-sec-tools/src/bench/cli.rs
  • tools/xml-sec-tools/src/bench/compare.rs
  • tools/xml-sec-tools/src/bench/compare/tests.rs
  • tools/xml-sec-tools/src/bench/dashboard.rs
  • tools/xml-sec-tools/src/bench/identity.rs
  • tools/xml-sec-tools/src/bench/identity/tests.rs
  • tools/xml-sec-tools/src/bench/latency.rs
  • tools/xml-sec-tools/src/bench/latency/tests.rs
  • tools/xml-sec-tools/src/bench/library.rs
  • tools/xml-sec-tools/src/bench/library/tests.rs
  • tools/xml-sec-tools/src/bench/mod.rs
  • tools/xml-sec-tools/src/bench/regression.rs
  • tools/xml-sec-tools/src/bench/regression/tests.rs
  • tools/xml-sec-tools/src/bench/tests.rs
  • tools/xml-sec-tools/src/bench/xslt.rs
  • tools/xml-sec-tools/src/bench/xslt/tests.rs
  • tools/xml-sec-tools/src/check_features.rs
  • tools/xml-sec-tools/src/check_features/tests.rs
  • tools/xml-sec-tools/src/ci_blocks.rs
  • tools/xml-sec-tools/src/ci_blocks/tests.rs
  • tools/xml-sec-tools/src/coverage.rs
  • tools/xml-sec-tools/src/coverage/tests.rs
  • tools/xml-sec-tools/src/documentation.rs
  • tools/xml-sec-tools/src/documentation/tests.rs
  • tools/xml-sec-tools/src/donor_fixtures.rs
  • tools/xml-sec-tools/src/donor_fixtures/cli.rs
  • tools/xml-sec-tools/src/donor_fixtures/cli/tests.rs
  • tools/xml-sec-tools/src/donor_fixtures/tests.rs
  • tools/xml-sec-tools/src/fetch_standards.rs
  • tools/xml-sec-tools/src/fetch_standards/tests.rs
  • tools/xml-sec-tools/src/fuzz_security.rs
  • tools/xml-sec-tools/src/fuzz_security/tests.rs
  • tools/xml-sec-tools/src/hardening.rs
  • tools/xml-sec-tools/src/hardening/tests.rs
  • tools/xml-sec-tools/src/install_xmlsec1.rs
  • tools/xml-sec-tools/src/install_xmlsec1/tests.rs
  • tools/xml-sec-tools/src/kernel_examples.rs
  • tools/xml-sec-tools/src/kernel_examples/tests.rs
  • tools/xml-sec-tools/src/libxslt_fixtures.rs
  • tools/xml-sec-tools/src/libxslt_fixtures/tests.rs
  • tools/xml-sec-tools/src/main.rs
  • tools/xml-sec-tools/src/pedantic_lints.rs
  • tools/xml-sec-tools/src/pedantic_lints/tests.rs
  • tools/xml-sec-tools/src/pkcs11.rs
  • tools/xml-sec-tools/src/pkcs11/tests.rs
  • tools/xml-sec-tools/src/publish_crate.rs
  • tools/xml-sec-tools/src/publish_crate/tests.rs
  • tools/xml-sec-tools/src/repo.rs
  • tools/xml-sec-tools/src/security_corpus.rs
  • tools/xml-sec-tools/src/security_corpus/tests.rs
  • tools/xml-sec-tools/src/shared_pkix.rs
  • tools/xml-sec-tools/src/shared_pkix/tests.rs
  • tools/xml-sec-tools/src/test_support.rs
  • tools/xml-sec-tools/src/wasm_c14n.rs
  • tools/xml-sec-tools/src/wasm_c14n/tests.rs
  • tools/xml-sec-tools/src/workflow_contracts.rs
  • tools/xml-sec-tools/src/xades/binding.rs
  • tools/xml-sec-tools/src/xades/check.rs
  • tools/xml-sec-tools/src/xades/corpus.rs
  • tools/xml-sec-tools/src/xades/dss.rs
  • tools/xml-sec-tools/src/xades/fixtures.rs
  • tools/xml-sec-tools/src/xades/fixtures/tests.rs
  • tools/xml-sec-tools/src/xades/mod.rs
  • tools/xml-sec-tools/src/xades/package.rs
  • tools/xml-sec-tools/src/xades/process.rs
  • tools/xml-sec-tools/src/xades/process/tests.rs
  • tools/xml-sec-tools/src/xades/tests.rs
  • tools/xml-sec-tools/src/xades/xml.rs
  • tools/xml-sec-tools/src/xslt_conformance.rs
  • tools/xml-sec-tools/src/xslt_conformance/tests.rs
  • tools/xmlsec1/Cargo.toml
  • tools/xmlsec1/tests/import_snapshot.rs
  • tools/xmlsec1/tests/xmlenc_encrypt_xmlsec1.rs

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 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-29T15:21:41.937774Z 57ad95e 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.

@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: 57ad95e525

ℹ️ 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 tools/xml-sec-tools/src/bench/mod.rs Resolved
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.

Move repository tooling to Bash and one Rust crate

1 participant