AWS and Cloudanix team co-authored this blog: Real-Time Threat and Anomaly Detection for Workloads on AWS

Cloudanix – Your Partner in Cloud Security Excellence

AI Coding Agents Are Leaking Credentials — What Security Teams Need to Know

  • Abhiram Shindikar Abhiram Shindikar
  • Tuesday, Oct 06, 2026

There is a version of secret-scanning that most security teams are quietly comfortable with. You wire a scanner into your repos, you add one to your CI pipeline, you catch the occasional AWS key someone pasted into a config, and you move on. That coverage felt complete for years because, for years, credentials mostly lived in two places: source code and pipeline configuration.

That assumption no longer holds. In September 2026, GitGuardian published research showing that AI coding agents — Cursor, Claude Code, GitHub Copilot — scatter AWS tokens, API keys, and other credentials across places your scanners were never pointed at. Config files you never audit. Environment variables the agent sets on its own. Logs. Shell history. Temp files that outlive the session that created them.

None of this is malicious. The agents are doing exactly what they were built to do. But the net effect is a new identity attack surface sitting on every developer laptop running an agent, and most of it is invisible to the tooling you already trust. Let’s walk through what the research actually found, why your current scanners miss it, and what you can do about it without slowing your developers down.

AI Coding Agents Are the New Credential Attack Surface

Start with a simple shift in where credentials live. A traditional developer workflow keeps secrets reasonably contained. You might have a .env file, maybe something in ~/.aws/credentials, and your discipline (plus a pre-commit hook) keeps those out of the repo. The surface area is small and well understood.

An AI coding agent changes the shape of that surface entirely. The agent is a long-running process on the machine that reads files, runs commands, sets environment variables, writes logs, and persists state between sessions. To be useful, it needs to understand your environment, and to act, it needs credentials. The moment you hand an agent the ability to deploy a change, query a database, or fix an IAM policy, you have introduced a non-human identity that holds keys and leaves traces of them in ways a human developer never would.

The important mental model: the agent is not just writing code, it is operating your environment. That makes every place the agent touches a candidate location for a leaked credential. And agents touch a lot of places.

What the Research Found: Where Credentials Actually End Up

The core contribution of the GitGuardian work is mapping where credentials land once agents are in the loop. Content was rephrased for compliance with licensing restrictions, but the pattern is consistent across the tools they examined.

Config files you don’t audit

Agents read and write configuration aggressively. They drop settings into project-local config, user-level dotfiles, and tool-specific directories. Credentials get cached in agent config so the tool does not have to re-authenticate every session. These are not the .env files your pre-commit hook watches — they are agent-specific paths that were never on anyone’s scanning list.

Environment variables set by the agent

To run a command or a build, an agent frequently exports credentials into the environment first. That is convenient and completely standard. It also means a live, usable credential is sitting in the process environment, and anything that dumps the environment — a crash handler, a diagnostic script, a verbose log — captures it.

Logs

This is one of the quieter findings and one of the most dangerous. Agents log what they do, and what they do includes running commands with credentials in them. A command line that embeds a token, a debug trace that echoes a request header, an error message that includes the full request — all of it can land in a log file in plaintext. Logs are rarely treated as sensitive, they get copied around, attached to bug reports, and shipped to centralized logging without a second thought.

Shell history

When an agent runs commands through a shell, those commands can be written to shell history. A token passed as a command-line argument becomes a permanent, plaintext entry in ~/.zsh_history or ~/.bash_history. Shell history is almost never scanned, almost never rotated, and often synced across machines through dotfile repos — which can quietly carry a live key back into a Git repository after all.

Temp files

Agents stage work in temporary files, and those files do not always get cleaned up. A temp file holding a credential can sit on disk long after the task that created it finished, invisible to everyone, waiting for a backup, a sync, or an attacker who already has a foothold on the machine.

The through-line is that credentials are no longer concentrated in one or two well-known files. They are smeared across the filesystem, the process environment, and the shell — exactly the places your scanning strategy assumes are empty.

Why Traditional Scanners Miss This Entirely

If this feels like it should have been caught already, you are not wrong to ask. The reason it slips through is structural, not a matter of effort.

Repository scanners look at what is committed to Git. That is their whole job, and they do it well. But a credential in ~/.zsh_history, in an agent’s cache directory, or in a temp file under /tmp was never committed to anything. It lives on a laptop, outside the repository boundary entirely. The scanner has nothing to scan because the secret never entered the repo.

