Subscribe to the Non-Human & AI Identity Journal
Home FAQ NHI Lifecycle Management What breaks when a secret is deleted from…
NHI Lifecycle Management

What breaks when a secret is deleted from Git but not rotated?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated June 6, 2026 Domain: NHI Lifecycle Management

Deletion only removes the latest visible copy. Earlier commits, forks, clones, and retained object data can still expose the secret, so the associated non-human identity remains at risk until the credential is revoked and replaced.

Why This Matters for Security Teams

Deleting a secret from Git is a hygiene step, not a remediation step. The risk is that the credential may already be embedded in earlier commits, developer forks, mirrored repos, CI logs, caches, package artifacts, and local clones, so the non-human identity can still be abused long after the visible file is gone. NHI Mgmt Group research on the Guide to the Secret Sprawl Challenge shows why secret sprawl is so persistent, and the Ultimate Guide to NHIs — Static vs Dynamic Secrets explains why long-lived credentials remain a structural weakness. OWASP’s OWASP Non-Human Identity Top 10 also treats poor secret lifecycle handling as a core identity risk, not just a source-control issue.

The practical failure is that teams often confuse “removed from the repo” with “removed from the environment.” Until the credential is revoked, every copied instance remains valid, and an attacker only needs one surviving token to pivot into APIs, pipelines, or cloud control planes. In practice, many security teams encounter the compromise only after abnormal usage has already started, rather than through intentional credential lifecycle control.

How It Works in Practice

When a secret leaks into Git, the right response is to treat the credential as compromised first and the repository as a secondary cleanup task. Rotation means issuing a new secret, replacing every dependency on the old one, and revoking the old credential at the source so replay from old commits or cloned history no longer works. That aligns with the lifecycle approach described in the NHI Lifecycle Management Guide and with lifecycle thinking in the OWASP Non-Human Identity Top 10.

Operationally, the sequence is simple but easy to miss under pressure:

  • Identify every place the secret may have propagated, including forks, caches, CI variables, and deployment manifests.
  • Revoke the compromised credential at the issuer, not only in Git history.
  • Issue a replacement with tighter scope, shorter TTL, or a dynamic secret model where possible.
  • Update dependent services, then validate that the old token fails everywhere.

This is why static secret are so fragile: the longer they live, the more copies accumulate outside central control. NHI Mgmt Group’s research on static vs dynamic secrets shows the value of short-lived issuance, while OWASP guidance reinforces that identity controls must be paired with revocation and rotation. For pipeline-heavy environments, the CI/CD pipeline exploitation case study is a reminder that leaked credentials often remain reachable through automation even after the repo is scrubbed. These controls tend to break down when secrets are hardcoded into build jobs or shared across services because revocation then requires coordinated replacement across many runtime paths.

Common Variations and Edge Cases

Tighter secret rotation often increases operational overhead, requiring organisations to balance faster revocation against service stability and deployment complexity. That tradeoff is manageable for well-instrumented environments, but there is no universal standard for every stack yet, especially where legacy systems cannot reload credentials without downtime. In those cases, current guidance suggests compensating with stronger monitoring, narrower scope, and staged replacement rather than pretending deletion alone has reduced risk.

Edge cases also matter. If the secret was only ever used in a disposable test environment, impact may be lower, but the same deletion problem still applies because copies can survive in forks, logs, and backup systems. If a service account or API key has broad permissions, the urgency rises sharply. NHI Mgmt Group’s Top 10 NHI Issues and Guide to NHI Rotation Challenges both point to the same pattern: remediation fails when ownership is unclear or the replacement process is manual. The practical standard is to assume any deleted secret may still be active until the issuer proves otherwise.

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 address the attack and risk surface, while NIST CSF 2.0 and NIST AI RMF set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-03Secret deletion without revocation is a rotation failure.
NIST CSF 2.0PR.AC-1Access control must remove compromised credentials, not just files.
NIST AI RMFRisk management should cover secret lifecycle and downstream exposure.

Classify leaked secrets as an operational risk and require ownership, monitoring, and remediation tracking.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on June 6, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org