summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorAleksei Kosyrev <albnnc@gmail.com>2022-05-18 14:32:12 +0300
committerGitHub <noreply@github.com>2022-05-18 13:32:12 +0200
commit037466e9cdec913d0f146532fde28b26093267f1 (patch)
treec30c4aea060be94e3fcbc24b6723327e4b84379c /cli/tests
parent4d8261070095e49de68ca21ac3b564887039bd24 (diff)
fix(ext/tls): ability to ignore IP-address certificate errors (#14610)
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/mod.rs6
-rw-r--r--cli/tests/testdata/ip_address_unsafe_ssl.ts2
-rw-r--r--cli/tests/testdata/ip_address_unsafe_ssl.ts.out2
-rw-r--r--cli/tests/unit/tls_test.ts11
4 files changed, 11 insertions, 10 deletions
diff --git a/cli/tests/integration/mod.rs b/cli/tests/integration/mod.rs
index 7acd92661..7de441874 100644
--- a/cli/tests/integration/mod.rs
+++ b/cli/tests/integration/mod.rs
@@ -523,6 +523,12 @@ itest!(deno_land_unsafe_ssl {
output: "deno_land_unsafe_ssl.ts.out",
});
+itest!(ip_address_unsafe_ssl {
+ args:
+ "run --quiet --reload --allow-net --unsafely-ignore-certificate-errors=1.1.1.1 ip_address_unsafe_ssl.ts",
+ output: "ip_address_unsafe_ssl.ts.out",
+});
+
itest!(localhost_unsafe_ssl {
args:
"run --quiet --reload --allow-net --unsafely-ignore-certificate-errors=deno.land cafile_url_imports.ts",
diff --git a/cli/tests/testdata/ip_address_unsafe_ssl.ts b/cli/tests/testdata/ip_address_unsafe_ssl.ts
new file mode 100644
index 000000000..a3268888f
--- /dev/null
+++ b/cli/tests/testdata/ip_address_unsafe_ssl.ts
@@ -0,0 +1,2 @@
+const r = await fetch("https://1.1.1.1");
+console.log(r.status);
diff --git a/cli/tests/testdata/ip_address_unsafe_ssl.ts.out b/cli/tests/testdata/ip_address_unsafe_ssl.ts.out
new file mode 100644
index 000000000..d4ebb2617
--- /dev/null
+++ b/cli/tests/testdata/ip_address_unsafe_ssl.ts.out
@@ -0,0 +1,2 @@
+DANGER: TLS certificate validation is disabled for: 1.1.1.1
+200
diff --git a/cli/tests/unit/tls_test.ts b/cli/tests/unit/tls_test.ts
index 07ffcd487..05eced64e 100644
--- a/cli/tests/unit/tls_test.ts
+++ b/cli/tests/unit/tls_test.ts
@@ -36,18 +36,9 @@ Deno.test({ permissions: { net: false } }, async function connectTLSNoPerm() {
Deno.test(
{ permissions: { read: true, net: true } },
async function connectTLSInvalidHost() {
- const listener = await Deno.listenTls({
- hostname: "localhost",
- port: 3567,
- certFile: "cli/tests/testdata/tls/localhost.crt",
- keyFile: "cli/tests/testdata/tls/localhost.key",
- });
-
await assertRejects(async () => {
- await Deno.connectTls({ hostname: "127.0.0.1", port: 3567 });
+ await Deno.connectTls({ hostname: "256.0.0.0", port: 3567 });
}, TypeError);
-
- listener.close();
},
);