Skip to content

feat(dsig): fund scoped reference queries - #235

Merged
polaz merged 5 commits into
mainfrom
feat/#230-current-reference-work
Oct 17, 2026
Merged

polaz merged 5 commits into
mainfrom
feat/#230-current-reference-work

Conversation

@polaz

@polaz polaz commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Scoped current-work queries for authenticated signature selection, original facts, Reference/Manifest catalogues, URI resolution and replay, without repeating verification.
  • Every query-funded step admits its work and capacity on the current execution, including the diagnostics it returns.

Changes

  • Carry current admission through parser/DOM storage, transform parameters, node sets, XPath/OPC and binary/XML canonicalization paths, preserving the original document identity, provider, policy allowances and typed terminal causes.
  • Replay charges Reference and timestamp-method text by byte length; URI, transform, policy, Reference layout and timestamp-method diagnostics stay charged to the query until the error is dropped, and oversized diagnostics are refused before copying.
  • Consume published primitives 0.6.2 and ship reproducible, checksum-verified maintained roxmltree/xmloxide kernels with their notices and benchmark adapters.

Testing

Workspace tests (MSRV, FIPS/xmloxide, all-features with isolated SoftHSM and the xmlsec1 oracle), Clippy with warnings denied, formatting, doctests, alloc-only/thumb/WASM builds and WASM C14N execution.

Closes #230

Fund selection, original facts, catalogue inspection, URI resolution and replay from the supplied current execution while preserving original identity, policy, provider and terminal causes.

Carry admission through parser/DOM storage, transform parameters, XPath node sets and evaluator workspaces, OPC and binary/XML canonicalization. Use published primitives 0.6.2 ownership transfers and maintain checksum-verified parser kernels with their notices and CI checks.

Closes #230
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 108 files, which is 8 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
  • Configuration used: Repository: structured-world/xml-sec/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f390ba7a-025f-4611-9e54-a1f5ad695e54
📥 Commits

Reviewing files that changed from the base of the PR and between 674509b and 6d14a5f.

📒 Files selected for processing: 108
  • .github/workflows/ci.yml
  • AGENTS.md
  • Cargo.toml
  • LICENSE-THIRD-PARTY
  • README.md
  • crates/xml-sec-xslt/src/xpath.rs
  • crates/xml-sec-xslt/tests/engine.rs
  • docs/xml-backend-patches.md
  • docs/xmldsig.md
  • scripts/import-xml-backends.sh
  • scripts/patches/roxmltree-0.21.1.patch
  • scripts/patches/xmloxide-0.5.0.patch
  • scripts/xml-kernel-examples.pl
  • src/c14n/mod.rs
  • src/c14n/ns_common.rs
  • src/c14n/ns_exclusive.rs
  • src/c14n/ns_inclusive.rs
  • src/c14n/prefix.rs
  • src/c14n/scratch.rs
  • src/c14n/serialize.rs
  • src/c14n/xml_base.rs
  • src/document.rs
  • src/encoding.rs
  • src/hard_limits.rs
  • src/hard_limits/xpath.rs
  • src/lib.rs
  • src/parser_roxmltree/LICENSE-APACHE
  • src/parser_roxmltree/LICENSE-MIT
  • src/parser_roxmltree/README.md
  • src/parser_roxmltree/documentation_tests.rs
  • src/parser_roxmltree/lib.rs
  • src/parser_roxmltree/parse.rs
  • src/parser_roxmltree/tokenizer.rs
  • src/parser_roxmltree/tokenizer_tests.rs
  • src/parser_xmloxide/LICENSE
  • src/parser_xmloxide/README.md
  • src/parser_xmloxide/documentation_tests.rs
  • src/parser_xmloxide/encoding/mod.rs
  • src/parser_xmloxide/error/mod.rs
  • src/parser_xmloxide/lib.rs
  • src/parser_xmloxide/parser/input.rs
  • src/parser_xmloxide/parser/mod.rs
  • src/parser_xmloxide/parser/push.rs
  • src/parser_xmloxide/parser/xml.rs
  • src/parser_xmloxide/serial/mod.rs
  • src/parser_xmloxide/serial/xml.rs
  • src/parser_xmloxide/tree/mod.rs
  • src/parser_xmloxide/tree/node.rs
  • src/parser_xmloxide/validation/dtd.rs
  • src/parser_xmloxide/validation/mod.rs
  • src/sxd_document/dom_no_unsafe.rs
  • src/sxd_document/dom_no_unsafe/current.rs
  • src/sxd_document/lazy_hash_map.rs
  • src/sxd_document/lib.rs
  • src/sxd_document/namespace_storage.rs
  • src/sxd_document/raw_no_unsafe.rs
  • src/sxd_document/raw_no_unsafe/current.rs
  • src/sxd_document/storage.rs
  • src/sxd_document/string_pool_no_unsafe.rs
  • src/sxd_xpath/arena.rs
  • src/sxd_xpath/axis.rs
  • src/sxd_xpath/context.rs
  • src/sxd_xpath/expression.rs
  • src/sxd_xpath/function.rs
  • src/sxd_xpath/function/core.rs
  • src/sxd_xpath/grammar.rs
  • src/sxd_xpath/lib.rs
  • src/sxd_xpath/node_test.rs
  • src/sxd_xpath/nodeset.rs
  • src/sxd_xpath/nodeset/storage.rs
  • src/sxd_xpath/parser.rs
  • src/sxd_xpath/runtime.rs
  • src/sxd_xpath/token.rs
  • src/sxd_xpath/tokenizer.rs
  • src/xml.rs
  • src/xml/dom/benchmark.rs
  • src/xml/dom/differential.rs
  • src/xml/dom/mod.rs
  • src/xml/dom/preflight.rs
  • src/xml/dom/roxmltree.rs
  • src/xml/dom/storage.rs
  • src/xml/dom/storage/lexical.rs
  • src/xml/dom/storage/names.rs
  • src/xml/dom/tree.rs
  • src/xml/dom/tree/comparison.rs
  • src/xml/dom/xmloxide.rs
  • src/xml_input/lexical.rs
  • src/xml_input/lexical/storage.rs
  • src/xml_input/shared.rs
  • src/xmldsig/parse.rs
  • src/xmldsig/transforms.rs
  • src/xmldsig/transforms/parameters.rs
  • src/xmldsig/transforms/relationship.rs
  • src/xmldsig/transforms/source.rs
  • src/xmldsig/types.rs
  • src/xmldsig/types/projection.rs
  • src/xmldsig/uri.rs
  • src/xmldsig/verify.rs
  • src/xmldsig/verify/session.rs
  • src/xmldsig/verify/session/hash_uses.rs
  • src/xmldsig/verify/session/key_receipt.rs
  • src/xmldsig/xpath.rs
  • src/xmldsig/xpath/mirror.rs
  • src/xmldsig/xpath/source.rs
  • src/xmldsig/xpath/storage.rs
  • tests/authenticated_reference_replay.rs
  • tools/xmlsec1/Cargo.toml
  • vendor/sxd-document-no-unsafe/Cargo.toml

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 17, 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-17T21:02:22.705571Z 6d14a5f 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.

