Skip to content

CLI: skip setting file mode for Windows #1591

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

Merged
merged 1 commit into from
Dec 26, 2024

Conversation

svix-onelson
Copy link
Contributor

When the CLI creates a config file for the user, we use 600 unix permissions to ensure only the user can read/write the file.

Setting the file mode like this is only possible like this on unix-like systems so this breaks the build for Windows.

This diff splits the opening of the file into platform-specific functions, one for windows which doesn't set the file mode. The unix flavored function does what we had in the first place.

In https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfile2 there's mention of ACL being inherited from the parent directory. My understanding is %APPDATA% should only be accessible by the named user, so I'm hoping the defaults are correct for our use case.

When the CLI creates a config file for the user, we use `600` unix
permissions to ensure only the user can read/write the file.

Setting the file mode like this is only possible like this on unix-like
systems so this breaks the build for Windows.

This diff splits the opening of the file into platform-specific
functions, one for `windows` which doesn't set the file mode.
The `unix` flavored function does what we had in the first place.

In <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfile2>
there's mention of ACL being inherited from the parent directory. My
understanding is `%APPDATA%` should only be accessible by the named
user, so I'm hoping the defaults are correct for our use case.
@svix-onelson svix-onelson force-pushed the onelson/cli-skip-file-mode-windows branch from dd1a145 to 894985e Compare December 26, 2024 20:46
@svix-onelson svix-onelson marked this pull request as ready for review December 26, 2024 20:47
@svix-onelson svix-onelson requested a review from a team as a code owner December 26, 2024 20:47
@svix-onelson svix-onelson merged commit fd0a9c0 into main Dec 26, 2024
4 checks passed
@svix-onelson svix-onelson deleted the onelson/cli-skip-file-mode-windows branch December 26, 2024 21:36
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.

2 participants