Cybersecurity

    Non-Human Identity Security: How to Protect Service Accounts, API Keys and AI Agents

    By Santhosh K, Principal GRC Advisor, CyberWave GRC
    Published
    Last updated
    Cybersecurity

    Reviewed by Santhosh K, Principal GRC Advisor, CyberWave GRC · CISA, CISM, CCISO, HITRUST CCSFP, CHQP, ISO/IEC 27001 Lead Auditor

    Service account, API key, digital certificate and cloud workload protected by an identity shield

    Non-human identity security is the practice of protecting the accounts, keys and credentials that software uses instead of people. It covers service accounts, API keys, tokens, certificates, workloads and AI agents. The aim is to control what each one can access and to catch misuse quickly.

    What is a non-human identity, and how is it different from a human one?

    A non-human identity is any identity that is not a person. These identities log in, call services and move data without anyone typing a password. Because they run all day and can't respond to an MFA prompt, they often rely on static secrets that stay valid for months or years.

    AreaHuman identitiesNon-human identities
    Sign-in methodPasswords and MFAKeys, tokens and certificates
    LifespanTied to employmentOften no end date
    OwnershipA clear managerOften unclear or missing
    ActivityWorking hoursConstant and automated
    Typical riskPhishing and stolen passwordsLeaked keys and excess permissions

    That's why a normal login policy isn't enough. Machine identities need their own controls.

    Why NHI security matters

    Cloud platforms, CI/CD pipelines, SaaS integrations and AI tools all create new machine identities. Teams add them quickly and rarely remove them, and a single leaked key can open a database, a cloud account or a build pipeline. Attackers like these identities because their activity rarely triggers alerts.

    The most common non-human identity risks

    OWASP now publishes a separate Top 10 for non-human identities. In practice, most incidents come down to a few patterns:

    • Hardcoded secrets. A developer pastes a key into code, and it ends up in a public repository. Automated scanners find exposed keys very quickly.
    • Orphaned service accounts. The project ends, the team moves on, and the account stays active with nobody reviewing it.
    • Over-permissive access. A bot gets admin rights "to make it work" and keeps them.
    • Long-lived secrets. A key that never expires works for an attacker as well as for your app.
    • Unscoped API keys. Keys with no limits on scope or environment reach far more than they should.
    • AI agents with broad tool access. An agent can read files, call APIs and send data out. Without logs, nobody sees it happen.

    In October 2026, CERT-In reported that leaked secrets and over-permissive cloud roles were among the main ways AI agents reached Indian organisations' systems. Our CERT-In AI agent advisory checklist covers the steps.

    How to secure service accounts, API keys and AI agents

    Give each identity an owner, limit its access, and watch what it does.

    Service accounts

    • Apply least privilege to every account.
    • Assign a named owner.
    • Review permissions on a fixed schedule.
    • Disable accounts nobody uses.

    API keys and secrets

    • Store secrets in a secrets manager, never in code.
    • Scan repositories, including commit history, for exposed keys.
    • Rotate keys regularly and revoke any that leak.
    • Limit each key by scope and environment.

    AI agent identities

    • Give each agent its own identity, never a shared admin account.
    • Limit its access to the tools and data its task needs.
    • Require human approval for high-impact actions.
    • Log everything the agent does.

    Start with the identities that hold the most access, fix those, then work down the list. For more on agents, see our guide to AI agent security.

    What is NHI management?

    NHI management is the ongoing process of finding, owning, controlling and monitoring every machine identity in your organisation. It has five parts:

    1. Discovery: build a full inventory of service accounts, keys, tokens, certificates and agents.
    2. Ownership and classification: record who is responsible for each identity and how sensitive its access is.
    3. Access governance: set and review what each identity may do.
    4. Credential lifecycle: manage creation, rotation and removal.
    5. Monitoring: flag unusual behaviour so it can be fixed quickly.

    Many teams start with a spreadsheet and move to a dedicated tool as the numbers grow.

    Practices that make the biggest difference

    • Use short-lived credentials wherever the platform supports them.
    • Prefer workload identity federation over static secrets.
    • Automate provisioning, rotation and revocation, because manual rotation falls behind as identities multiply.
    • Alert on unusual access patterns, such as a key used from a new location or at an odd volume.

    How NHI security maps to SOC 2 and ISO 27001

    Auditors already expect machine identities to be controlled. If you are preparing for an audit, this is where NHIs show up:

    FrameworkWhere non-human identities appear
    SOC 2CC6.1 (logical access), CC6.2 and CC6.3 (provisioning, changes and removal of access), CC7.2 (monitoring)
    ISO 27001:2022A.5.16 (identity management), A.5.17 (authentication information), A.5.18 (access rights), A.8.2 (privileged access rights), A.8.15 and A.8.16 (logging and monitoring)
    DPDP ActReasonable security safeguards for systems that process personal data

    A common audit finding is a user access review that covers employees but leaves out service accounts and API keys. Include them, and record an owner for each. See our SOC 2 consulting and ISO 27001 consulting pages for how we help teams prepare.

    Frequently asked questions

    An identity used by software rather than a person, such as a service account, API key, token, certificate, bot or AI agent.

    Machine identities often outnumber people and hold broad access, so one leaked credential can cause a major breach.

    The terms overlap and are often used interchangeably. Machine identity management is sometimes used more narrowly for certificates and keys, while NHI management covers every non-human identity across its full lifecycle.

    Apply least privilege, assign an owner to each account, review access regularly and disable unused accounts.

    Yes. Logical access criteria apply to every account with access to in-scope systems, including service accounts and API keys.
    Hi! I'm your AI Assistant 💬