TL;DR: Coding agents can surface API keys, tokens, and connection strings in generated code, logs, and pull request text, and Fiddler argues that only inline enforcement at the request and response path can stop exposure before it reaches downstream systems. Observation-only detection remains useful for audit, but it leaves the blast radius intact once a credential has already left the agent.
At a glance
What this is: Fiddler argues that coding agents can expose secrets on both the input and output side, and that only inline enforcement at runtime can stop exposure before it propagates.
Why it matters: This matters because IAM and NHI teams need controls that act before credentials reach repositories, CI pipelines, logs, or other downstream consumers, not just after an alert fires.
By the numbers:
- 80% of identity breaches involved compromised non-human identities such as service accounts and API keys, according to the Ultimate Guide to NHIs.
Context
Coding agent credential exposure is a secrets governance problem, not just a content-moderation problem. When an agent can read files, execute commands, and write output into code or pull request text, the control question becomes whether secrets are blocked before they leave the agent session.
The security gap is that most teams still place their trust in after-the-fact scanning. That model may support audit and incident review, but it does not stop API keys, tokens, or connection strings from landing in repositories, build systems, or chat history.
For IAM, PAM, and NHI programmes, the issue is lifecycle control at the point of generation and disclosure. A credential that appears in agent output is already a governance event, even if no human intended to expose it.
Key questions
Q: What breaks when coding agents are only reviewed with spot checks?
A: Spot checks miss the path an agent took through tools, prompts, retrieval, and instrumentation, so teams can approve a change without understanding its system-wide effect. The result is weak release assurance, because the final output may look fine even when the underlying behaviour regressed.
Q: Why do autonomous coding agents increase credential exposure risk?
A: They increase risk because they can read local files, execute commands, and continue a task without a human approval prompt. If those privileges reach AWS keys, package tokens, or developer config, the agent can stage secrets during routine work and make the output look normal. That turns routine automation into a covert access path.
Q: How do security teams know if inline secrets enforcement is actually working?
A: It is working when secrets are intercepted before they leave the gateway, and when response actions are consistently block or redact rather than allow for sensitive values. Teams should look for low false-negative rates, stable latency, and central visibility across all agent instances. If secrets still appear in repositories or CI artifacts, the control boundary is too late.
Q: Should organisations prioritise prevention or detection for coding agent secret exposure?
A: Prevention should come first because once a credential reaches a repository, pipeline, or terminal, the blast radius has already expanded. Detection still matters for audit, compliance, and incident review, but it should be a secondary control. The practical hierarchy is inline enforcement first, asynchronous scanning second, and revocation or rotation for any confirmed exposure.
Technical breakdown
Why coding agents leak credentials across the output path
Coding agents are LLM-powered systems that can read files, run commands, and generate code, which means they can surface secrets from multiple sources. The article identifies four leakage vectors: memorised training data, environment file ingestion, chain-of-thought or debug serialization, and developer-pasted credentials. The important technical point is that exposure can happen even when no malicious prompt is involved. The same agent session can therefore become both the source and the conduit for a secret, which is why output-side inspection matters as much as input-side filtering.
Practical implication: treat agent output as a potential secret egress channel and not just a code-generation artifact.
Why observation-only detection fails as a control model
Observation-only detection scans logs, outputs, or repositories after the data has already left the agent. That means it can confirm exposure, but it cannot prevent propagation into branch history, CI artifacts, cached builds, or shared terminals. In security terms, it is a detective control operating after the blast radius has expanded. For coding agents, the problem is not just whether a secret was seen, but whether it was prevented from crossing the trust boundary in the first place. Once it reaches downstream systems, rotation becomes damage containment, not prevention.
Practical implication: use asynchronous scanning for evidence and forensics, but not as the primary safeguard for secret disclosure.
How inline enforcement works at the request and response path
Inline enforcement inserts policy evaluation before the agent response reaches the developer or downstream system. The article describes verdicts of allow, block, or redact, applied through an AI gateway that already brokers traffic between the developer and the agent. Redaction preserves useful code while masking the secret, while blocking stops delivery entirely for higher-risk values. The design difference is architectural: policy is applied in the delivery path, not in a separate review system. That gives security teams a chance to stop exposure at the point it would otherwise become durable.
Practical implication: enforce secrets policies at the gateway or delivery layer so exposure is intercepted before commit or copy-out.
Threat narrative
Attacker objective: The objective is to move valid credentials into downstream systems where they can be reused for unauthorized access or broader compromise.
- Entry occurs when a developer pastes a live credential into the coding agent prompt or when the model recalls a secret from training data or environment files.
- Credential disclosure follows when the agent emits the secret in generated code, logs, or pull request text and the output is accepted into the workflow.
- Impact occurs when the exposed secret reaches a repository, CI pipeline, cache, or shared terminal and expands the blast radius beyond the original session.
Breaches seen in the wild
- Dropbox Sign breach 2024: A compromised back-end service account gave attackers Dropbox Sign customer data, including API keys, OAuth tokens and MFA information.
- Hugging Face Spaces breach 2024: Unauthorised access to Hugging Face Spaces may have exposed secrets users stored for AI apps; tokens were revoked and org tokens removed.
Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
Inline enforcement, not retrospective scanning, is the control boundary that matters here. Coding agent secret exposure is only partly a detection problem because the harm occurs the moment a credential leaves the agent and enters another system. The article is right to separate audit from prevention, because audit can prove leakage but cannot reverse downstream propagation. For practitioners, the relevant control question is where the secret becomes durable, not when someone notices it.
Request-side and response-side control must be treated as separate governance paths. The article shows that secrets can arrive from both directions: a developer pastes one in, or the agent generates one from context or memorization. That means a single guardrail built only for malicious prompt input misses half the failure modes. The implication is that identity governance for coding agents has to cover both ingress and egress, not just user intent.
Fleet-wide visibility is now part of secrets governance, not just telemetry. A single unmonitored agent instance can leak a production credential, which makes partial deployment an unsafe operating model. The named concept here is agent output trust boundary: the point at which generated content becomes a governed disclosure event rather than a draft artifact. Practitioners should treat every sanctioned and shadow agent as part of the same control surface.
Long-lived credential assumptions break when agents can disclose secrets faster than review cycles can react. Human-paced review and detective workflows assume a window in which exposure can be observed before it matters. Coding agents compress that window to the response path itself, which means the old premise of acceptable post-hoc remediation no longer holds. The implication is that governance has to move to issuance and disclosure time, not after publication.
Secrets leakage from coding agents is becoming a lifecycle issue, not a tooling issue. When a secret appears in generated output, it should be treated as a near-miss that affects lifecycle decisions around revocation, rotation, and access scope. That aligns more closely with NHI governance than with conventional application logging. Practitioners should reset their control model around exposure prevention, not merely leakage detection.
From our research library:
- Only 20% have formal processes for offboarding and revoking API keys, and even fewer have procedures for rotating them, according to the Ultimate Guide to NHIs.
- Read next: Guide to the Secret Sprawl Challenge
What this signals
Agent output trust boundary: coding agents turn disclosure into a runtime governance problem because the value to control is not just what the model knows, but what it emits into durable systems. Security teams should define the exact point at which generated text becomes a controlled disclosure event and enforce policy there.
Inline enforcement should now be treated as a prerequisite for any production coding-agent deployment that can touch secrets, because review-based and log-based controls cannot close the propagation gap once a credential is visible to the user or the pipeline.
When fleet visibility is incomplete, the safest assumption is that one shadow agent can bypass policy. That is why central monitoring and output controls need to be designed together rather than added as separate layers after adoption.
For practitioners
- Audit agent file and environment access Inventory which files, environment variables, and services each coding agent can read, then narrow access so the agent cannot reach credentials it does not need for the task at hand.
- Enforce inline secrets checks at both paths Apply policy at the request and response path so pasted credentials are blocked on input and generated credentials are blocked or redacted on output before delivery.
- Set policy by secret type and sensitivity Use block for high-risk secrets such as production database credentials and signing keys, and redact for lower-risk values where the surrounding code can still be preserved.
- Monitor every agent instance centrally Extend fleet-wide dashboards to sanctioned and shadow coding agents so one unmonitored session cannot bypass enforcement or hide a secret exposure event.
- Rotate any credential that appears in agent output Treat every detection event as a near-miss and revoke or rotate credentials that have ever been surfaced, even when the agent output was blocked before delivery.
Key takeaways
- Coding agents create a disclosure path that can expose API keys, tokens, and connection strings before humans or scanners notice the leak.
- The article distinguishes prevention from detection, and that distinction matters because downstream systems can absorb a secret within minutes of exposure.
- The control that changes the outcome is inline enforcement at the request and response boundary, backed by central monitoring and revocation of any credential that surfaced.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10, OWASP Non-Human Identity Top 10 and MITRE ATT&CK address the attack and risk surface, while NIST CSF 2.0 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | ASI03 — Identity & Privilege Abuse | Coding agents can disclose or misuse credentials while acting across tools and outputs. |
| Recommendation — Apply ASI03 controls to constrain agent authority and prevent credential disclosure through generated output. | ||
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | The article is explicitly about secrets escaping from coding agent sessions into downstream systems. |
| NHI-07 — Long-Lived Secrets | The article recommends rotating credentials that ever appeared in agent output, which speaks to secret persistence. | |
| Recommendation — Scan agent inputs and outputs for secret leakage and redact or block disclosure before delivery. Reduce exposure by rotating any credential that has appeared in coding-agent context or output. | ||
| NIST CSF 2.0 | PR.AA-05 — Access Permissions, Entitlements and Authorizations | The article calls for least-privilege agent access to files, variables, and services. |
| Recommendation — Restrict coding-agent permissions to only the files, variables, and services needed for the task. | ||
| CIS Controls v8 | CIS-5 — Account Management | Central monitoring and revocation of agent credentials aligns with account and access governance. |
| Recommendation — Use account management controls to inventory, monitor, and revoke overexposed agent credentials. | ||
| MITRE ATT&CK | TA0006 — Credential Access | The article describes a credential-access pattern where secrets move into reachable downstream systems. |
| Recommendation — Map coding-agent secret exposure to credential access and hunt for downstream reuse paths. | ||
Key terms
- Coding Agent: A coding agent is a software system that can plan, generate, and modify code with limited human prompting. In governance terms, it is not just a tool but an actor whose permissions, tool access, and rollback path must be managed as part of the delivery process.
- Inline Enforcement: Inline enforcement is the technical act of applying access policy in the live session path, not just at approval time. It matters because identity governance without runtime enforcement can authorize access that the session layer never actually constrains, especially in distributed and third-party environments.
- Observation-only Detection: A security approach that scans logs, outputs, or repositories after exposure has already occurred. It is useful for investigation and compliance, but it cannot prevent a secret from entering a repository, build artifact, or developer workflow in the first place.
- Fleet-Level Monitoring: Fleet-level monitoring is the practice of looking for patterns across a population of assets rather than focusing only on one failed item. It helps teams identify systemic drift, supplier problems, or repeated failure modes that only become obvious when events are correlated at scale.
Deepen your knowledge
NHI governance, agentic AI identity, and machine identity lifecycle are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are responsible for identity security strategy or NHI governance in your organisation, it is worth exploring.
Published by the NHIMG editorial team on August 19, 2026.
Updated on October 12, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org