fix(cli): enforce owner-only config ACLs on Windows#9764
Open
tianmind-studio wants to merge 1 commit into
Open
fix(cli): enforce owner-only config ACLs on Windows#9764tianmind-studio wants to merge 1 commit into
tianmind-studio wants to merge 1 commit into
Conversation
Collaborator
|
Thanks @tianmind-studio — this is a genuinely well-built hardening for Windows credential files. A few observations for a maintainer before this merges. What I like
Why I'm flagging for human review rather than approving
Suggested next steps
Marking this for security/maintainer review. Positive direction overall — just needs a Windows-confirmed human sign-off before merge. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
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.
Summary
0600path while creating Windows config files with a protected owner-rights DACLCreateFileWat file creation, deny handle sharing during serialization, and read it back before writing credentialsWhy
omi-clistores API keys, OAuth tokens, and local bearer tokens inconfig.toml, and its documented contract says that file is owner-only. On Windows, Python accepts the0o600argument andumask, but the resulting mode is0o666; those POSIX controls do not establish a Windows ACL.The new helper uses only the standard library. Its protected DACL grants file-all access to the object owner and permits no inherited ACEs. It also verifies the effective DACL through the open handle before
tomli_wwrites the first credential byte. Unsupported filesystems or altered descriptors therefore fail without leaving a credential file behind.Testing
test_config.pyhad2 failed, 12 passed(0o666 != 0o600)15 passed116 passed, 6 deselected--platform linux: passedomi_cli/_secure_file.pygit diff --check: passedThe broader Windows CLI baseline also exposes separate pre-existing error-rendering and OpenAPI locale failures; this PR does not change those paths.