Repository navigation
Conversation
The config file (which can contain OPENAI_API_KEY) and the chat/completion cache directories under the platform temp directory were created with mkdir()/open() using no explicit mode, so under a common umask of 022 the config file ended up 0644 and all directories 0755, letting any other local user read API credentials and cached conversation content. Create the config directory and cache directories as 0700, and the config file as 0600, explicitly chmod'ing after creation since mkdir()/os.open() mode arguments are still subject to the process umask.
This branch has not been deployed
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.
Fixes #805.
The config file (which can contain
OPENAI_API_KEY) and the chat/completion cache directories under the platform temp directory were created withmkdir()/open()using no explicit mode, so under a common umask of 022 the config file ended up 0644 and the directories ended up 0755, letting any other local account on a shared host read API credentials and cached conversations.This creates the config directory and both cache directories as 0700, and the config file as 0600, explicitly
chmod'ing after creation sincemkdir()'s/os.open()'s own mode argument is still subject to the process umask.Verified with a script exercising
Config,Cache, and the same patternChatSessionuses, under umask 022: before the fix, the config file and all three directories were world-readable/traversable (0644/0755); after the fix, all four are owner-only (0600/0700).