Skip to content

Commit

Permalink
Make unix sockets require allow-write (#4939)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacasonato authored Apr 27, 2020
1 parent a1974cb commit 95a0885
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/js/lib.deno.ns.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1919,7 +1919,7 @@ declare namespace Deno {
*
* const listener = Deno.listen({ address: "/foo/bar.sock", transport: "unix" })
*
* Requires `allow-read` permission. */
* Requires `allow-read` and `allow-write` permission. */
export function listen(
options: UnixListenOptions & { transport: "unix" }
): Listener;
Expand All @@ -1940,7 +1940,7 @@ declare namespace Deno {
*
* const listener = Deno.listen({ address: "/foo/bar.sock", transport: "unixpacket" })
*
* Requires `allow-read` permission. */
* Requires `allow-read` and `allow-write` permission. */
export function listen(
options: UnixListenOptions & { transport: "unixpacket" }
): DatagramConn;
Expand Down
1 change: 1 addition & 0 deletions cli/ops/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ fn op_listen(
} if transport == "unix" || transport == "unixpacket" => {
let address_path = net_unix::Path::new(&args.address);
state.check_read(&address_path)?;
state.check_write(&address_path)?;
let (rid, local_addr) = if transport == "unix" {
net_unix::listen_unix(&mut resource_table, &address_path)?
} else {
Expand Down

0 comments on commit 95a0885

Please sign in to comment.