| ▲ | Ask HN: Do you trust AI agents with API keys / private keys? | |||||||||||||||||||||||||
| 12 points by devendra116 a day ago | 25 comments | ||||||||||||||||||||||||||
are you ok sharing secrets or api keys to you ai agent via .env? or is there any other tool or mechanism that one use to safegaurd from potential exploit or leaks | ||||||||||||||||||||||||||
| ▲ | saranshrana 31 minutes ago | parent | next [-] | |||||||||||||||||||||||||
Honestly, best solution is to use native CSP solutions like AWS Secrets Manager, AWS SSM Parameter Store, GCP Secret Manager, Terraform Vault. All these have native audit logs and access logs, which can help you pin point exactly when did your AI Agent requested and accessed your secrets at Runtime. | ||||||||||||||||||||||||||
| ▲ | elsuave 2 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||
Instead of sharing it directly I like to put in in a .env file. Then simply I tell to the AI to just import from the .env file and do not read from the file. | ||||||||||||||||||||||||||
| ▲ | PocketBot 17 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||
Absolutely not, and if you do this then please please rotate keys every day or two. | ||||||||||||||||||||||||||
| ▲ | raw_anon_1111 20 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||
The only private key that my agents have access to are temporary AWS access keys to a dev environment with decently locked down permissions. I let it troubleshoot my web code using a temporary JWT in a dev environment using headless chrome and Puppeteer in a Docker container. Everything else is in AWS Secrets Manager inaccessible by the IAM role the agent has access to. I don’t store the temporary AWS keys in a file anywhere. They are in environment variables. All AWS SDKs and the CLI look in the environment variables by default. I sure as hell don’t store API keys anywhere on my local computer. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | faangguyindia 21 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||
I share with gemini, claude and openai. If I get my stuff hacked (because I use a machine with nothing else on it other than coding agents) I'll know these services are not removing my personal info from their logs. I don't operate chinese models where my high value api keys are. It's pretty hard to debug stuff without using real api keys, service accounts etc...otjerwise | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | giantg2 18 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||
Why not treat them like other users? Give them some sort of indirect access like Antiphony. Give them their own keys that you can rotate and revoke. If you're worried about leaks, you might as well run it "self-hosted" like on Bedrock. | ||||||||||||||||||||||||||
| ▲ | sjdv1982 a day ago | parent | prev | next [-] | |||||||||||||||||||||||||
I wanted to ask almost this question, then saw that it is on #1 right now. My use case is ssh. I would like to stick my private key into a local Docker container, have a ssh-identical cli that reverse proxies into the container, and have some rules about what ssh commands the container may proxy or not. Does anyone know of something like this? | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | jvqv a day ago | parent | prev | next [-] | |||||||||||||||||||||||||
As a precaution I would probably never pass secrets directly to the agent at all. Something like a placeholder format where the actual substitution happens at execution time so the LLM never sees the real value. Keeps things cleaner if something ever goes wrong. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | sminchev a day ago | parent | prev | next [-] | |||||||||||||||||||||||||
Like everything else. You don't share you private, personal data, credit card numbers with the rest of the world, just like that. ;) | ||||||||||||||||||||||||||
| ▲ | omertt27 21 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||
i am okay, i trust that they have great guards to prevent leak any api | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | 10keane a day ago | parent | prev | next [-] | |||||||||||||||||||||||||
nope. too dangerous - i'm personally working for an agent project and i know from personal experience they do collect your session log - especially in china lol. one approach i use for my own agent is that to use keyring to store all secrets. agent will call a tool to request for it, and it will be something like <secret:gmail.password>. the substitution happens at tool execution time so the llm never sees or logs the actual value. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | KellyCriterion a day ago | parent | prev [-] | |||||||||||||||||||||||||
No :) | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||