DEDUPED Hot AI repos, turned into use cases Get 5 a day

How to stop an AI coding agent from reading your .env secrets with Agent Security

Install the local guard so an agent is refused when it reaches for a .env file and every decision is logged.

Who it is forA developer who lets Claude Code or Codex work in a repo that holds API keys in a .env file and wants the agent blocked from them.

The problemAn agent working in a project can open a .env file and read credentials it does not need for the task.

The outcomeThe agent's attempt to read .env is refused by the guard, the refusal is recorded in the local audit trail, and the agent reports the block instead of working around it.

What you need first

  • A machine where you can run a shell and git (the README installs with git clone and ./scripts/shell/install.sh)
  • Claude Code or Codex installed as the agent you want to guard
  • A new terminal after install, since hooks load only when a session starts
  • For the sandbox use case: Linux with bubblewrap (bwrap) installed, since the README says it is required and macOS and Windows refuse

Steps

  1. git clone https://github.com/solongate/agent-security.git
  2. cd agent-security
  3. ./scripts/shell/install.sh
  4. Open a new terminal, then start Claude Code or Codex in your project.
  5. Ask the agent to read the .env file, then run solongate audit to confirm the refusal was logged.

Prompt for your agent

Install the SolonGate guard from https://github.com/solongate/agent-security by running ./scripts/shell/install.sh in a fresh terminal, then start <agent> in <project-path> and ask it to read the .env file. Expected output: the guard refuses the read and the agent reports the refusal. Verify by running `solongate audit` and confirming a deny entry for .env exists in ~/.solongate/local-logs/solongate-audit.jsonl.

Caveat. The guard only covers agents it hooks into (the README names Claude Code, Codex, OpenCode and Antigravity), and hooks apply only to sessions started after install.

Share: X LinkedIn Hacker News Email Copy link

Disclaimer

Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked "Seen in the wild", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email [email protected] and we will look at it promptly. Full disclaimer page