From ece2a3de5b19588160634452638aa656218853c5 Mon Sep 17 00:00:00 2001 From: Evan <96965321+0xIchigo@users.noreply.github.com> Date: Mon, 14 Aug 2023 20:11:12 -0400 Subject: fix(ext/net): implement a graceful error on an invalid SSL certificate (#20157) The goal of this PR is to address issue #19520 where Deno panics when encountering an invalid SSL certificate. This PR achieves that goal by removing an `.expect()` statement and implementing a match statement on `tsl_config` (found in [/ext/net/ops_tsl.rs](https://github.com/denoland/deno/blob/e071382768fa57b5288a6a5ba90e73bf5870b169/ext/net/ops_tls.rs#L1058)) to check whether the desired configuration is valid --------- Co-authored-by: Matt Mastracci --- cli/tests/testdata/tls/invalid.crt | 3 +++ cli/tests/testdata/tls/invalid.key | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 cli/tests/testdata/tls/invalid.crt create mode 100644 cli/tests/testdata/tls/invalid.key (limited to 'cli/tests/testdata') diff --git a/cli/tests/testdata/tls/invalid.crt b/cli/tests/testdata/tls/invalid.crt new file mode 100644 index 000000000..688e32ede --- /dev/null +++ b/cli/tests/testdata/tls/invalid.crt @@ -0,0 +1,3 @@ +-----BEGIN CERTIFICATE----- +INVALID +-----END CERTIFICATE----- diff --git a/cli/tests/testdata/tls/invalid.key b/cli/tests/testdata/tls/invalid.key new file mode 100644 index 000000000..b57bc2f68 --- /dev/null +++ b/cli/tests/testdata/tls/invalid.key @@ -0,0 +1,3 @@ +-----BEGIN PRIVATE KEY----- +INVALID +-----END PRIVATE KEY----- -- cgit v1.2.3