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

Setting the API key as a global environment variable is probably not so safe #2

Open
rikhuijzer opened this issue Mar 8, 2023 · 8 comments

Comments

@rikhuijzer
Copy link

Setting a global environment variable is okayish if you are in a protected environment such as a Docker image on a protected server, but probably not so great when it's a global variable available to the whole user system. Maybe a configuration file or starting Julia in a separate shell with the environment variable set would be better.

@ThatcherC
Copy link
Owner

Thanks! I definitely see the value in keeping the API key somewhere other than an environment variable. Do you think Preferences.jl would be an appropriate solution? I haven't used it before but it looks like it's intended for this kind of thing. I'll give it a go.

@rikhuijzer
Copy link
Author

rikhuijzer commented Mar 9, 2023

Yes or a config file would also help a bit.

The best would probably be allow users to obscure their key like https://rclone.org/commands/rclone_obscure/, but I haven't seen people do that in Julia packages yet so I don't know how

@ThatcherC
Copy link
Owner

The Preferences.jl approach in #4 went pretty well! I do like the idea of obscuring the keys, but I haven't come across a good way to do that yet so I think I'll save that feature for a future PR.

@diegozea
Copy link

Using https://github.com/JuliaCrypto/Nettle.jl to encrypt the API key could be an excellent option.

@rikhuijzer
Copy link
Author

Using https://github.com/JuliaCrypto/Nettle.jl to encrypt the API key could be an excellent option.

But where do you leave the key in a open source repository? Still, encrypting it with some key is better than nothing, I guess.

@diegozea
Copy link

Sorry, I do not fully follow. Why would one store the encrypted API key in an open-source repo rather than in their system?

@rikhuijzer
Copy link
Author

Sorry, I do not fully follow. Why would one store the encrypted API key in an open-source repo rather than in their system?

The idea of encryption is that only people who have the key can read the information. The problem is: Where would ReplGPT.jl leave the key? Everybody can read the source code of ReplGPT.jl. Maybe, on second thought, it is better to not encrypt because then at least a leak can be detected like happened in #8.

@diegozea
Copy link

I see! I was imagining using a password per user to encrypt the key.

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

No branches or pull requests

3 participants