Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli/ops/net): add write permissions for unixpackets datagrams & unix socket #8511

Merged
merged 3 commits into from
Nov 27, 2020

Conversation

wperron
Copy link
Contributor

@wperron wperron commented Nov 26, 2020

Fixes #7781

@wperron wperron changed the title Fix/datagram perms fix(cli/ops/net): add write permissions for unixpackets datagrams & unix socket Nov 26, 2020
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

@wperron the fix looks good. Please add a test case in cli/tests/unit/net_test.ts that verifies PermissionDenied error is thrown

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

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

LGTM - thank you @wperron

@ry ry merged commit 59f10b3 into denoland:master Nov 27, 2020
Comment on lines +71 to +83
try {
const filePath = Deno.makeTempFileSync();
const socket = Deno.listen({
path: filePath,
transport: "unix",
});
assert(socket.addr.transport === "unix");
assertEquals(socket.addr.path, filePath);
socket.close();
} catch (e) {
assert(!!e);
assert(e instanceof Deno.errors.PermissionDenied);
}
Copy link
Member

Choose a reason for hiding this comment

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

@wperron this is a bit brittle - if function doesn't throw test will pass anyway. There's a helper assert called assertThrows that could be used for this purpose.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll open a new PR for that

wperron added a commit to wperron/deno that referenced this pull request Nov 27, 2020
Fixes a brittle test that was identified in denoland#8511 after it was merged.
@wperron wperron deleted the fix/datagram-perms branch January 17, 2021 20:07
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.

--allow-read allows writes to Unix sockets
3 participants