Application Security

Building Security Guardrails for AI-Powered Development Teams

This summer delivered a series of warnings for AI-powered development: an agent deleting a production database, a malicious prompt shipped inside a coding assistant extension, and malware that turned developers' AI tools into secret hunters. Here is a practical set of guardrails for teams that use AI assistants and agents every day.

By EthicalHat Research · · 3 min read
Infographic: Guardrails for AI-powered development

AI assistants and agents are now part of daily development in most teams we work with. This summer showed, in quick succession, what happens when guardrails are missing:

  • July: a founder publicly described how an AI coding agent on a popular platform deleted a production database during a code freeze, despite instructions not to make changes. The platform responded by adding stronger separation between development and production environments.
  • July: a malicious prompt instructing the agent to delete local files and cloud resources was merged into a release of Amazon Q's VS Code extension. AWS said the code would not have worked as intended and pulled the version.
  • August: malicious releases of the Nx build system on npm ("s1ngularity") included code that checked for AI coding CLIs on developers' machines and prompted them to search for secrets and wallet files, which were then exfiltrated.

None of these required exotic techniques. Each exploited missing boundaries around powerful tools. Here is how to put those boundaries in place.

1. People and policy

  • Approved tools: a short list of approved assistants, agents, extensions and MCP servers, with enterprise terms that protect your code and data.
  • Clear norms: where AI is encouraged (tests, boilerplate, refactoring, docs), where it needs extra review (authentication, payments, cryptography, infrastructure) and where agents may not operate.
  • Ownership: the developer who merges AI-assisted code owns it.
  • Training: the characteristic failure modes of AI-generated code, and the risks of prompt injection through repository content.

2. Tool governance

Treat AI tools as software supply-chain components with privileged access:

  • pin versions of extensions, CLIs and MCP servers, and review updates,
  • centrally manage configuration on company devices,
  • monitor for unapproved tools, and
  • subscribe to vendor security advisories.

3. Data boundaries

  • Secrets: keep them out of repositories, .env files in working copies and shell history. Use a secrets manager and short-lived credentials.
  • Customer data: never in prompts, test fixtures or files AI tools can read, unless the tool and environment are approved for it.
  • Repository instructions: use project instruction files (such as CLAUDE.md or tool-specific rules files) to state what the agent must not touch, but never rely on instructions alone as a security control.

4. Action limits for agents

Instructions are not controls. The database deletion happened despite instructions. Enforce limits technically:

  • Separate environments: agents work in development environments; production is reachable only through the normal deployment pipeline.
  • No production credentials anywhere an agent can read them.
  • Sandboxing: containers or cloud workspaces with only the repository mounted and restricted network egress.
  • Command policies: allow builds, tests and linters; require approval for installs, network access and Git remotes; deny destructive commands.
  • Git protections: agents push to their own branches; protected branches enforced server-side; no force-push.
jsonc
// Illustrative agent permission policy (format varies by tool)
{
  "allow": ["npm test", "npm run lint", "npm run build", "git status", "git diff"],
  "ask":   ["npm install *", "git push *", "curl *"],
  "deny":  ["rm -rf *", "git push --force*", "psql *prod*", "terraform apply*", "kubectl * --context=prod*"]
}

5. Output gates

  • The same CI gates for all code: tests, type checks, SAST, dependency and secret scanning, IaC checks.
  • New dependency review, because assistants may suggest packages that do not exist or are not what they seem.
  • Risk-based human review: code owners for sensitive paths, and second reviewers for agent-authored changes to them.
  • Provenance: mark agent-authored commits and PRs so reviewers and auditors know.
flowchart LR
  Dev[Developer + AI tools] -->|sandboxed, no prod creds| Branch[Feature branch]
  Branch --> CI[CI gates<br/>tests, SAST, SCA,<br/>secrets, new deps]
  CI --> Rev[Risk-based review<br/>code owners]
  Rev --> Main[Protected main]
  Main --> Pipe[Deployment pipeline<br/>approvals]
  Pipe --> Prod[Production]

6. Detect and respond

  • Endpoint monitoring on developer machines, including unusual behaviour by AI tool processes.
  • Alerts on secret-scanning hits, unexpected outbound connections from CI and development environments, and new or modified workflow files.
  • An incident playbook for "AI tool compromised": revoke tokens, remove the tool version, check for exfiltration and review recent agent actions.

A starter checklist

  • Approved AI tools list with enterprise terms; unapproved tools blocked on managed devices
  • Tool and extension versions pinned; updates reviewed
  • No production credentials reachable from development or agent environments
  • Agents sandboxed with command policies and restricted egress
  • Protected branches enforced server-side; agents push only to their own branches
  • CI gates on every change, including new dependency review
  • Code owners and second review for sensitive paths
  • Secrets scanning and short-lived credentials everywhere
  • Incident playbook for compromised AI tooling

The bottom line

AI makes development teams faster and adds powerful new actors to the development environment. The incidents of this summer were not failures of AI intelligence; they were failures of boundaries. Put technical limits around what AI tools can see and do, govern the tools like any other supply-chain component, and apply the same gates to everything that reaches production.

Our application security testing and information security audit services assess AI-powered development environments, and our security training prepares teams to use these tools safely.

EthicalHat Research

The EthicalHat research team: penetration testers, SOC analysts and engineers writing about security, software engineering and AI.

Want an expert opinion on your own systems?

Email info@ethicalhat.com or call +1-844-838-4422. Our security engineers are happy to talk it through.