NHI Forum
Read full article here: https://blog.gitguardian.com/principle-of-least-privilege-nhis/?utm_source=nhimg
Overprivileged non-human identities (NHIs) are one of the most dangerous and overlooked risks in enterprise security. Enforcing the principle of least privilege (PoLP) — combined with automation and visibility — is no longer optional; it’s a foundational control for reducing breach impact.
The Attacker’s Perspective: Privileges Are Everything
When a secret is leaked, attackers care about two things:
- Does it still work?
- What level of access does it grant?
GitGuardian’s 2025 State of Secrets Sprawl Report revealed that most GitHub and GitLab API keys leaked publicly were overprivileged — often with full read/write access to repositories. With those permissions, attackers can tamper with source code, exfiltrate data, and inject malicious code into CI/CD pipelines.
If permissions are this broad for GitHub and GitLab, they’re likely the same across cloud accounts, CI/CD pipelines, and production systems — multiplying risk everywhere.
Understanding Least Privilege
The principle of least privilege is simple: only give the minimum access required to perform a task.
For humans, this is common practice — new employees rarely receive production access on day one. But with machine identities, that discipline is often missing. CI/CD pipelines, service accounts, and API tokens are granted sweeping privileges to “avoid breaking things,” and rarely get reviewed later.
Why NHIs Are Different
Machine identities operate differently from humans:
- No human-in-the-loop: If an identity lacks access, the pipeline fails — there’s no ticket or approval workflow.
- Silent risk: If an identity is overprivileged, it keeps working, quietly increasing the blast radius.
- High scale: NHIs now outnumber humans by 100:1 in many enterprises, making manual oversight impossible.
This leads developers to err on the side of granting more access than needed, prioritizing uptime over security. The result? Persistent, high-risk credentials that attackers love.
Auditing Gaps and Visibility Challenges
Human access is regularly reviewed — group memberships, login patterns, anomalies — but machine identities are often forgotten after creation. Long-lived secrets sit in repositories, CI/CD variables, or vaults with no regular review process.
Even if secrets are inventoried, understanding what permissions they grant and where they are used is a major challenge. Without context, teams cannot effectively enforce least privilege.
Agentic AI Is Making This Worse
The rise of Agentic AI intensifies the problem. AI agents often inherit the full set of privileges from the users or services they represent. These inherited permissions are rarely scoped narrowly, creating a hidden layer of overprivileged, autonomous actors that are hard to track and govern.
How to Fix the Problem: Automate & Enforce
Enforcing least privilege for NHIs requires three pillars:
1-Inventory & Visibility
You cannot protect what you cannot see. Build a living inventory of all NHIs, their secrets, and their effective permissions. GitGuardian’s NHI Governance Platform, for example, maps identities across vaults and systems, detects leaked or duplicate secrets, and shows whether permissions violate governance policy.
2-Contextual Permission Insights
Go beyond secret discovery. Tools like GitGuardian Secrets Analyzer identify scope, usage, and security perimeter of each secret, allowing teams to decide whether a token is overprivileged, stale, or improperly reused.
3-Automated Enforcement
Manual reviews cannot keep pace with the scale of modern environments. Use policy-as-code to automatically enforce least privilege, revoke unused access, and alert on permission drift — without slowing down developers.
A Future of “Optimal Permissions”
The goal isn’t just locking things down; it’s right-sizing permissions continuously:
- Just-in-time access: Grant permissions dynamically, only when needed.
- Scoped credentials: Issue short-lived tokens tied to specific tasks.
- Continuous monitoring: Detect privilege escalation and policy violations in real time.
By combining visibility, context, and automation, security teams can finally bring NHIs under control and make least privilege a living, enforced practice — not just a slide in a compliance deck.
Takeaway
Overprivileged NHIs are one of the biggest unaddressed risks in modern infrastructure. To reduce breach impact and limit attacker movement, organizations must adopt automated, identity-first governance that enforces least privilege at scale.