-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Conversation
There was a problem hiding this 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
1292e61
to
473bf99
Compare
473bf99
to
4754d51
Compare
There was a problem hiding this 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
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); | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Fixes a brittle test that was identified in denoland#8511 after it was merged.
Fixes #7781