cuprated: add private file permissions for Windows - #606
Open
redsh4de wants to merge 1 commit into
Open
Conversation
redsh4de
force-pushed
the
feat/win-private-perms
branch
from
May 5, 2026 19:10
78903be to
57535e2
Compare
redsh4de
force-pushed
the
feat/win-private-perms
branch
from
May 12, 2026 20:07
b591ef5 to
4d9a3c6
Compare
redsh4de
force-pushed
the
feat/win-private-perms
branch
from
May 20, 2026 11:23
4d9a3c6 to
e5b80e4
Compare
redsh4de
force-pushed
the
feat/win-private-perms
branch
from
June 3, 2026 05:24
e5b80e4 to
aa535c4
Compare
redsh4de
force-pushed
the
feat/win-private-perms
branch
from
June 15, 2026 06:26
aa535c4 to
e8a6538
Compare
redsh4de
force-pushed
the
feat/win-private-perms
branch
from
September 2, 2026 18:18
e8a6538 to
8475251
Compare
SyntheticBird45
left a comment
Member
There was a problem hiding this comment.
I'll review the windows API usage more in details tomorrow. Nothing else to comment outside of it.
redsh4de
force-pushed
the
feat/win-private-perms
branch
from
September 5, 2026 22:42
8475251 to
7d26fbf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes #551 by adding the Windows equivalent.
Why
In cases where the data paths were outside of the current user's profile directory, files in cuprate's data directories could be read by other users on the same Windows machine.
Where
helperfs/windows_perms.rs- Looks up the current user's ID, builds the ACL, makes it the default for files cuprate creates, and makes each folder it creates with it.fs.rs-set_private_global_file_permisisonsis now Unix-only (Windows doesn't really have a 1-to-1 global equivalent). A new Windows-onlyset_private_directory_permissions(roots: &[&Path])passes the folder paths towindows_perms::apply. Each function only exists on the OS that needs itCargo.toml- added new create features fromwindowsthat are needed for this to workcupratedconfig.rs- newConfig::writable_directories()returns the directories cuprate writes to. On Windows only,read_config_and_argscallsset_private_directory_permissionsonce the paths are resolved. This also gave a opportunity to rewritecheck_dir_permissionsto loop over the new helper.main.rs-set_private_global_file_permissionscall is now Unix-onlyHow
The SDDL string is
O:{user}D:P(A;OICI;FA;;;{user})(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(syntax reference):O:{user}D:P(A;OICI;FA;;;{user})(A;OICI;FA;;;SY)SYSTEM(A;OICI;FA;;;BA)BUILTIN\AdministratorsPrecedent: Win32-OpenSSH
Example with a path like

D:\Cuprate: