One API keySecretA key or password that opens a service in your name. It belongs in an environment variable on the server, and never enters the repository, the conversation or files the model writes. in the wrong place can cost you a surprise bill or your users' data. Modern toolsTool useA model asking to run a function the app describes to it, such as a search or reading a file, with structured arguments. The app runs it and returns the result; the model runs nothing itself. make the mistake easier: a model that reads your files, a frameworkFrameworkA ready structure for building a kind of app, deciding for you how files are organised and how a request flows, while you fill in the parts, such as Next.js for the web. It differs from a library: you call a library, a framework calls your code. that ships some variables to the browser, a public repositoryRepositoryThe project's folder with its full history in Git: code, docs and settings. It can be on your machine alone or on a platform such as GitHub, public for everyone to see or private. one click away. A few rules keep secrets where they belong.
1. A secret lives in an environment variable
Never in code, not even "for now":
const key = process.env.PAYMENT_API_KEY;Locally, values go in .env.local; in hosting, in the project settings; in the repository, a .env.example with names and no values.
2. .env never enters the repository
.env
.env.*
!.env.exampleWhat entered gitGitA system that keeps the whole history of your project's files: every change, who made it and when, and lets you go back to any point and work on parallel branches. Save your work in it before asking an agent for big changes. history once stays there even if a later commitCommitA saved snapshot of changes in a repository, with a message explaining what changed and why. Make each commit one understandable change, so it is easy to review and to undo on its own. deletes it. A committed secret is an exposed secret.
3. What reaches the browser is public
In Next.jsNext.jsA framework built on React that brings front end and back end into one project: pages rendered on the server, API routes, and routing by folders. Talqeen itself is built with it. every variable starting with NEXT_PUBLIC_ is shipped to the browser. Never put a secret there; requests that need a key go through your serverServerA computer or program that waits for requests and answers them, such as a web server returning pages or a database server. What runs on the server the user cannot see, so secrets and checks belong there.. Talqeen itself works this way: the browser never talks to the databaseDatabaseA program that keeps an app's data organised and lasting, and lets it be searched and changed safely even with many users at once. The best-known kind is relational, spoken to in SQL, such as Postgres. directly, and the service key that bypasses row rules is read in one server file only.
4. Stop your tool from reading secrets
{
"permissions": {
"deny": ["Read(./.env)", "Read(./.env.*)", "Bash(printenv:*)"]
}
}The Talqeen kit always writes these rules, plus key files such as *.pem. What the model does not read it cannot leak.
5. Do not paste a secret into the conversation
Copy the error message only, with the key replaced by REDACTED.
If a key leaks
Revoke it first, create a new one, check the logs for use of the old one, and close the path it leaked through. Deleting it from the repository is not enough: revoking is what protects you. Give every key the least scope its job needs.