Repository navigation
feat!: build XMLDSig verification without std - #331
Conversation
- Port the XPath tokenizer to winnow 1.0, which builds without std; peresil requires it. Error selection keeps the furthest failure and never backtracks over fatal errors. - The embedded XML parser of the XPath engine only builds test documents, so peresil becomes a dev-dependency. - Disable default features of dependencies that pull std, and move their std features and the ECDSA basepoint tables under `std`. - `xmldsig` no longer selects `std`. Part of #330
- Replace std paths with core/alloc across verification, C14N, the embedded XPath engine and the embedded xmloxide kernel. - Lookup tables keyed by document content are seeded hash tables with std and ordered trees without it (no seed source). - Canonical output goes through a byte sink; the io::Write adapter stays behind std. C14nError::Io is std-only, OutputRefused reports an internal consumer's refusal. - Policy time is structured-pkix Instant; instant_from_system_time converts host time with std. Without std the caller's verification time is the only operation time. - Public policy sets and external-resource maps are BTreeSet/BTreeMap; KeyResolverConfig::named_keys is a BTreeMap. - X509TrustEvidence::verification_time returns the Instant directly, replacing validation_instant. - Base64 streaming decodes whole quartets without io::Read. - xmldsig-sign selects std; libm supplies XPath floor/ceiling and portable-atomic the document identity counter where core lacks them. BREAKING CHANGE: policy time fields are Instant, policy algorithm sets are BTreeSet, external resources and named keys are BTreeMap, and C14nError::Io exists only with std. Part of #330
- The embedded roxmltree parse error implements core::error::Error. - Table re-exports and capacity accounting compile only with xmldsig, so a C14N-only alloc build has no dead items. Part of #330
- The alloc-only job lints C14N and XMLDSig verification for each XML backend on thumbv7em-none-eabihf. - The WASM module verifies a signed SAML response and rejects a tampered copy, alongside the C14N check. Part of #330
- Pre-signed HMAC fixtures, reproduced and compared by a std test, let the coverage checks run without signing. - Exact coverage, wrapping, duplicate IDs, lookalike namespaces and an absent detached payload are checked on both builds; CI runs them without std for each XML backend. Part of #330
- C14N and XMLDSig verification build on core and alloc; signing, configuration loading and the CLI still require std - the caller supplies the verification time without std - CI coverage of the alloc-only build and the WASM verification smoke Part of #330
0.17.1 exposes the core error traits of the ASN.1, PKIX and CMS crates without std, which XMLDSig verification needs to build on core and alloc. The 0.17.0 PKIX change needs no adaptation here. Part of #330
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important Review skippedToo many files! This PR contains 178 files, which is 78 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.
|
- The fuzz harness and the competitor benchmark still built policy algorithm sets as HashSet; they now use BTreeSet like the policy types. - The XMLEnc donor test imported BTreeMap unconditionally although only legacy-algorithms tests use it, which failed builds without that feature. - Refresh the competitor lockfile for the 0.17.1 primitives and winnow. - The xmldsig fixture count includes the two alloc-only inputs.
- Unit tests link std even when the library is built without it; the crate is no_std only outside cfg(test), while the library target and the embedded target still check the no_std build. - Test byte sinks implement ByteSink directly, so canonicalization tests run in every build; only the io::Write refusal test needs std. - Path validation tests supply their verification time, as callers must without a host clock. - XPath tests charge set insertions through one per-build helper. - The xslt feature selects std: its engine shares state across threads and reads the host clock.
- Documentation examples of the embedded XML parsers become unit tests; the generator now copies the documented item's cfg attributes onto the test, so the parse_file example runs only where parse_file exists. - The maintained xmloxide delta records the std gates on the parse_file tests, so the source check matches the tree again.
- 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.
Branch protection requires a status named "alloc-only XML input". The renamed job reported under a new name, so the required check never arrived and the PR waited forever. Part of #330
Summary
XMLDSig verification now builds as
no_std + alloc, so browser (WASM) and embedded consumers can verify signatures. C14N builds withoutstdas well.xmldsigno longer enablesstd. The crate isno_stdwithout thestdfeature and usescore/alloctypes throughout, including the embedded XML backends and the XPath engine.ByteSinktrait; thestd::io::Writeadapter exists only withstd.stdand ordered trees without it: there is no random seed source withoutstd, and an unseeded hash table is open to collision flooding from attacker-controlled XML. Public policy sets and caller-supplied resource and named-key maps are ordered collections in every build, so enabling a feature never changes a public type.stdthere is no host clock: the caller supplies the verification time (KeyTrustPolicy::verification_time,X509ChainOptions::verification_time,policy::Instant).xmldsig-sign), native providers, PKCS#11 and configuration loading still requirestd.winnowinstead ofperesil.std.Breaking changes
BTreeSet; external resource maps and named keys areBTreeMap.validation_instantis replaced byverification_timeof typepolicy::Instant.xmldsig-signenablesstd.Testing
cargo clippy -p xml-sec --lib --no-default-features --target thumbv7em-none-eabihfforc14n,xml-backend-xmloxide,xmldsig,xml-backend-xmloxideandxmldsig,xml-backend-roxmltree,-D warnings: clean.tests/alloc_only_verification.rswithoutstdfor both backends: wrapping, duplicate IDs, namespace look-alikes, absent detached payload and exact coverage; 5/5 each.scripts/test-wasm.sh: C14N and XMLDSig verification executed inwasm32-unknown-unknown, valid signature accepted and a forgery rejected.cargo clippy --workspace --all-targets --all-features -D warnings, documentation build and doctests: clean.BREAKING CHANGE: policy sets and resource/key maps are ordered collections,
validation_instantis replaced byverification_time, andxmldsig-signrequiresstd.Closes #330