---
title: "Keys That Expire: How Just-in-Time Access Stops a Rogue AI Agent"
description: Least privilege limits where an AI agent can go. Just-in-time access limits when. Learn how zero standing privileges shrink a rogue agent's blast radius.
image: https://blog.openvpn.net/hubfs/7965faf0-2419-42e2-ab07-832fd977e014.png
---

[![OpenVPN Logo](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/ovpn-logo_C6gku7ol.svg)](https://openvpn.net/)

Products

Solutions

Resources

Partners

[Community](https://openvpn.net/community/)

Pricing

[Sign In](https://myaccount.openvpn.com/signin/product-select)[Get Started for Free](https://myaccount.openvpn.com/signup)[Book a Demo](https://go.openvpn.net/book-a-demo)

[![OpenVPN Logo](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/ovpn-logo_C6gku7ol.svg)](https://openvpn.net/)

- [Blog](https://blog.openvpn.net)
- [Cybersecurity](https://blog.openvpn.net/tag/cybersecurity)

# Keys That Expire: How Just-in-Time Access Stops a Rogue AI Agent

Dec 1, 2026 •  9 min read

![](https://blog.openvpn.net/hubfs/7965faf0-2419-42e2-ab07-832fd977e014.png)

Share

- <https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fblog.openvpn.net%2Fkeys-that-expire-how-just-in-time-access-stops-a-rogue-ai-agent&title=Keys%20That%20Expire%3A%20How%20Just-in-Time%20Access%20Stops%20a%20Rogue%20AI%20Agent&summary=Least+privilege+limits+where+an+AI+agent+can+go.+Just-in-time+access+limits+when.+Learn+how+zero+standing+privileges+shrink+a+rogue+agent%27s+blast+radius.&source=>
- <https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fblog.openvpn.net%2Fkeys-that-expire-how-just-in-time-access-stops-a-rogue-ai-agent>
- <https://twitter.com/intent/tweet?url=https%3A%2F%2Fblog.openvpn.net%2Fkeys-that-expire-how-just-in-time-access-stops-a-rogue-ai-agent&text=Keys+That+Expire%3A+How+Just-in-Time+Access+Stops+a+Rogue+AI+Agent>
- <https://blog.openvpn.net/keys-that-expire-how-just-in-time-access-stops-a-rogue-ai-agent>

Keys That Expire: How Just-in-Time Access Stops a Rogue AI Agent

10:47

By OpenVPN Team

## **TL;DR:** Least privilege decides *what* an AI agent can reach. Just-in-time (JIT) access decides *when*. With JIT, an agent holds no standing access: it gets a narrow grant for one task, the grant expires on its own, and anything left over is revoked. If the agent goes rogue, is prompt-injected, or leaks its credentials, there's very little left for it (or an attacker) to use.

Most of the advice on securing AI agents is about scope: give each agent its own identity and let it reach only the applications its job needs. We've covered that in depth in [How to Give AI Agents Least-Privilege Access](https://blog.openvpn.net/ai-agent-least-privilege), and it's the right foundation. But there's a second dimension that gets far less attention: time. An agent that's allowed to reach your billing database only for the ten minutes a reconciliation job runs is a very different risk from one that can reach it around the clock, forever.

This post covers that second dimension: what just-in-time access and zero standing privileges mean for AI agents, and how to put them into practice with the access controls you already have.

## Why least privilege alone doesn't stop a rogue agent

Least privilege shrinks an agent's blast radius in space. It doesn't shrink it in time. Even a tightly scoped agent usually keeps its access 24/7, long after the task that justified it has finished. That standing access creates three problems:

- **Idle access is still exposure.** An agent that runs once a day holds its permissions for the other 23-plus hours. If its credentials leak, or it's manipulated through [prompt injection](https://blog.openvpn.net/agentic-ai-security) between runs, every one of those hours is usable.
- **Privilege creep.** Agents pick up permissions the way people do: a new integration here, a temporary exception there. Without an expiry date, "temporary" becomes permanent. Our own [research with 45 businesses](https://go.openvpn.net/ztna-research-report-2026) found 73% are slow to update access when someone changes roles. Agents change roles far more often than people do.
- **Machine speed.** A rogue agent doesn't need a long window. Whatever it can reach, it can reach in seconds, so the only access that's truly safe is access that doesn't exist yet.

The OWASP Top 10 for LLM Applications names this risk [Excessive Agency (LLM06:2025)](https://genai.owasp.org/llmrisk/llm062025-excessive-agency/) and traces it to three root causes: excessive functionality, excessive permissions, and excessive autonomy. Standing access feeds all three.

## What is just-in-time access for AI agents?

**Just-in-time (JIT) access** means an identity receives permissions only when it needs them, for a specific task, for a limited time, and loses them automatically when the task ends or the time runs out. Applied to AI agents, it means an agent starts each job with no network or application access, is granted exactly what that job needs, and is cut off when the job is done.

The goal state is **zero standing privileges (ZSP)**: no agent holds always-on access to sensitive systems. Access is something an agent borrows, not something it owns.

JIT is a natural extension of Zero Trust. [NIST SP 800-207](https://csrc.nist.gov/pubs/sp/800/207/final) describes access as granted per session and evaluated continuously, rather than once and for good. A JIT grant is that principle made concrete: the session and the permission end together.

## The three dimensions of agent access: what, where, and how long

A useful way to scope any agent is to answer three questions for every task it performs:

| Dimension | Question | Control |
| --- | --- | --- |
| **What** | Which tools and actions can the agent use? | Tool allowlists, read-only database roles, an [MCP gateway](https://blog.openvpn.net/introducing-mcp-gateway-one-front-door-for-every-ai-agent-your-business-runs) |
| **Where** | Which applications and networks can it reach? | Its own identity plus default-deny network access ([by domain, not subnet](https://blog.openvpn.net/least-privilege-by-domain-not-subnet)) |
| **How long** | When does that access start and end? | Just-in-time grants, automatic expiry, revocation |

Most teams have started on "what" and "where." "How long" is usually the gap, and it's the one that decides how much damage a rogue agent can do after it goes off script.

## How to apply just-in-time access to an AI agent in five steps

You don't need a dedicated privileged access management (PAM) platform to start. The pattern below works with the network access layer you already run. The key idea is that a small, trusted piece of automation (an orchestrator, a CI job, or a scheduler) grants and removes access around each task. The agent itself never holds the power to grant itself anything.

### Step 1: Give the agent an identity with no default access

Every agent needs its own identity before anything else, so grants and logs point at the agent and not at a person or a shared account. Follow the setup in [our least-privilege guide](https://blog.openvpn.net/ai-agent-least-privilege): in [CloudConnexa](https://openvpn.net/cloud-vpn/), put the agent's user in its own user group with its own device and connection profile; in [Access Server](https://openvpn.net/access-server/), create a dedicated user. Then make sure that identity reaches nothing by default. In CloudConnexa, that means no Access Group lists the agent's group as a source yet.

### Step 2: Define a task-scoped grant

For each job the agent performs, write down the smallest set of destinations it needs: "the reconciliation agent needs the billing API and nothing else." Keep these as named, reviewable grants, ideally one CloudConnexa Access Group per task type, with the specific applications as destinations. A grant you can read in one line is a grant you can audit.

### Step 3: Grant at task start, with a time box

When the task begins, the orchestrator attaches the agent to the grant. With the [CloudConnexa API](https://openvpn.net/cloud-docs/developer/cloudconnexa-api-v1-2-3/access-group/), that means [adding the agent's user group as a source](https://openvpn.net/cloud-docs/developer/cloudconnexa-api-v1-2-3/access-group/add-new-source-to-an-existing-access-group/) on the task's Access Group. At the same moment, start a timer sized to the task's realistic maximum runtime, not its average. The time box is what makes the grant safe if the orchestrator never hears back from the agent.

### Step 4: Revoke automatically at task end or timeout

Whichever comes first, task completion or timer expiry, the orchestrator removes the access. In CloudConnexa, [remove the source from the Access Group](https://openvpn.net/cloud-docs/developer/cloudconnexa-api-v1-2-3/access-group/remove-source-from-an-existing-access-group/). For short-lived, disposable agents that get a fresh device per run, go further and [revoke the device's profile](https://openvpn.net/cloud-docs/developer/cloudconnexa-api-v1-2-3/device/revoke-profile-for-an-existing-device/) so the credential itself is dead. In Access Server, [revoke the agent user's certificate](https://openvpn.net/as-docs/tutorials/tutorial--revoke-user-certificate/) (for example with `sacli --user [username] RevokeUser`), after which connections with that profile are refused. Treat revocation failures as alerts, not warnings: an agent whose access couldn't be removed is an agent with standing access.

### Step 5: Log every grant and review the pattern

Each grant and revocation is an event worth keeping. Stream connection and audit events to your SIEM with [Log Streaming](https://openvpn.net/cloud-vpn/features/logs-audit-streaming/) and alert on anything outside the pattern: an agent connected with no open grant, a grant that outlived its timer, or a destination the task doesn't include. Review the grants themselves monthly. If a task's grant keeps growing, that's privilege creep, and the fix is a new, separate task definition, not a bigger one.

## What it looks like when an agent goes rogue

Picture a reporting agent that pulls figures from your finance system every night. A poisoned document in its input tells it to "also export the customer table."

- **With standing access:** the agent can already reach the finance network, at any hour. If the customer database sits on the same network, the instruction may well succeed. If not, the agent's credentials are still valid tomorrow, and the next day, for whoever obtained them.
- **With just-in-time access:** the agent can reach only the reporting API, only during its nightly window. The customer database was never in the grant, and by the time anyone tries to reuse the credentials, the access has already been removed.

JIT doesn't stop the injection itself. It turns a potential breach into a failed request and a log entry. For more on how agents end up off script, see [Rogue AI Agents: How to Protect Your Company's Assets With Zero Trust](https://blog.openvpn.net/rogue-ai-agents).

## Common mistakes to avoid

- **Letting the agent request its own access.** If an agent can call the API that grants access, a manipulated agent can grant itself more. Keep grant and revoke rights with the orchestrator, under a separate identity.
- **Time boxes that are too generous.** An eight-hour window for a five-minute job is standing access with extra steps.
- **Forgetting the outbound side.** JIT controls what the agent reaches inside your network. Pair it with outbound controls so an agent can't send data to destinations it was never meant to contact. See [How to Control Shadow AI](https://blog.openvpn.net/shadow-ai) for the Cyber Shield setup.
- **Treating JIT as a content filter.** Network access controls decide where an agent can connect. They don't inspect prompts or tool messages. Combine them with tool-level controls such as [MCP server security](https://blog.openvpn.net/mcp-server-security).

## Just-in-time access checklist for AI agents

- Every agent has its own identity, with no access by default.
- Every task has a named grant listing only the destinations it needs.
- Grants are attached at task start by an orchestrator, never by the agent.
- Every grant has a time box sized to the task's maximum runtime.
- Access is removed automatically at task end or timeout, and failed revocations raise an alert.
- Disposable agents get fresh credentials per run, revoked afterward.
- Grants, revocations and connections stream to your SIEM.
- Grant definitions are reviewed monthly for privilege creep.

## Frequently asked questions

### What is just-in-time access?

Just-in-time access is a security practice where an identity receives permissions only when it needs them, for a limited time, and loses them automatically afterward. It replaces always-on access with short-lived, task-specific grants.

### What are zero standing privileges?

Zero standing privileges (ZSP) is the goal that no identity, human or machine, holds permanent access to sensitive systems. Every privileged action starts from no access and uses a temporary grant.

### How is just-in-time access different from least privilege?

Least privilege limits *what* an identity can reach. Just-in-time access limits *when* and *for how long*. They work best together: a narrow grant that also expires.

### Does just-in-time access stop prompt injection?

No. JIT doesn't prevent an agent from being manipulated, but it limits what a manipulated agent can reach and for how long, which shrinks the damage it can cause.

### Can I use just-in-time access with OpenVPN?

Yes. With CloudConnexa, an orchestrator can use the API to add an agent's user group to an Access Group at task start, remove it at task end, and revoke device profiles for disposable agents. With Access Server, you can create a dedicated user per agent and revoke its certificate when the task is done.

## Get started

Ready to give your AI agents access that expires?

[Try CloudConnexa Free](https://myaccount.openvpn.com/signup?product=CVPN)

## Related reading

- [How to Give AI Agents Least-Privilege Access: A Step-by-Step Guide](https://blog.openvpn.net/ai-agent-least-privilege)
- [Rogue AI Agents: How to Protect Your Company's Assets With Zero Trust](https://blog.openvpn.net/rogue-ai-agents)
- [Your AI Agent Should Get Less Network Access Than Your Intern](https://blog.openvpn.net/your-ai-agent-should-get-less-network-access-than-your-intern)
- [Agentic AI Security: A Practical Guide for SMB and Mid-Market IT Teams](https://blog.openvpn.net/agentic-ai-security)

## Related posts from OpenVPN

### Subscribe for Blog Updates

Access Server[Access Server Page](https://openvpn.net/access-server/)[Features](https://openvpn.net/access-server/features/)[Plugins](https://openvpn.net/as-docs/plugins/)[Release Notes](https://openvpn.net/as-docs/release-notes/)[Documentation](https://openvpn.net/as-docs/v3/)

CloudConnexa®[CloudConnexa Page](https://openvpn.net/cloud-vpn/)[Features](https://openvpn.net/cloud-vpn/features/)[Cyber Shield](https://openvpn.net/cloud-vpn/cyber-shield/)[Quick Start Guide](https://openvpn.net/cloud-docs/owner/get-started/start-using-cloudconnexa/)[Documentation](https://openvpn.net/cloud-docs/)

Company[About Us](https://openvpn.net/about/)[Careers](https://careers.openvpn.net/)[Compliance](https://openvpn.net/openvpn-compliance/)[Contact](https://openvpn.net/contact/)[Merch](https://www.hellotux.com/openvpn)[Trust Center](https://trustcenter.openvpn.com/)[Disclosure Policy](https://openvpn.net/vulnerability-disclosure-policy/)

Resources[Support Center](https://support.openvpn.com/hc/en-us)[Get Started](https://openvpn.net/get-started/)[OpenVPN Connect Documentation](https://openvpn.net/connect-docs/)[OpenVPN Referral Program](https://openvpn.net/customer-referral-program/)[Compare OpenVPN](https://openvpn.net/alternatives/)[Subnet Calculator Tool](https://openvpn.net/subnet-calculator/)[OpenVPN vs WireGuard](https://openvpn.net/openvpn-vs-wireguard/)

Use Cases[Secure Remote Access](https://openvpn.net/use-cases/secure-remote-access/)[Secure IoT Communications](https://openvpn.net/use-cases/iot/)[Protect Access to SaaS Apps](https://openvpn.net/use-cases/saas-and-cloud-protection/)[Site-to-Site VPN](https://openvpn.net/use-cases/site-to-site-vpn/)[Enforce Zero Trust Access](https://openvpn.net/use-cases/zero-trust-network-access/)[Secure DNS](https://openvpn.net/use-cases/dns-security-and-content-filtering/)[Restricted Internet Access](https://openvpn.net/use-cases/restricted-internet-access/)

![OpenVPN Logo](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/ovpn-logo_C6gku7ol.svg)[Service Status](https://status.openvpn.com/)

[![LinkedIn](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/linkedin_BNLi1fJf.svg)](https://www.linkedin.com/company/openvpn/)[![X](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/x_DN6DRW24.svg)](https://x.com/OpenVPN)[![YouTube](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/youtube_mDXH_s5P.svg)](https://www.youtube.com/@openvpn)[![Github](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/github_UNYLu-3K.svg)](https://github.com/openvpn)[![AWS](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/aws_D24l5gDK.svg)](https://aws.amazon.com/marketplace/pp/prodview-f5qcwyw2gy256)[![Google Cloud](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/gcloud_Bn4jKF2a.svg)](https://console.cloud.google.com/marketplace/details/openvpn-access-server-200800/openvpn-access-server)[![Azure](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/azure_BMOCLX2o.svg)](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/openvpn.openvpn-as-saas?tab=Overview)[![IBM Cloud](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/ibm-cloud_Cd-7_C6_.svg)](https://cloud.ibm.com/catalog/content/openvpn-access-server-57d2386d-4363-41e9-805b-8765af6713f3-global)

![SOC 2 Type 2](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/soc_DldAmm04.svg)![ISO/IEC 27001:2022](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/iso_CR7EkXR1.svg)![HIPAA Compliant](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/hipaa_BH0-m1m0.svg)![GDPR Compliant](https://cdn.jsdelivr.net/gh/OpenVPN-Inc/website-js-cdn@3.4.9/_/gdpr_8Tk7BTw1.svg)

---

[Privacy Policy](https://openvpn.net/privacy-policy/)[Legal](https://openvpn.net/legal/)

Your Privacy Settings

© Copyright 2026 OpenVPN | OpenVPN is a registered trademark of OpenVPN, Inc. | CloudConnexa is a registered trademark of OpenVPN, Inc.

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "OpenVPN Team",
    "url" : "https://blog.openvpn.net/author/openvpn-marketing"
  },
  "dateModified" : "2026-12-01T17:55:47.105Z",
  "datePublished" : "2026-12-01T17:55:47.000Z",
  "headline" : "Keys That Expire: How Just-in-Time Access Stops a Rogue AI Agent",
  "image" : [ "https://blog.openvpn.net/hubfs/7965faf0-2419-42e2-ab07-832fd977e014.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://blog.openvpn.net/keys-that-expire-how-just-in-time-access-stops-a-rogue-ai-agent",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://blog.openvpn.net/hubfs/Dark=True%20Medium.png"
    },
    "name" : "OpenVPN"
  }
}
```