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

WeaknessASC-2026-0052Other weakness

Secrets written into code and commits by agents

MediumFixed

Agents copy keys from the environment into code, configuration, logs or commit messages while trying to make something work.

How to detect it

  • Secrets in diffs produced by agents
  • Keys in generated test files or examples

How to resolve it

  • Run pre-commit and server-side secret scanning
  • Keep real secrets out of the agent's environment

How to investigate

  1. Find every commit and log with the secret
  2. Rotate it and rewrite history if needed

Sources

Open it in the Learning Center's vulnerability database