Skip to content

ci: enforce pedantic through workspace lints - #295

Merged
polaz merged 6 commits into
mainfrom
refactor/#277-tooling-pedantic
Oct 25, 2026
Merged

polaz merged 6 commits into
mainfrom
refactor/#277-tooling-pedantic

Conversation

@polaz

@polaz polaz commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Qualifies the remaining tooling under clippy::pedantic and moves pedantic enforcement from the scoped gate scripts into the workspace lint table.

  • [workspace.lints.clippy] pedantic = "warn" in the root Cargo.toml; every member inherits it with [lints] workspace = true. Locally pedantic warns; every CI lint invocation runs with -D warnings.
  • Config, capability ledger, benchmark harness, examples and the xmlsec1 CLI (arguments, policy commands, key material, commands, tests) are clean on stable and on the 1.92 MSRV, without allow/expect suppressions.
  • CLI command key selection, recipient, template and decryption logic is split into named stages; inline unit tests moved into sibling tests.rs files.
  • Oversized CLI integration tests are split into fixture and check helpers with shared RSA store, recipient template and success-run builders.
  • The XML parse work budget is uninhabited on DOM/C14N graphs, so its charge path stays one call and stays pedantic-clean on those graphs.
  • The scoped check-xml-kernels, check-xslt and check-security scripts and their tests are removed. Their separately resolved graphs remain linted: the default-feature workspace and the MSRV XSLT graph gain lint, xmldsig/xmlenc/xslt minimal library graphs are new lint-only profiles, and the alloc-only XML-input crate is linted instead of only checked.
  • Lint on clippy before 1.94 passes -A clippy::large_stack_arrays, both in the CI test blocks and in check-features.sh: clippy 1.92 reports the libtest descriptor array of a large test crate without a span (No span for clippy::large_stack_arrays rust-lang/rust-clippy#13774, fixed upstream by Do not warn about large stack arrays without having a valid span rust-lang/rust-clippy#16347). Newer clippy keeps the check; the runner test pins both sides with a stub rustc.

Testing

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings on stable and 1.92.0, plus the experimental-PQ profile on 1.92.0
  • every scripts/check-features.sh lint profile (default, DOM, C14N, dsig, xmlenc, XSLT, legacy, experimental, fips-dsig, pkcs11) on stable and 1.92.0
  • node --test scripts/: 74 passed, 1 skipped
  • scripts/test-pkcs11.sh with SoftHSM and the pinned xmlsec1 oracle: 5604 tests passed

Closes #277

Summary by CodeRabbit

  • Bug Fixes

    • Policy authorization options now require all fields, and invalid or out-of-range timestamps are rejected.
    • CLI failures, including output-flush errors, now consistently return a failure status and report the error.
    • Private-key imports validate DSA key components and enforce bounds when decoding traditional PEM data.
  • Developer Improvements

    • Expanded automated coverage for command behavior, key handling, policy configuration, and XML processing.
    • CI now applies shared lint checks across additional feature configurations.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 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-25T08:47:37.704618Z bc2d6d7 New commits
ℹ️ 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 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 91975cf and bc2d6d7.

Files selected for processing: 55
  • .github/workflows/ci.yml
  • Cargo.toml
  • benches/security.rs
  • benches/support/mod.rs
  • crates/xml-sec-config/Cargo.toml
  • crates/xml-sec-config/src/lib.rs
  • crates/xml-sec-config/src/settings.rs
  • crates/xml-sec-config/src/settings/key_source_tests.rs
  • crates/xml-sec-config/src/tests.rs
  • crates/xml-sec-config/tests/configuration.rs
  • crates/xml-sec-config/tests/documentation.rs
  • crates/xml-sec-xades/Cargo.toml
  • crates/xml-sec-xades/examples/interop_probe.rs
  • crates/xml-sec-xml-input/Cargo.toml
  • crates/xml-sec-xslt/Cargo.toml
  • docs/ci-hardening.md
  • examples/benchmark_latency.rs
  • examples/sign.rs
  • scripts/check-features.sh
  • scripts/check-features.test.mjs
  • scripts/check-security.mjs
  • scripts/check-security.test.mjs
  • scripts/check-xml-kernels.mjs
  • scripts/check-xml-kernels.test.mjs
  • scripts/check-xslt.mjs
  • scripts/check-xslt.test.mjs
  • scripts/ci-test-blocks.mjs
  • scripts/ci-test-blocks.test.mjs
  • src/document.rs
  • tests/c14n_golden.rs
  • tests/capability_ledger.rs
  • tools/capability-ledger/Cargo.toml
  • tools/capability-ledger/src/main.rs
  • tools/capability-ledger/src/tests.rs
  • tools/xmlsec1/Cargo.toml
  • tools/xmlsec1/src/args.rs
  • tools/xmlsec1/src/args/tests.rs
  • tools/xmlsec1/src/capabilities.rs
  • tools/xmlsec1/src/capabilities/tests.rs
  • tools/xmlsec1/src/commands.rs
  • tools/xmlsec1/src/commands/tests.rs
  • tools/xmlsec1/src/key_material.rs
  • tools/xmlsec1/src/key_material/modern_import_tests.rs
  • tools/xmlsec1/src/key_material/tests.rs
  • tools/xmlsec1/src/main.rs
  • tools/xmlsec1/src/policy_commands.rs
  • tools/xmlsec1/src/tests.rs
  • tools/xmlsec1/src/utc_facts.rs
  • tools/xmlsec1/src/utc_facts/tests.rs
  • tools/xmlsec1/tests/ml_kem_keys.rs
  • tools/xmlsec1/tests/policy_commands.rs
  • tools/xmlsec1/tests/process_contract.rs
  • tools/xmlsec1/tests/xmlenc_encrypt_xmlsec1.rs
  • vendor/sxd-document-no-unsafe/Cargo.toml
  • vendor/sxd-xpath-no-unsafe/Cargo.toml
Files with no reviewable changes: 6
  • scripts/check-xml-kernels.test.mjs
  • scripts/check-security.test.mjs
  • scripts/check-xml-kernels.mjs
  • scripts/check-xslt.test.mjs
  • scripts/check-security.mjs
  • scripts/check-xslt.mjs

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

The change centralizes workspace lint settings and updates CI lint profiles. It also refactors configuration handling, CLI and key-import code, benchmarks, examples, and capability-ledger tooling, with expanded tests across the CLI and interoperability suites.

Changes: Lint qualification and tooling

Layer / File(s) Summary
Workspace lint settings and CI profiles
Cargo.toml, .github/workflows/ci.yml, scripts/*, docs/ci-hardening.md, package Cargo.toml files
Workspace Rust and Clippy lints are inherited by packages. CI adds stable and feature-specific lint profiles, handles the large_stack_arrays MSRV exception, and removes the former XML-kernel, XSLT, and security check scripts.
Configuration parsing and policy snapshots
crates/xml-sec-config/src/*, crates/xml-sec-config/tests/*
Configuration APIs document error conditions and mark selected results must_use. Timestamp parsing uses checked epoch arithmetic. Snapshot generation uses operation-specific helpers; the output structure remains unchanged.
CLI argument and policy handling
tools/xmlsec1/src/args*, tools/xmlsec1/src/main.rs, tools/xmlsec1/src/policy_commands.rs, tools/xmlsec1/tests/policy_commands.rs
Argument parsing moves positional values instead of cloning them. Error reporting and policy-option handling use shared helpers. Tests cover parsing, authorization timestamps, duplicate options, and process failure on output flush errors.
Key import and normalization
tools/xmlsec1/src/key_material*
Key import adds bounded PEM payload decoding, traditional EC normalization, and DSA public-value validation. Tests cover key formats, protected containers, memory limits, and signature metadata references.
Feature, capability, and UTC-facts checks
src/document.rs, tools/xmlsec1/src/capabilities*, tools/xmlsec1/src/utc_facts*
Parse-work budget handling is unified across feature configurations. Tests cover capability output and feature gates, UTC-facts validation, and memory and work limits.
CLI command and process-contract tests
tools/xmlsec1/src/commands/tests.rs, tools/xmlsec1/tests/process_contract.rs, tests/c14n_golden.rs
Tests cover command resource accounting, candidate selection, template processing, input limits, and process contracts. Reusable test helpers replace repeated setup and assertions.
ML-KEM and XML Encryption interoperability tests
tools/xmlsec1/tests/ml_kem_keys.rs, tools/xmlsec1/tests/xmlenc_encrypt_xmlsec1.rs
Tests extract shared helpers for ML-KEM CLI and reference cases, and for XML Encryption interoperability across templates, CipherReference, KDFs, and ECDH.
Benchmarks, examples, and capability ledger
benches/*, examples/*, tools/capability-ledger/*, tests/capability_ledger.rs
Benchmark and example setup and reporting move into helpers. Capability-ledger parsing uses shared patterns and extraction helpers, with expanded parser, classification, and provenance tests.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Merge Risk: Minimal · up to bc2d6

This PR moves pedantic lint enforcement into the workspace lint table and refactors tooling, tests and examples without intended behavior changes. No concrete defect was found, so the merge risk is minimal. The PR does not report the full test matrix or the coverage figure requested in the linked issue.

Pre-merge checks: Passed 3 · Failed 1 · Inconclusive 1

Failed Failed checks: 1 warning · 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.30% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 404 functions across 37 files. (11 skippe… Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check Inconclusive The PR implements the main #277 coding work. Workspace lint inheritance, -D warnings CI profiles, separate minimal-feature lint graphs, alloc-only XML-input linting, CLI/configuration refactors, led… Provide reviewable CI or test evidence for the complete #277 matrix, including embedded/WASM and documentation runs, example execution, and coverage of at least 85%.
Passed Passed checks: 3 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: enforcing Clippy pedantic linting through workspace-wide lint configuration and CI.
Out of Scope Changes check Passed The changes remain connected to #277. They configure workspace pedantic linting, qualify the scoped packages, CLI, examples, benchmarks, ledger tooling, and test support, add focused contract and orac…
Full details: Out of Scope Changes check

Explanation

The changes remain connected to #277. They configure workspace pedantic linting, qualify the scoped packages, CLI, examples, benchmarks, ledger tooling, and test support, add focused contract and oracle tests, update lint profiles, and document or remove the superseded scoped gates. The XML parse-budget change supports the required pedantic-clean feature graphs. No unrelated change is established.

Full details: Docstring Coverage

Explanation

Docstring coverage is 20.30% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 404 functions across 37 files. (11 skipped: 11 unsupported.)

Resolution

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

Full details: Linked Issues check

Explanation

The PR implements the main #277 coding work. Workspace lint inheritance, -D warnings CI profiles, separate minimal-feature lint graphs, alloc-only XML-input linting, CLI/configuration refactors, ledger checks, benchmark support, and oracle tests are present in the reported changes. The evidence does not establish the full acceptance matrix for embedded/WASM and documentation runs, or a measured coverage result of at least 85%. The PR description also does not report example execution.

Resolution

Provide reviewable CI or test evidence for the complete #277 matrix, including embedded/WASM and documentation runs, example execution, and coverage of at least 85%.

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 force-pushed the refactor/#277-tooling-pedantic branch 2 times, most recently from 1edde92 to e936b97 Compare October 25, 2026 01:09
Base automatically changed from refactor/#276-security-pedantic to main October 25, 2026 01:37
polaz added 6 commits October 25, 2026 10:32
- Inherit one workspace lint table in every member: pedantic clippy plus
  the shared unexpected_cfgs feature names
- Qualify xml-sec-config: explicit policy imports, checked timestamp
  conversions, Option<&T> snapshot inputs, per-operation snapshot
  functions that keep exhaustive field destructuring, documented errors
- Qualify the capability ledger: compile header patterns once, count
  URI declaration lines incrementally, split header extraction stages
- Qualify benchmark harnesses and examples: write! instead of format
  pushes, exact limb conversions for report ratios, split fixture setup
- Move inline unit tests into sibling tests.rs files

Part of #277
- Take positional arguments out of the owned argv buffer instead of
  cloning them, and document the parser's errors and invariants
- Split policy command option parsing, authorization and diff output;
  track the two flags directly and insert options through the entry API
- Pass private key imports by reference, split traditional EC
  normalization and PEM payload decoding into their own stages
- Move key material unit tests into sibling files

Part of #277
- Pass invocations by reference and split command key selection,
  recipient, template and decryption stages into named steps
- Move the remaining inline CLI unit tests into sibling files and load
  the shared argument module so its tests resolve the same way
- Split oversized CLI integration tests into fixture and check helpers,
  sharing RSA store, recipient template and success-run builders
- Build signature templates in one pass in the benchmark support and
  separate benchmark argument parsing from measurement
- Replace FromIterator calls the MSRV toolchain reports

Part of #277
- Remove the scoped XML-kernel, XSLT and security pedantic gate scripts;
  the workspace lint table now carries clippy::pedantic for every member
- Lint the default-feature workspace and the MSRV XSLT graph, and add
  library-only xmldsig, xmlenc and xslt minimal graphs that keep the
  former gates' separately resolved feature sets
- Lint the alloc-only XML-input crate instead of only checking it
- Allow clippy::large_stack_arrays on MSRV lint only: clippy 1.92
  reports the libtest descriptor array without a span
  (rust-lang/rust-clippy#13774); stable lint keeps the check

Closes #277
DOM and C14N graphs have no XML Security operation, so their parse work
budget cannot exist. An uninhabited field states that in the type, and
the charge path stays one unconditional call instead of a cfg-split
helper that pedantic flags as an always-Ok wrapper.
The feature-contract job runs check-features.sh on 1.92, whose clippy
reports the libtest descriptor array of a large test crate as a
spanless large_stack_arrays finding (rust-lang/rust-clippy#13774, fixed
by rust-lang/rust-clippy#16347). The runner now relaxes that one lint
only for clippy before 1.94, as the CI test blocks already do, and keeps
it for current clippy. The runner test pins both sides with a stub
rustc.
@polaz
polaz force-pushed the refactor/#277-tooling-pedantic branch from e936b97 to bc2d6d7 Compare October 25, 2026 08:45
@polaz
polaz merged commit b35ea31 into main Oct 25, 2026
30 checks passed
@polaz
polaz deleted the refactor/#277-tooling-pedantic branch October 25, 2026 11:36
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.

refactor: qualify configuration and tooling lint

1 participant