Skip to content

fix(ext/tls): avoid panic for mismatched client certificate and key - #36457

Merged
bartlomieju merged 1 commit into
denoland:mainfrom
maoyouaa:mao/fix-tls-key-cert-mismatch-panic
Aug 7, 2026
Merged

fix(ext/tls): avoid panic for mismatched client certificate and key#36457
bartlomieju merged 1 commit into
denoland:mainfrom
maoyouaa:mao/fix-tls-key-cert-mismatch-panic

Conversation

@maoyouaa

@maoyouaa maoyouaa commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Propagate the rustls validation error when a client certificate and private key do not match instead of panicking through .expect().
  • Apply the error propagation to both client configuration paths in create_client_config().
  • Add a regression test verifying that Deno.createHttpClient() throws a TypeError for mismatched credentials.

The validation error is now surfaced through the existing TlsError conversion path:

TypeError: keys may not be consistent: KeyMismatch

This prevents invalid user-provided TLS credentials from terminating the Deno process.

Testing

  • Reproduced the original panic with the official Deno 2.9.4 Windows binary.
  • Verified that the patched runtime returns TypeError: keys may not be consistent: KeyMismatch without printing the Deno panic banner.
  • Targeted runtime regression test: 1 passed, 139 filtered out.
  • cargo check -p deno_tls --features deno_core/quickjs
  • cargo test -p deno_tls --features deno_core/quickjs — 3 passed; 1 doctest ignored.
  • cargo clippy -p deno_tls --features deno_core/quickjs -- -D warnings
  • cargo fmt --all -- --check
  • Targeted dprint check for tests/unit/fetch_test.ts
  • Deno lint for tests/unit/fetch_test.ts
  • git diff --check

A full default V8-based Windows build could not be completed because Windows Developer Mode is disabled, preventing rusty_v8 from creating its required symbolic links.

AI assistance: OpenAI Codex was used only to review the patch and test results.

Fixes #36380

@deno-cla-assistant

deno-cla-assistant Bot commented Aug 6, 2026

Copy link
Copy Markdown

Deno Individual Contributor License Agreement

All contributors have signed the CLA. Thank you!

Re-run CLA check


This is an automated message from CLA Assistant

@maoyouaa
maoyouaa force-pushed the mao/fix-tls-key-cert-mismatch-panic branch from 2cf954e to 2922cc7 Compare August 6, 2026 15:38
@maoyouaa
maoyouaa marked this pull request as ready for review August 6, 2026 15:39

@bartlomieju bartlomieju left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@bartlomieju bartlomieju changed the title fix(tls): avoid panic for mismatched client certificate and key fix(ext/tls): avoid panic for mismatched client certificate and key Aug 7, 2026
@bartlomieju
bartlomieju enabled auto-merge (squash) August 7, 2026 07:24
@bartlomieju
bartlomieju merged commit 5211303 into denoland:main Aug 7, 2026
137 of 173 checks passed
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.

Panic when using nonmatching TLS key/certificate combination

2 participants