Skip to content

feat(xmldsig): build x509 certificate chains#61

Open
polaz wants to merge 3 commits into
mainfrom
feat/#60-x509-chain-building
Open

feat(xmldsig): build x509 certificate chains#61
polaz wants to merge 3 commits into
mainfrom
feat/#60-x509-chain-building

Conversation

@polaz

@polaz polaz commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Implement P2-004 certificate chain building for parsed X509Data certificates.
  • Add certificate serial metadata and ordered chain indexes starting at the selected signing certificate.
  • Select signing certificate via X509SubjectName, X509IssuerSerial, or X509SKI hints, with deterministic ambiguity errors.
  • Checked dependency updates in this PR scope: cargo update produced no tracked diff because Cargo.lock is untracked, but the workspace was verified against the resolved updated graph.

Testing

  • cargo fmt -- --check
  • cargo check --workspace
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo nextest run --workspace
  • cargo test --doc --workspace
  • cargo build --workspace

Closes #60

- Order embedded X509Data certificates from signing cert to issuer chain
- Select signing cert by SubjectName, IssuerSerial, or SKI hints when present
- Preserve serial metadata for later chain verification
- Add regression coverage for unordered chains and ambiguity

Dependency update check: cargo update produced no tracked diff because Cargo.lock is untracked; workspace verified against the resolved updated graph.

Closes #60
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

More reviews will be available in 22 minutes and 45 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8704669a-216e-49e0-82ab-c9d84b308615

📥 Commits

Reviewing files that changed from the base of the PR and between 4fb8503 and 199a7c1.

📒 Files selected for processing (1)
  • src/xmldsig/parse.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#60-x509-chain-building

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR implements X.509 certificate chain building on top of the already-parsed X509Data certificates. It adds certificate_chain (an ordered index vector starting at the signing cert) and serial_number/serial_number_hex fields to ParsedX509Certificate, a decimal-to-hex serial converter for XMLDSig X509SerialNumber values, and signing-certificate selection via X509SubjectName, X509IssuerSerial, and X509SKI hints with deterministic ambiguity errors.

  • Chain building walks issuer DNs, rejects cycles and depths > MAX_X509_CHAIN_DEPTH, and falls back to leaf detection when no explicit hint is present.
  • The three issues raised in previous rounds — decimal-vs-hex serial mismatch, depth off-by-one, and DER sign-extension leading zero — are all addressed with targeted fixes and regression tests.

Confidence Score: 5/5

Safe to merge — the chain-building and signing-cert selection logic is sound, and all three issues from previous review rounds have been correctly resolved with regression tests.

The core algorithms (decimal-to-hex serial conversion, DER sign-extension stripping, leaf detection, cycle detection, depth guard) have been reviewed and are correct. The only remaining item is a provably unreachable top-of-loop depth check that became dead code after the pre-push guard was introduced — it cannot cause incorrect behavior.

No files require special attention.

Important Files Changed

Filename Overview
src/xmldsig/parse.rs Adds X.509 certificate chain building, signing-cert selection via Subject/IssuerSerial/SKI hints, serial number fields with DER sign-extension stripping, and a decimal-to-hex serial converter. Previously flagged issues (hex vs. decimal serial matching, depth off-by-one, DER leading zero) are all resolved. One unreachable top-of-loop depth guard remains as dead code.

Reviews (3): Last reviewed commit: "fix(xmldsig): canonicalize x509 serial v..." | Re-trigger Greptile

Comment thread src/xmldsig/parse.rs Outdated
Comment thread src/xmldsig/parse.rs
Comment thread src/xmldsig/parse.rs Outdated
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: build X.509 certificate chains

1 participant