Skip to content

Don't require --unstable for Deno.getUid() and Deno.getGid() #2791

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

Closed
martin-braun opened this issue Oct 18, 2022 · 2 comments · Fixed by denoland/deno#16424
Closed

Don't require --unstable for Deno.getUid() and Deno.getGid() #2791

martin-braun opened this issue Oct 18, 2022 · 2 comments · Fixed by denoland/deno#16424

Comments

@martin-braun
Copy link
Contributor

martin-braun commented Oct 18, 2022

Deno.getUid() and Deno.getGid() should just return null on Windows systems, but not require the --unstable keyword, so they can be used in deno_std for permission checks that are only necessary on POSIX systems.

This issue blocks #2785

Context:

Windows will raise a Deno.errors.PermissionDenied when calling Deno.stat on a directory/file that the user cannot read. However, on POSIX systems Deno.stat will success nonetheless. To avoid opening the file when trying to verify permissions, one could compare Deno.getUid() and Deno.getGid() to FileInfo.uid and FileInfo.gid to validate ownership of a given directory/file to further validate permissions by parsing FileInfo.mode accordantly.

FileInfo.mode returns null and Deno.chmod is not working on Windows, but those APIs requires no --unstable flag. So should Deno.getUid() and Deno.getGid() in my opinion.

@iuioiua
Copy link
Contributor

iuioiua commented Nov 3, 2022

I believe this is an issue for the main repo and not deno_std.

@cjihrig
Copy link
Contributor

cjihrig commented Nov 3, 2022

FYI - denoland/deno#16424 (the APIs were renamed to uid() and gid() in the last release)

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 a pull request may close this issue.

3 participants