SafeNote

Secure your secrets with every Jupyter notebook you share

Never write your API keys in your notebook again.

Why do we need SafeNote?

Sharing notebook is very common within a research group, and even with public. It is very important to protect your secret from being used without your intention, especially for those API keys that charge a lot (e.g. OpenAI API Key). SafeNote will inject your variables into environment every time, which means that people never get your secret with your notebook sharing link.

For the future? We are currently planning a SaaS product that helps team reducing the time they need to copy, paste, or type in their environment variables. It will also be delivered with this package if we manage to make it.

Installation

pip install safenote

Usage

import safenote env = safenote.request(keys=['OPENAI_API_KEY', 'SERPER_API_KEY'])

Simple, right?

Then, env variable will contain all values you input while prompting. And all these keys will be populated into os.environ for the usage of other packages (e.g. LangChain).

You can also use variables OPENAI_API_KEY and SERPER_API_KEY directly.

We are still working on the SaaS solution that helps you remember your secret at a safe place and prevents them from being mis-used.

Frequently Asked Questions

Only need one key, and don't like a list?

You can actually pass key argument into the request function!

import safenote safenote.request(key='OPENAI_API_KEY')

Only need to inject into system environment?

Then, you don't actually need the return value.

safenote.request(keys=['OPENAI_API_KEY'])

Don't want to inject into os.environ?

Just set inject_env to False.

env = safenote.request(keys=['OPENAI_API_KEY'], inject_env=False)

Don't want to have global variables assigned?

We currently are relying on global variables for the population of those secrets. Therefore, you are unable to avoid injecting them into global variables at this point. However, this is one of our goals in a sooner future that we will make it more secure, and therefore you will be able to reject to assign global variables from SafeNote.

Contributions

SafeNote is open-sourced on GitHub, and everyone can contribute to it by obeying the contribution rules.