Least privilege for a non-human identity means a service account, workload identity, cloud role or agent identity holds only the permissions its task actually uses. You measure it by comparing permissions granted with permissions exercised over a fixed window, then remove unused grants in staged, reversible steps with the owner's approval and a recorded exception for anything kept.
NIST SP 800-53 Rev. 5 control AC-6, a federal control catalogue, states the principle as "allowing only authorized accesses for users (or processes acting on behalf of users) that are necessary to accomplish assigned organizational tasks". OWASP lists Overprivileged NHI as NHI5 in its Non-Human Identities Top 10 (2025), a guidance document. This page is about measuring the gap and closing it. For the definition, see the least privilege glossary entry.
Why least privilege is harder for machines
- No job role to derive from. Human access can be modelled on a role or department. A workload's needs are defined by its code, which changes with every release.
- Permissions are granted under deadline. OWASP NHI5 notes that developers or administrators may inadvertently assign excessive privileges during development and maintenance. A broad managed role makes the error go away; nobody returns to narrow it.
- Rare code paths look like unused permissions. A disaster recovery job, a year-end batch or an incident runbook may run once a year. Remove its permissions on usage data alone and it fails when it matters most.
- Shared identities blur the signal. When several workloads use one identity, used permissions are the union of all of them, and none can be right-sized alone.
- Nobody to ask. Without a named owner there is no one to confirm that an unused permission is safe to remove. Ownership comes first; see assigning an owner to every non-human identity.
- Permissions live in many places. Identity policies, resource policies, Kubernetes RBAC, SaaS OAuth scopes and database grants are each evaluated separately, and usage tools usually see only some of them.
The authority ratio
The site defines the authority ratio in NHI metrics and board reporting as permissions granted against permissions exercised over ninety days. The gap is over-privilege expressed as a number you can act on.
To make it reproducible, fix four things before the first measurement and do not change them between reports (our method):
- Unit. Service level (which services the identity can call) or action level (which API actions). Action level is more precise but tool coverage is narrower. Pick one and state it.
- Formula. Authority ratio = permissions granted / permissions exercised in the window. A ratio of 1.0 means every granted permission was used. An identity with grants and zero exercised permissions is reported separately as unused, not as an infinite ratio.
- Wildcards. Expand wildcard grants to the actions they cover at measurement time, otherwise a single wildcard counts as one permission and hides the problem.
- Population. Report the ratio for the highest-risk tier first, with the count of identities measured and the measurement date.
The ratio does not capture resource scope. An identity that uses its one permission on every storage bucket, when it needs one bucket, has a ratio of 1.0 and is still over-privileged. Treat resource scoping as a separate review step in the runbook below.
Measuring used permissions with cloud-native tools
The three major cloud providers each publish a way to compare granted and used permissions. The table summarises what their own documentation says. It is a description, not a comparison or recommendation, and capabilities change; check the linked pages before relying on a detail.
| Tool | What it reports (per vendor docs) | Window | Documented limits |
|---|---|---|---|
| AWS IAM Access Analyzer, unused access analyzer | Unused roles; unused IAM user access keys and passwords; unused service-level and action-level permissions for roles | A usage window you specify | Action-level findings only for a listed set of services and actions; charged per IAM role and user analysed per analyzer per month |
| AWS IAM last accessed information | Which services an identity or policy allows and when each was last accessed; action-level for supported services | Service data: at least 400 days; action data from service-specific start dates | Not available for data plane events; iam:PassRole not tracked; excludes resource-based policies, SCPs, permissions boundaries and session policies; recent activity can take up to four hours to appear |
| Google Cloud IAM role recommendations (policy insights) | Compares a principal's permissions with those used, including service accounts; suggests revoking or replacing roles | At most the most recent 90 days; project-level minimum can be set to 30 or 60 days | Considers IAM only, not ACLs or Kubernetes RBAC; no insights for conditional role bindings; a machine learning model may keep permissions it predicts will be needed; new grants can take up to 15 days to get an insight |
| Microsoft Defender for Cloud CIEM | Identity risk insights including right-sizing permissions for overprovisioned identities based on actual usage; covers Entra ID service principals, AWS IAM roles and Google Cloud service accounts | Not stated on the overview page | Part of the Defender CSPM plan |
Microsoft Entra Permissions Management, which reported a Permission Creep Index, has been withdrawn from sale. Microsoft's documentation states it was no longer available for purchase from 1 April 2025 and gives 1 November 2025 as the date of retirement and end of support. Microsoft states that this does not affect CIEM capabilities in Defender for Cloud.
Blind spots to close separately
None of these tools sees everything. Data plane access (reading objects, querying tables), Kubernetes RBAC, SaaS OAuth grants, database grants and on-premises service accounts usually need their own logs. For those, the raw source of used permissions is the audit log of the system itself. See NHI monitoring and SaaS integration governance.
Just-in-time access and short-lived credentials
Right-sizing reduces what an identity can do. Just-in-time access and short-lived credentials reduce for how long. They are complements, not substitutes.
- Short-lived credentials. For example, an AWS STS AssumeRole session lasts from 900 seconds up to the role's maximum session duration, which can be set between 1 and 12 hours, with a default of 3,600 seconds, according to the AssumeRole API reference. A stolen session credential stops working when it expires.
- Just-in-time elevation. OWASP NHI5 prevention guidance includes just-in-time access: temporary, on-demand elevation of privileges for a defined time frame. For a workload, this means the standing identity holds routine permissions and a separate, approved, time-bound grant covers rare high-risk operations. See zero standing privilege.
A short-lived credential on an over-privileged identity is still over-privileged for the life of the session. Measure the authority ratio either way.
Workload identity federation
Workload identity federation lets a workload outside a cloud authenticate with a token from its own platform and exchange it for short-lived credentials, instead of storing a long-lived key. Google Cloud's documentation states that it "eliminates the maintenance and security burden associated with service account keys". See workload identity federation and the worked example for GitHub Actions to AWS with OIDC.
For least privilege, federation helps in one specific way: trust conditions (which repository, branch or cluster may assume the role) narrow who can obtain the identity. It does not narrow what the identity can do. A federated role with administrator permissions is still an administrator.
Right-sizing runbook with acceptance criteria
The steps and acceptance criteria below are our suggested procedure. Run it per identity, highest-risk tier first.
| Step | Action | Acceptance criterion (our suggestion) |
|---|---|---|
| 1. Scope | Select identities in the highest-risk tier: privileged, production-data or agent identities with write access | List of identities, each with a confirmed named owner |
| 2. Separate shared identities | Where several workloads share an identity, split it first | One identity per workload for every identity in scope |
| 3. Confirm the window | Use at least 90 days of usage data. Ask the owner to list rare paths (disaster recovery, quarterly or annual jobs, incident runbooks) and the permissions they need | Owner-signed list of rare-path permissions, possibly empty |
| 4. Measure | Generate granted versus used data from the tools above and system audit logs; compute the authority ratio | Ratio recorded with date, unit, tool and window |
| 5. Draft | Write the reduced policy: used permissions plus rare-path permissions; narrow resource scope; remove wildcards | Policy diff reviewed and approved by the owner; no wildcard actions in production without an exception |
| 6. Stage | Apply in a non-production environment, or run the release test suite against the new policy | Tests pass; no access-denied errors attributable to the change |
| 7. Apply with rollback | Change production through the normal change process, keeping the previous policy version | Previous version stored; rollback procedure tested once |
| 8. Watch | Monitor access-denied errors for the identity after the change | No unexplained denies for 14 days, or a documented fix |
| 9. Record | Store before and after policies, ratios, approvals and the change ticket | Evidence pack complete; ratio for the identity at or near 1.0 plus documented rare paths |
| 10. Prevent regrowth | Add organisation-level guardrails (OWASP NHI5 suggests deny policies to prohibit excessively permissive configurations) and include the identity in the next access review | Guardrail in place; identity scheduled in the review cycle |
Step 10 matters because permissions regrow. NIST AC-6(7), Review of User Privileges, asks organisations to review privileges at an organisation-defined frequency and to reassign or remove privileges as necessary. Applying it to non-human identities is our interpretation. See NHI access reviews.
Exceptions
Some identities will keep permissions they do not use: a vendor integration that requires a broad role, a break-glass identity, a disaster recovery path. That is acceptable if it is recorded. An unrecorded exception is simply over-privilege.
Record each exception with: the identity; its named owner; the specific permissions kept; the reason; compensating controls (for example, alerting on any use, short session duration, tighter trust conditions); the approver, who should not be the owner; and an expiry date. Our suggestion is an expiry of no more than twelve months for tier 1, after which the exception is re-approved or removed. Track the exception age metric from the metrics page: a register where nothing expires is a parking lot, not a control. A template structure is in the NHI policy template.
Frequently asked questions
How do you measure least privilege for a non-human identity?
Compare permissions granted with permissions exercised over a fixed window. This site uses the authority ratio: permissions granted against permissions exercised over ninety days. Fix the unit (service or action level), expand wildcards, and report the ratio with the date, tool and population so the next measurement is comparable.
Which cloud tools show unused permissions?
Per their documentation, AWS offers IAM Access Analyzer unused access findings and IAM last accessed information, Google Cloud offers IAM role recommendations based on up to 90 days of usage, and Microsoft offers CIEM in Defender for Cloud. Each has documented gaps, such as data plane access or Kubernetes RBAC.
Is it safe to remove every permission not used in 90 days?
No. Disaster recovery jobs, annual batches and incident runbooks can run less often than the window. Ask the named owner to list rare-path permissions first, stage the change outside production, keep the previous policy for rollback, and watch access-denied errors after the change.
Does workload identity federation give least privilege?
Not on its own. Federation removes stored long-lived keys and its trust conditions narrow who can obtain the identity, but the permissions attached to the federated role are unchanged. A federated role with administrator permissions is still an administrator, so right-sizing is still needed.
How should least privilege exceptions be handled?
Record each one with the identity, named owner, permissions kept, reason, compensating controls, an approver other than the owner, and an expiry date. Our suggestion is no more than twelve months for high-risk identities. Track exception age so expired exceptions are re-approved or removed.
Sources
- NIST SP 800-53 Rev. 5 (AC-6 Least Privilege, AC-6(7) Review of User Privileges), NIST, September 2020, updated December 2020
- NHI5:2025 Overprivileged NHI, OWASP Non-Human Identities Top 10, OWASP, 2025
- IAM Access Analyzer findings, AWS documentation, accessed 10 October 2026
- Refine permissions in AWS using last accessed information, AWS documentation, accessed 10 October 2026
- AssumeRole, AWS STS API Reference, AWS documentation, accessed 10 October 2026
- Role recommendations overview, Google Cloud documentation, accessed 10 October 2026
- Workload Identity Federation, Google Cloud documentation, accessed 10 October 2026
- Permissions management (CIEM) in Defender for Cloud, Microsoft Learn, accessed 10 October 2026
- What's Microsoft Entra Permissions Management?, Microsoft Learn, accessed 10 October 2026