Skip to content
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

keys.json should be chmoded to -rw------- #351

Closed
cbare opened this issue Nov 20, 2023 · 2 comments
Closed

keys.json should be chmoded to -rw------- #351

cbare opened this issue Nov 20, 2023 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@cbare
Copy link

cbare commented Nov 20, 2023

Since this holds credentials maybe adding path.chmod(0o600) would be safer, here:

llm/llm/cli.py

Lines 512 to 515 in df7d248

path = user_dir() / "keys.json"
path.parent.mkdir(parents=True, exist_ok=True)
if not path.exists():
path.write_text(json.dumps(default))

@simonw simonw added the enhancement New feature or request label Jan 26, 2024
@simonw
Copy link
Owner

simonw commented Jan 26, 2024

This is a good idea.

@simonw simonw added this to the 0.13 milestone Jan 26, 2024
@simonw simonw closed this as completed Jan 26, 2024
@simonw
Copy link
Owner

simonw commented Jan 26, 2024

Manually tested this like so:

$ ls -lah ~/Library/Application\ Support/io.datasette.llm/keys.json 
-rw-r--r--  1 simon  staff   822B Dec 14 19:27 /Users/simon/Library/Application Support/io.datasette.llm/keys.json
$ mv ~/Library/Application\ Support/io.datasette.llm/keys.json /tmp  
$ llm keys
No keys found
$ llm keys set openai
Enter key: 
$ ls -lah ~/Library/Application\ Support/io.datasette.llm/keys.json  
-rw-------  1 simon  staff   101B Jan 26 13:23 /Users/simon/Library/Application Support/io.datasette.llm/keys.json

I confirmed that running prompts still works with the 600 permission file.

simonw added a commit that referenced this issue Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants