Treat any configuration that changes a tool’s endpoint as a sensitive control, not a convenience setting. Review committed settings files in code review, restrict who can edit shells and dev containers, and require user consent before credentials are sent to a non-default address. If a client forwards live sign-in credentials, assume a redirect can expose more than a token and plan revocation accordingly.
Why This Matters for Security Teams
AI CLI tools that can forward credentials to a different endpoint turn a routine configuration choice into an identity risk. When the client is allowed to send live sign-in material anywhere other than the intended service, a redirect can become a credential exfiltration path, a policy bypass, or an accidental trust expansion. That is why NHI Management Group treats endpoint selection as part of the control plane, not a developer convenience.
This problem is especially sharp for non-human identities because the damage is often immediate and machine-speed. NHIMG research on secret exposure shows that attackers move quickly when they find usable credentials, and the Ultimate Guide to NHIs -- Static vs Dynamic Secrets explains why short-lived, scoped secrets are safer than standing credentials. Guidance from the OWASP Non-Human Identity Top 10 also reinforces that over-broad trust and weak secret handling create predictable abuse paths. In practice, many security teams discover redirect abuse only after a token has already been forwarded to an unreviewed endpoint, rather than through intentional change control.
How It Works in Practice
The right response is to treat redirect-capable CLI settings as sensitive security configuration. That means versioning them, reviewing them like code, and blocking silent changes in local profiles, shell startup files, dev containers, and automation wrappers. If the tool can send credentials to a non-default address, the endpoint itself needs approval, not just the command that invoked it.
For teams building policy around this, the practical sequence is straightforward:
- Classify endpoint override flags and config keys as high-risk controls.
- Require explicit user consent before any credential leaves the default trust boundary.
- Prefer ephemeral, task-scoped credentials over reusable long-lived secrets.
- Log the destination, user, workload, and policy decision for every redirect event.
- Revoke or rotate credentials immediately if a client can forward live sign-in material.
This is also where workload identity matters. If the CLI supports OIDC, SPIFFE, or another workload identity mechanism, it should prove what the agent or process is before it ever receives a secret. That reduces reliance on static tokens that can be replayed after a redirect. NIST identity guidance such as NIST SP 800-63 Digital Identity Guidelines is still useful here, but current guidance suggests the stronger pattern is context-aware authorisation at request time, not one-time trust in a saved endpoint. NHIMG’s Guide to the Secret Sprawl Challenge is a useful reminder that endpoint drift and secret sprawl usually appear together in real environments. These controls tend to break down when developers can edit local config files outside central management because the redirect path bypasses normal approval and logging.
Common Variations and Edge Cases
Tighter endpoint control often increases developer friction, requiring organisations to balance release speed against credential safety. That tradeoff becomes harder in sandboxed labs, multi-tenant build systems, and agentic AI workflows where a tool may need to call more than one backend during a single task. There is no universal standard for this yet, so teams should label exceptions clearly and keep them narrow.
One common edge case is proxying through an internal relay. If the relay terminates authentication, the redirect risk changes from direct secret exposure to trust transitivity, which still needs review. Another is signed-in browser flows embedded in a CLI, where a user believes they are authenticating to one service but the tool later posts the resulting credential to another. In those cases, consent prompts alone are not enough unless the destination is obvious and immutable.
Teams should also separate policy for static API keys from policy for live sign-in credentials. A key that is already scoped to a single service may tolerate a controlled proxy path, but live session material should not be redirected without explicit, auditable approval. The State of Non-Human Identity Security highlights how weak visibility and poor rotation remain common attack drivers, which is why redirect handling should be tied to both detection and revocation. Best practice is evolving, but the operational rule is stable: if a CLI can forward credentials off the expected endpoint, the destination must be treated as part of the trust decision, not a routing detail.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10, OWASP Agentic AI Top 10 and CSA MAESTRO 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 Non-Human Identity Top 10 | NHI-03 | Endpoint redirects can expose long-lived NHI secrets. |
| OWASP Agentic AI Top 10 | A-04 | Agentic tools may redirect credentials during autonomous workflows. |
| CSA MAESTRO | AUTH-2 | MAESTRO addresses runtime authorisation for agent actions. |
| NIST AI RMF | GOVERN | Redirected credentials are an AI governance and accountability risk. |
| NIST Zero Trust (SP 800-207) | PR.AC-4 | Zero Trust supports verifying every destination before access. |
Require runtime approval before an agent sends credentials to any endpoint outside its default trust boundary.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on August 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org