Skip to the content
AI and Cybersecurity Learning and Practice Center Test automation Open the Learning Center

Best practiceCoding assistants and CI

Keep AI agents in CI away from secrets and fork code

OWASP ASI01OWASP ASI03OWASP ASI04

A coding agent triggered by an issue or pull request reads attacker text with the workflow's token. Novee's Black Hat research took over the official Claude Code, Gemini CLI and Codex actions from a public issue; Shai-Hulud worms rode pull_request_target and shared caches into release pipelines.

What to do

  1. Never run agents or fork code under pull_request_target or with write tokens; triage untrusted input in a job with read-only permissions and no secrets.
  2. Do not share Actions caches between untrusted and release jobs; pin actions to commit SHAs.
  3. Give the agent job the minimum GITHUB_TOKEN permissions and no long-lived cloud keys; use OIDC for anything that publishes.
  4. Require human review before an agent's changes merge, and keep the agent out of release workflows entirely.

Sources

Check your own AI plan against the practices: Plan check