CI/CD scanners have the same blind spot from a different angle. They inspect the build environment and the pipeline — the code and config that flow through CI. They do not reach back onto a developer’s workstation to inspect that machine’s shell history, its agent logs, or its environment variables. The leak happens on the endpoint, and CI never sees the endpoint.

So you end up with a coverage gap that looks like full coverage. Your dashboards are green. Your repo scans are clean. Your pipeline is enforcing policy. And meanwhile, live AWS tokens are sitting in plaintext in half a dozen locations on every machine running an agent, none of which any of your scanners are designed to look at. The tooling is not broken. It is just pointed at the wrong surface, because the surface moved.

The Real Risk: What Happens When These Credentials Leak

It is worth being precise about why this matters, because “credentials in logs” can sound abstract until you trace the consequence.

The first problem is blast radius. The credentials agents hold are usually scoped to a developer’s full access, not to the narrow task at hand. An agent given long-lived AWS keys to fix one S3 bucket policy is holding keys that can touch everything those keys allow. When one of those keys leaks from a log or a temp file, the attacker inherits the full scope, not the small task.

The second problem is persistence. These are typically long-lived credentials. A key written to shell history in March is still a valid key in September. There is no natural expiry, so the window of exposure is open-ended. Every stale credential sitting in a log is a standing invitation that does not close on its own.

The third problem is invisibility and attribution. Because the leak happens off-repo and off-pipeline, you may have no signal that it occurred. And when a leaked agent credential is used, the activity is attributed to the developer’s identity. Untangling the human’s legitimate actions from the agent’s from an attacker’s — after the fact, with muddy logs — is exactly the kind of forensics nobody wants to do during an incident.

Put those together and the risk is clear: a broad-scope, long-lived, hard-to-attribute credential leaking into locations nobody is watching. That is close to a worst case for identity security, and agent adoption is multiplying the number of machines where it can happen.

What Security Teams Should Do Right Now

You do not need to ban agents to get ahead of this. The productivity gains are real and your developers are not giving them up. The goal is to shrink the surface and shorten the exposure window. Here is a practical sequence.

Expand where you scan

Point secret scanning at the places credentials actually land now, not just the repo. That means local scanning that covers agent config directories, shell history files, and common temp locations on developer machines. Treat the endpoint as in-scope. If a scanner only reads your Git history, you have mapped a small part of the territory.

Treat logs as sensitive by default

Assume agent logs and command output can contain credentials, because they do. Redact tokens at the logging layer, restrict who can read raw logs, and set aggressive retention limits. A log that is deleted after a short window cannot leak a key six months later.

Audit what credentials your agents actually hold

Inventory every long-lived key sitting in a developer environment for agent use. For each one, ask whether it needs to be standing at all. Most do not. This audit alone usually surfaces more broad-scope keys than teams expect.

Stop passing secrets as command-line arguments

Command-line arguments are the fastest path into shell history and logs. Prefer short-lived environment injection or a credential broker over anything that puts a token on a command line.

Shorten credential lifetime wherever you can

The single highest-leverage change is reducing how long any credential is valid. A key that expires in minutes is nearly worthless to an attacker who finds it in a stale log, because by the time they do, it no longer works. This is the principle behind just-in-time access, and it is where the structural fix lives. We have written more on the broader identity angle across the Cloudanix blog if you want the surrounding context.

How JIT for AI Agents Changes the Equation

Every mitigation above helps, but notice that most of them are about cleaning up after a credential that should not have existed in that form in the first place. You scan for leaked keys, you redact logs that captured keys, you audit standing keys. The deeper fix is to make sure there is no long-lived, broadly-scoped key for the agent to leak at all.

That is the core idea behind just-in-time access for AI coding agents. Instead of handing an agent a standing credential that sits in .envrc, in shell history, and in a config cache, you flip the model: the agent requests access at the moment it needs it, gets a tightly scoped credential for a short window, and that credential expires on its own.

Here is how Cloudanix Coding Agent JIT implements it in practice. The agent — whether it is Claude Code, Cursor, or Kiro — calls an MCP broker when it needs to act on cloud resources. The broker mints a short-lived, scoped credential, typically valid for around 15 minutes, and the role detaches automatically when the window closes. There are no standing keys to steal. Nothing lands in .envrc. Nothing gets written to shell history as a permanent entry, because there is no long-lived token to write. And because sensitive grants can route through a human-in-the-loop approval step in Slack, a person stays in control of what the agent is allowed to reach.

