Skip to content
Ashish.
All posts
Diagram illustrating the lifecycle of non-human identities and governance controls.

Non-Human Identity Governance for Agents

A guide to managing non-human identity governance, agent identity lifecycle, and scoped credentials for security and platform engineers.

By Ashish KumarPart 5 of AI and Identity Security

For security engineers, non-human identity governance is critical because identities are no longer exclusively human. Non-Human Identities (NHIs)—bots, service accounts, containers, and AI agents—now outnumber human identities by orders of magnitude. Treating an agent’s credential as a static password is a critical failure mode. NHIs require a governance model centered on lifecycle automation, explicit ownership, and scoped, short-lived credentials. This guide details the mechanisms for securing agent identities.

The Nature of Non-Human Identities

A Non-Human Identity is any identity used by an application, service, or automated process to access resources. Unlike Human Identities (HI), which are managed via user directories and often have interactive sessions, NHIs operate in machine-to-machine (M2M) contexts. They exhibit high velocity, meaning they spin up and down rapidly (ephemeral workloads), and they communicate programmatically.

The core risk with NHIs is "identity sprawl." When engineers create service accounts for testing, these accounts often persist long after the test is complete, accumulating excessive permissions over time. Without governance, these dormant NHIs become prime targets for lateral movement if compromised. Effective agent security requires addressing this sprawl immediately.

Lifecycle Management: Provisioning to Retirement

Governance begins with the identity lifecycle. For agents, this lifecycle must be automated and tied to the workload’s existence.

1. Provisioning

NHIs should be provisioned via Infrastructure as Code (IaC) rather than manual console clicks. This ensures that every identity is defined in version-controlled code. For example, in AWS, this means defining IAM Roles in Terraform or CloudFormation, not manually creating users in the console.

2. Rotation and Short-Lived Tokens

Static long-lived credentials (like AWS Access Keys or API tokens) are the highest-risk artifact in an NHI ecosystem. The mechanism for mitigation is short-lived credential rotation. Instead of a static key, agents should use temporary security credentials.

Consider an agent running on an EC2 instance. Instead of embedding an access key in the code, the agent assumes a role. AWS Security Token Service (STS) issues temporary credentials (access key, secret key, session token) that expire automatically (e.g., in 15 minutes). This limits the window of opportunity for an attacker who steals the credentials.

# Example: Assuming a role instead of using static keys
aws sts assume-role \
    --role-arn arn:aws:iam::123456789012:role/AgentRole \
    --role-session-name "AgentSession"

3. Revocation

Revocation must be immediate and automated. If an agent is decommissioned, its identity must be deleted or disabled instantly. This is achieved through lifecycle policies in IAM systems that link the identity’s existence to the resource group it serves. If the compute resource is terminated, the identity is revoked.

Ownership and Lineage

Proper identity ownership is critical; an identity without an owner is an orphan, and orphans accumulate privilege. Governance requires assigning a specific human or team as the "Owner" of each NHI. This owner is responsible for periodic access reviews.

Mechanism: Metadata Tagging

Ownership is enforced through metadata. Every NHI created via IaC must include tags such as Owner, CostCenter, and Application. These tags are used by governance tools to generate reports and trigger alerts if permissions drift from the owner’s expected scope.

Dependency Graphs

Advanced governance platforms map dependencies between NHIs and the services they access. If Agent A calls Service B, which calls Database C, the lineage graph shows this chain. If Agent A is compromised, the graph helps identify the blast radius. This visibility is critical for understanding the "blast radius" of any single NHI compromise.

Scoped Credentials: Least Privilege by Design

The most common misconfiguration for NHIs is the use of overly broad permissions. Effective credentials management enforces least privilege through scoped credentials.

Policy-as-Code

Permissions should be defined as code, allowing for review and auditing before deployment. Instead of granting s3:* on all buckets, the policy should grant s3:GetObject only on arn:aws:s3:::my-app-data/*.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject"
      ],
      "Resource": "arn:aws:s3:::my-app-specific-bucket/*"
    }
  ]
}

Just-In-Time (JIT) Access

For critical operations, NHIs should not have permanent access. JIT access allows an agent to request elevated privileges for a short duration, which are automatically revoked after the task completes. This is particularly useful for CI/CD pipelines that need to deploy to production but should not have standing production access.

Audit Trails and Monitoring

Finally, maintaining comprehensive audit trails for every action taken by an NHI is essential for monitoring and compliance. Centralized logging of NHI activity enables anomaly detection. Key metrics to monitor include:

  1. Unusual API Calls: An agent that typically reads data suddenly attempts to write or delete.
  2. Geographic Anomalies: Credentials used from unexpected regions.
  3. Time-Based Anomalies: Activity outside of expected operational hours.

Tools like AWS CloudTrail or Azure Monitor can aggregate these logs. Security teams should set up alerts for high-risk actions, such as iam:CreateUser or s3:DeleteBucket, regardless of the actor.

Conclusion

Non-Human Identity Governance is not a one-time setup but a continuous process. It requires shifting from static credentials management to dynamic, lifecycle-driven identity management. By enforcing clear identity ownership, automating rotation, and scoping permissions tightly, organizations can secure agent security in automated workflows against the growing threat of NHI compromise. The goal is to make every agent’s access minimal, temporary, and traceable, with robust audit trails ensuring accountability.

Related posts