Skip to content

test(x509): guard against multi-curve signature verification fallback - #44

Open
schenkty wants to merge 3 commits into
mainfrom
cursor/remove-weak-cert-verification-1178
Open

schenkty wants to merge 3 commits into
mainfrom
cursor/remove-weak-cert-verification-1178

Conversation

@schenkty

@schenkty schenkty commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Problem

Issue #28: remove the weak multi-curve try-all certificate signature verifier. The curve is always known from the issuer SPKI.

Fixes #28.

Status

The weak helper was already removed on main in #30 (verify_ecdsa_declared_curve only). This PR adds a regression test so a try-all fallback cannot return.

Tests

test_no_multi_curve_verification_fallback — correct curve verifies; wrong-curve declaration and other-curve keys are rejected with no fallback.


Note

Low Risk
Adds tests only; no changes to certificate verification logic in application code.

Overview

Summary

Issue #28: ECDSA cert verification must use only the curve in the issuer SPKI, not a try-all-curves fallback. That weak path was removed on main (#30). This PR adds a regression test so that behavior cannot return unnoticed.

Related Issues

Fixes #28

Changes Made

  • No change to runtime certificate verification; behavior already rejects wrong-curve SPKI and unrelated keys without multi-curve fallback
  • New integration test covers secp256r1 and secp256k1 self-signed certs: correct SPKI verifies; mismatched curve declaration and genuine other-curve keys do not

Testing

From repo root, run the x509 builder tests (or test_no_multi_curve_verification_fallback specifically). Expect pass: own-curve verification succeeds; cross-curve and mis-declared SPKI cases fail verification.

Breaking Changes

None

Reviewed by Cursor Bugbot for commit 1b6751b. Configure here.

Add a dedicated regression test that locks in the invariant that ECDSA
certificate signatures are verified only against the curve declared in the
issuer's SubjectPublicKeyInfo, never falling back to trying other curves.

The weak multi-try verifier (verify_ecdsa_signature) was already removed in
favour of verify_ecdsa_declared_curve; this test proves the try-all path is
gone in both directions and rejects genuine wrong-curve keys.

Closes #28

Co-authored-by: Ty Schenk <schenkty@users.noreply.github.com>

@larseidsvoll larseidsvoll 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.

Verdict: APPROVE

Test-only regression for #28 after #30 removed the multi-curve try-all verifier. Locks in known-curve-only verification:

  • Happy path: each ECDSA cert verifies under its declared curve
  • Wrong-curve OID on real key bytes must not verify (both directions) — the case the removed helper would accept
  • Unrelated other-curve SPKI rejected (no fallback)

!matches!(..., Ok(true)) is fail-closed (Ok(false) or Err both pass).

Nit (non-blocking): overlaps somewhat with test_ecdsa_verification_requires_declared_curve above; still worth the explicit #28 guard.

Still draft. CI in progress.

Review only — do not bot-merge (Ty lock on node-rs). Humans merge. No @ humans.

@larseidsvoll

Copy link
Copy Markdown

Security look @ 06e9c0db (draft — #28 regression: no multi-curve ECDSA verify fallback).

No security issues found.

  • Diff is test-only; no production change.
  • On main, Certificate::verify_signature still calls verify_ecdsa_declared_curve (OID dispatch secp256r1/secp256k1 only). No multi-try / try-all-curves helper remains.
  • New test locks the invariant: correct-curve OK; wrong-curve declaration (both directions) and unrelated other-curve SPKI must not verify as Ok(true).

No HIGH+. No human @.

Security Audit (cargo audit) failed on a newly published advisory,
RUSTSEC-2026-0285: rustls 0.23.40 accepts TLS 1.3 handshake messages
across encryption level boundaries (fixed in >=0.23.45).

rustls is a transitive dependency (reqwest/hyper-rustls/tokio-rustls/
rustls-platform-verifier). Update the lockfile to rustls 0.23.45, which
also bumps aws-lc-rs/aws-lc-sys and rustls-webpki. Verified the client
crate still builds and 'cargo audit' now passes.

Co-authored-by: Ty Schenk <schenkty@users.noreply.github.com>
@schenkty
schenkty marked this pull request as ready for review September 16, 2026 01:06

@larseidsvoll larseidsvoll 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.

Verdict: APPROVE (re-stamp after #45)

Tip moved for main merge; #44 undrafted. Diff unchanged: test-only #28 multi-curve fallback regression.

Security Audit green. Lint green; Tests still running.

Review only — do not bot-merge. Humans merge. No @ humans.

@sonarqubecloud

Copy link
Copy Markdown

@schenkty
schenkty requested a review from sephynox September 16, 2026 01:35
@larseidsvoll

Copy link
Copy Markdown

Thanks for the APPROVE. Nit acknowledged — some overlap with test_ecdsa_verification_requires_declared_curve is fine; keeping the explicit #28 guard as-is.

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.

Remove verification function which is cryptographically weak

3 participants