// test.ts
console.log(`cert: ${(await Deno.open('./server.cert')).rid}`);
Deno.listenTls({
port: 8888,
hostname: '0.0.0.0',
certFile: './server.cert',
keyFile: './server.key'
});
````
C:\workspace\deno>deno --version
deno 1.0.2
v8 8.4.300
typescript 3.9.2
C:\workspace\deno>deno run --allow-net=0.0.0.0:8888 --allow-read=. test.ts
cert: 3
error: Uncaught PermissionDenied: read access to "./server.cert", run again with the --allow-read flag
at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
at Object.sendSync ($deno$/ops/dispatch_json.ts:72:10)
at Object.listenTls ($deno$/ops/tls.ts:67:10)
at Object.listenTls ($deno$/tls.ts:51:22)
at file:///C:/workspace/deno/test.ts:3:16
C:\workspace\deno>deno run --allow-net=0.0.0.0:8888 --allow-read test.ts
cert: 3
C:\workspace\deno>
```
Also connectTls
Deno.connectTls({
port: 80,
hostname: "127.0.0.1",
certFile: "./server.cert",
});
$ deno run --allow-net --allow-read=. mod.ts
error: Uncaught PermissionDenied: read access to "./server.cert", run again with the --allow-read flag
...
It's because certFile path is not canonicalized before checking for permission. Kinda similar to #5742. I'm gonna make a PR for these two functions.
Resolved by #5642.