Walk that back through the risks from earlier. Blast radius shrinks because the credential is scoped to the task, not the developer’s full access. Persistence disappears because the credential auto-revokes in minutes — a token leaked into a log is dead long before anyone finds it. Attribution improves because each access is brokered, scoped, and tied to a specific request rather than a shared standing key. The leak surface does not just get smaller; for the standing-credential case, it largely stops existing.

This is the same pattern Cloudanix applies across the rest of its access model, so it fits an existing strategy rather than bolting on a one-off. If your teams need human access to infrastructure, Cloud JIT applies the same short-lived, scoped, approval-gated approach to cloud consoles and roles. For data access, Database JIT does it for database credentials. And all of it reports into the broader CNAPP+ platform, so agent access, human access, posture, and identity live in one correlated view instead of scattered across disconnected tools.

Looking Ahead: Building an AI-Agent Credential Strategy

The GitGuardian research is best read not as a scare story but as an early map of a surface that is only going to grow. Agent adoption is accelerating, agents are being granted more capability, and every new agent on a new machine is another instance of the same exposure. A strategy built around “scan the repo and hope” will fall further behind as that happens.

A durable strategy treats AI coding agents as first-class non-human identities and plans accordingly. That means knowing which agents run in your environment and what they can reach. It means defaulting to short-lived, scoped credentials for anything an agent does against real infrastructure, so there is nothing standing to leak. It means extending your detection beyond the repo to the endpoints where agents actually operate — the configs, the logs, the shell history, the temp files. And it means keeping a human in the loop for the access that genuinely warrants one, without turning every routine action into a ticket.

Do that, and the picture inverts. The agent stops being a scattering of long-lived keys across a filesystem you cannot fully see, and becomes an identity that asks for exactly what it needs, exactly when it needs it, and gives it back automatically. The leak surface the research describes mostly evaporates, not because you scanned harder, but because the thing worth stealing stopped sitting around.

Get Started

If your developers are already running Cursor, Claude Code, or Kiro against real cloud resources, the standing-credential problem is already on your machines, whether or not it has shown up in a scan yet. The fastest way to close it is to stop issuing long-lived keys to agents in the first place. See how JIT access for AI coding agents works, or go straight to the Coding Agent JIT product page to see the MCP-brokered, auto-revoking model in action. No standing keys, no secrets in shell history, and a human in the loop where it counts.

What Our Users Are Saying

Customer Reviews

Cloudanix is trusted by security leaders worldwide to deliver proactive, reliable, and cutting-edge cloud security.

One day, I changed the password of a root account, and my CTO called me within less than a minute to confirm if I did so. I was not expecting a reaction this quick. He told me Cloudanix alerted him of this password change and that he wanted to confirm as it was a critical security notification. I couldn't believe it!

Ritesh Agarwal
Ritesh Agarwal
CEO, Airgap Networks

Compliance is one way of staying secure, but what I want is the ability to go deeper and attain 'true security.' Cloudanix provides us the capability to do so.

Vishal Madan
Vishal Madan
Head of Engineering, iMocha

Cloudanix is building for the future of the cloud, which makes the product all the more desirable.

Ritesh Agarwal
Ritesh Agarwal
CEO, Airgap Networks

Cloudanix gave us the visibility we were missing. Being able to move from permanent access to a robust Just-In-Time (JIT) workflow has fundamentally changed our security posture without slowing down our engineering velocity.

Pavan Kumar Lekkala
Pavan Kumar Lekkala
SRE Lead, HugoHub

We are excited to leverage Cloudanix's comprehensive multi-cloud DevSecOps solution to secure our production workloads on AWS. Cloudanix has demonstrated that it can solve many challenges that DevSecOps teams face while continually adding new features such as SOC2 compliance and drift detection.

Satish Mohan
Satish Mohan
Co-founder & CTO, Airgap Networks

Managing third-party partner access was once a major concern for our security posture. With Cloudanix JIT Cloud, we've effectively achieved zero third-party risk. We can now grant access confidently, knowing that it is temporary, audited, and automatically revoked, resulting in a 100% reduction in our privileged access exposure.