@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: db7fdf900c

ℹ️ 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/xmldsig/uri.rs Outdated
@greptile-apps

greptile-apps Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Critical impact] No outstanding findings require changes before merging.

Summary

This PR lets authenticated signature queries use separately bounded work without repeating verification.

  • Authenticated signature references can be inspected and replayed with a separate current work account.
  • The package ships maintained roxmltree and xmloxide XML parser kernels.

No new actionable issues were found. No outstanding merge blockers were identified. This review checked code paths; it did not run tests.

Reviews (5) · Last reviewed commit: "fix(dsig): fund the XPath evaluation pre..." · Reviewed by Greptile

Comment thread src/xmldsig/uri.rs Outdated
Keep missing-ID and unsupported-URI diagnostics funded by current work for their full lifetime. Preserve unsupported resolution dispositions and use allocation-free malformed-fragment errors.

Make exact Base64 work qualification independent of randomized multi-key hash probes without weakening its boundary assertions.

@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: 25c66d52ed

ℹ️ 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/xmldsig/parse.rs
Comment thread src/xmldsig/parse.rs
- Charge every Reference text node by its byte length before the
  mixed-content scan, so one large whitespace node costs its bytes
  instead of a single child.
- Build replayed layout diagnostics (wrong, trailing and mixed-content
  elements) through the query storage; the attacker-sized element name
  stays charged until the error is dropped.
- Regression tests drive both cases through with_query and
  replay_reference.

@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: 66ff11c8f0

ℹ️ 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/xmldsig/verify/session.rs Outdated
Comment thread src/xmldsig/verify/session.rs
Comment thread src/c14n/ns_exclusive.rs
- Build a transform-allowlist rejection during replay in the current
  query's storage (DsigError::AccountedPolicyAlgorithm), so the
  attacker-sized URI stays charged until the error is dropped; the
  timestamp method URI is charged and checked the same way.
- Parse the timestamp CanonicalizationMethod through the query storage:
  every text node is charged by length before the whitespace scan, and
  element, parameter and unsupported-algorithm diagnostics are owned by
  the query (ParseError::AccountedUnsupportedAlgorithm).
- Drop the unfunded declaration scan in subset Exclusive C14N: a
  selected prefix whose parent binding is unchanged can never already be
  declared, so the search was redundant; a debug assertion keeps the
  invariant checked.
- Regression tests drive the allowlist rejection, the timestamp
  whitespace charge and the timestamp diagnostic through with_query and
  replay_reference. The C14N change removes work without changing
  output and is covered by the existing subset canonicalization tests.

@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: 96ff717fdf

ℹ️ 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/xmldsig/xpath.rs
- The evaluation-work estimate now charges its full source scan to the
  current execution and keeps its per-predicate stacks in that
  execution's storage, so nested predicates in an authenticated
  expression no longer grow unaccounted vectors; the string-scan count
  pass is charged the same way before it runs.
- A unit test checks that the estimate pays for its scan and that its
  stacks are refused when the current account has no capacity.
- The exact-work preflight test no longer looks up an element name
  that misses a non-empty dictionary: such a miss compares keys only on
  a randomly seeded tag collision, which made two runs differ by one
  comparison in rare CI runs.
@polaz
polaz merged commit 3785b0d into main Oct 17, 2026
44 checks passed
@polaz
polaz deleted the feat/#230-current-reference-work branch October 17, 2026 21:17
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.

feat: fund reference continuations with current work

1 participant