Security teams should inject secrets at runtime, scope them per environment, and remove standing access wherever possible. That reduces secret sprawl while letting coding agents call APIs and run workloads only when needed. The practical goal is to keep access ephemeral, tightly targeted, and auditable so developers can move quickly without copying secrets into files or long-lived environment variables.
Why This Matters for Security Teams
AI-powered development changes the access pattern, not just the tooling. Coding agents and developer copilots may need short bursts of access to package registries, cloud APIs, test environments, and internal services, but they should not inherit broad, long-lived credentials. Static secrets create unnecessary blast radius, and in fast-moving pipelines they are often copied into environment variables, config files, or build logs. That is exactly the pattern NHI governance is meant to remove.
The urgency is not theoretical. NHIMG research on The State of Secrets in AppSec found that only 44% of developers are reported to follow security best practices for secrets management, while remediation of a leaked secret averages 27 days. That gap matters more when AI agents can generate code, invoke tools, and chain actions faster than human review cycles. The OWASP Non-Human Identity Top 10 frames this as an identity problem, not just a hygiene issue.
In practice, many security teams discover secret sprawl only after an agentic workflow has already written a credential into a repo, CI log, or issue thread.
How It Works in Practice
JIT secrets work by replacing standing access with runtime issuance. Instead of handing developers or agents a reusable token, the platform injects a short-lived secret only when a specific task begins, with scope limited to the target environment and revocation tied to task completion. That is the practical difference between a credential that can be reused tomorrow and one that exists only for the current action.
For AI-assisted development, the best pattern is to bind the secret to a workload identity and a policy decision at request time. The agent proves what it is using cryptographic identity, then receives only the minimum credential needed for the next step. This is consistent with current guidance from the OWASP Non-Human Identity Top 10 and the broader Zero Trust approach described in NIST SP 800-207.
- Issue secrets per task, not per user or per repo.
- Use short TTLs and automatic revocation when the job ends.
- Scope access to one environment, one service, or one API action.
- Log issuance, use, and revocation together for auditability.
- Prefer workload identity over copied tokens in local files or long-lived environment variables.
For implementation, teams usually combine a secrets broker, policy-as-code, and a delivery mechanism that injects values into memory at runtime rather than writing them to disk. Where possible, use federated identity flows and ephemeral tokens instead of static API keys. NHIMG’s Guide to the Secret Sprawl Challenge is useful here because it shows how quickly “temporary” secrets become durable once they land in developer tooling or CI/CD systems.
These controls tend to break down when legacy build systems require persistent credentials for batch jobs, because the platform cannot cleanly distinguish a single task from an always-on service account.
Common Variations and Edge Cases
Tighter secret scoping often increases orchestration overhead, so organisations have to balance developer speed against the cost of more frequent issuance, policy checks, and service integration. Current guidance suggests that tradeoff is worth it for AI-powered workflows, but there is no universal standard for every development stack yet.
One common edge case is local development. If a developer needs temporary access to a sandbox, the safest option is usually a time-boxed token with limited permissions rather than a shared team secret. Another edge case is multi-agent pipelines, where one agent creates code and another runs tests or deploys artifacts. Each agent should receive its own JIT credential, because shared secrets make attribution and containment much harder. NHIMG’s 52 NHI Breaches Analysis shows how often failures start with overbroad identity reuse rather than a single dramatic exploit.
AI-specific risk is also rising in supply chain workflows. When agents interact with package managers, MCP servers, or external APIs, secret injection must account for code generation, automated retries, and hidden tool calls. The right design is to keep secrets ephemeral, make revocation automatic, and treat every agent invocation as a fresh trust decision. That is especially important when using high-churn AI toolchains, because secrets can leak outside source control into prompts, logs, tickets, and chat systems before a human notices.
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, CSA MAESTRO and OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST AI RMF and NIST Zero Trust (SP 800-207) set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | A01 | Agentic workflows need runtime authorization and short-lived access. |
| CSA MAESTRO | GOV-02 | MAESTRO addresses governance for autonomous agent access and revocation. |
| NIST AI RMF | GOVERN | AI RMF governance supports accountability for AI-driven secret use. |
| OWASP Non-Human Identity Top 10 | NHI-03 | Covers secret rotation and elimination of standing credentials. |
| NIST Zero Trust (SP 800-207) | PR.AC-4 | Zero Trust requires continuous, context-aware access decisions. |
Evaluate every secret request against policy and least privilege at runtime.
Related resources from NHI Mgmt Group
- How should security teams reduce secrets leakage without slowing developers down?
- How should security teams control AI-assisted coding without slowing developers down?
- How should security teams implement application security without slowing developers down?
- How should security teams implement FIPS compliant AI gateways in government environments without slowing down LLM adoption?