AI Coding Security: Prompt Injection Is Hiding In Your Project Files

Your AI coding assistant reads every file in your repository. It reads your README, your config files, and your rules. It uses these files to decide how to write code.

A new security threat exploits this exact behavior. Researchers found a vulnerability across 28 different AI coding tools. The attack is not a complex hack. It is a simple text file in your repository.

How the attack works:

You clone an open-source project. It looks normal. You open it in your AI editor and ask for a new feature. You do not see the hidden Unicode characters in the configuration files. These characters hide instructions from you but tell the AI to do something else.

The hidden instruction tells the AI to send your AWS credentials to an external server. The AI thinks this is a legitimate project instruction. It executes the command. Your secrets are gone.

Why this is hard to stop:

  • Hidden characters: You see standard text, but the AI sees malicious commands via invisible Unicode characters.
  • Every file is an entry point: A README or a comment in a library can carry the payload.
  • High permissions: AI agents often run with your user permissions. They can read your SSH keys and API tokens.
  • Tool calls: The AI uses tool calls to run commands. The attack targets these calls to bypass safety training.

How to defend your workflow:

  • Sanitize file contents: Strip hidden characters and common injection patterns before the AI reads them.
  • Use sandboxes: Run AI agents in containers with no network access and read-only filesystems.
  • Set strict policies: Create a whitelist of allowed commands. Require human approval for any command that moves data or deletes files.

You can run a quick scan before your coding sessions. Check your files for suspicious terms like "ignore all previous" or "curl" and "exfil."

AI coding tools are productive, but they assume files on your disk are safe. They are not. Treat every file as untrusted input.

How are you handling prompt injection risks in your AI workflow?

Source: https://dev.to/tyson_cung/ai-coding-security-prompt-injection-is-hiding-in-your-project-files-4be9