Okesh Badhiye
Okesh Badhiye
Head of Technical Engineering, Finfinity

The snooze feature and responsible alerts have helped us save time and prioritize what to tackle first.

Satish Mohan
Satish Mohan
Co-founder & CTO, Airgap Networks

Implementing Cloudanix JIT internally allowed us to practice what we preach. By eliminating permanent access to our own clouds and databases, we've neutralized the risk of standing privileges, ensuring our own 'keys to the kingdom' are never left exposed.

Girish Manghnani
Girish Manghnani
Managing Partner, Tech Inspira

The problem with permissions is a lot of times, the gaps are left open due to oversights from inside the organization itself. With Cloudanix's CIEM, we get a complete view of user permissions and access. This enables us to update the permissions, reducing the attack surface.

Nilesh Pethani
Nilesh Pethani
Application Architect, iMocha

In the world of Fintech, trust is our currency. Cloudanix provided the frictionless visibility we needed to secure our EKS workloads across AWS, ensuring we stay audit-ready for SOC2 and GDPR without slowing down our engineering velocity.

Amol Naik
Amol Naik
Head of Security & Infrastructure, HugoHub

Cloudanix delivered value within 5 minutes of onboarding. Continuous monitoring, timely detection, and excellent documentation helped us attain a great cloud security posture.

Divyanshu Shukla
Senior DevSecOps, Meesho

Technology strategies and business strategies are in a state of constant change which includes centralization and decentralization of responsibilities. Regardless of strategic shift, we still have intellectual property to protect. Cloudanix are critical partners for us in our public cloud security posture across our three cloud providers.

Jerry Locke
Jerry Locke
Senior Director Global Solutions Engineering, Eversana

Cloudanix has been amazing. They opened up a common Slack channel with us — and it feels like we are talking to our own team and getting things done with Cloud security. The support team is always available, friendly, helpful, and ready to go out of their way.

Satish Mohan
Satish Mohan
CTO, Airgap Networks

Beyond just access management, Cloudanix CSPM has given us a unified view of our AWS environment. The real-time alerting and anomaly detection allow us to prevent any untoward activity before it happens, which is critical for a marketplace connecting 50+ financial institutions.

Okesh Badhiye
Okesh Badhiye
Head of Technical Engineering, Finfinity

For a Fintech company, data is our most valuable — and most sensitive — asset. Cloudanix DAM hasn't just improved our visibility; it has given us control. The ability to mask data and prevent unauthorized queries in real-time is a game-changer for our compliance and customer trust.

Jiten Gala
Jiten Gala
President Engineering and Product, Kapittx

Our clients, especially in the Middle East financial sector, demand absolute accountability. Cloudanix JIT Cloud has been a competitive differentiator for us, allowing us to provide secure, governed access to customer accounts that meet their strictest audit and compliance requirements.

Girish Manghnani
Girish Manghnani
Managing Partner, Tech Inspira

Cloudanix is always on my team's lips because of its exceptional support. Be it a small or big query, Cloudanix has gone above and beyond to resolve them. This one's a keeper for us.

Sujit Karpe
Sujit Karpe
CTO, iMocha

For a long-lasting partnership, great support goes a long way. Cloudanix has delivered exceptional support whenever required. Their edge is their team is always ready to go beyond to solve any issues that we have. This speaks volumes about the culture at Cloudanix.

Akash Maheshwari
Akash Maheshwari
Co-founder, MoveInSync

Beyond the technology, Cloudanix feels like an extension of our own team. Their willingness to stand up a dedicated Middle East tenant for us and provide exceptional support at a sensible price makes them a long-term partner for Hugosave.

Surya Tamada
Surya Tamada
CTO, HugoHub

The real-time notifications that Cloudanix provides are a real lifesaver. Their adaptive notifications ensure that my team stays productive and doesn't get interrupted all the time.

Digvijay Singh
Staff Security Engineer, Meesho

The whole point in technological evolution is to help improve the world we live in. We must protect that and to do so requires an effective and efficient security strategy. The Cloudanix team helped make our public cloud security posture management strategy a reality. The symbiotic relationship we have allows for a continuous feedback loop which is how business should operate.

Larry Wheat
Larry Wheat
Staff Solutions Engineer, Eversana

Ready to see your graph?

Connect a cloud account in under 30 minutes. See every finding rooted in identity, asset, and blast radius — with a fix path attached.

Book a Demo