Just-in-time access gives an engineer, a service or an AI agent a privilege when a task needs it and takes it away when the task ends. The account that runs a ten-minute migration doesn’t need production write access for the rest of the day.

What is just-in-time access?

Just-in-time access (JIT access) is an access model in which a user, service or AI agent receives a privilege only when a specific task requires it, for a limited time, and loses it automatically when that time ends. Applied to admin and production rights, it’s called just-in-time privileged access, or JIT privileged access. Time-bound access, temporary elevated access and ephemeral access are other names for the same idea.

NIST defines least privilege as restricting access privileges to the minimum necessary to accomplish assigned tasks. JIT adds a clock to least privilege: the minimum privilege, for as long as the task takes, with a reason someone can read later.

What it replaces is standing access. A quick way to see how much of it you have is to list everyone who could write to the production database right now, then everyone who actually did in the last month. Whoever is on the first list and not the second holds a privilege they don’t use. It still works at 3 a.m. for anyone who steals their credential, and for a script with a bug or an agent that misreads its instructions.

How JIT access works

Every just-in-time access management system, whatever it calls itself, comes down to five steps: a request for a specific privilege with a reason and a duration, a decision by a person or a rule, a grant no wider than the task, an expiry that nobody has to remember, and an audit record that ties them together. The same loop covers a database, a server over SSH, a Kubernetes cluster, an MCP server or a cloud role.

Each step has one thing it has to get right:

  1. The request names one resource and one action. “Production access” isn’t something an approver can judge.
  2. Someone other than the requester decides, or a rule does.
  3. The grant is the narrowest thing the system can create: a temporary role, a short-lived credential, or a time-limited exception to a policy that otherwise denies the action.
  4. The system ends the grant when the window closes or the single operation completes. A calendar reminder to revoke it doesn’t count.
  5. The request, the reason, the approver, the grant and what happened during the window end up in one record, so an audit doesn’t mean stitching three tools together.

JIT access requests

An approver can only judge what the request tells them. A JIT access request that says “need prod” leaves two options, rubber-stamping it or starting a thread, and neither is good. A useful request answers four questions: who is asking, what they need (a resource and an action), why (a ticket, an incident, one sentence) and for how long.

The “who” deserves the most care. It should come from how the requester authenticated rather than from a field they filled in, and it should be a named person or agent. A shared account tells the approver nothing. This matters most for agents, which write their own request payloads.

Then there’s speed. A request that waits overnight in a ticket queue teaches people to keep a shared password around for next time. An approve button in the chat the approver already has open can be answered in minutes.

Where expiry is enforced

Microsoft’s documentation for just-in-time VM access in Defender for Cloud states a limit plainly: connections that are already established aren’t interrupted when the approved period expires (as of November 2026). The port closes, new connections fail, and the session someone opened ten minutes before the deadline carries on.

The same gap can appear whenever JIT changes something that is only checked at login or connection time, such as a firewall rule or an identity provider role mapped to a database login. Removing it stops the next connection. It does nothing to the open one.

A proxy that evaluates every request avoids this, as long as the block is checked per request. In Formal, request rules run before each query, and a time-bound suspension covers matching requests only until it expires, so once the window closes the next query in the same session hits the block again. A policy with only a session rule is evaluated when the connection opens, which is why we’d write production blocks as both, the way the Devin example below does.

Just-in-time access and zero standing privileges

Extend just-in-time access control to every sensitive privilege and you have zero standing privileges: between tasks, no person or AI agent holds production writes, root or admin roles. Everyday access, such as reading a staging database, can stay. A request flow alone doesn’t get you there, because a shared database password or an API key in an agent’s environment is standing access that never passes through an approval. The guide to zero standing privileges covers the full model.

Types of JIT access: time-bound, one-off and ephemeral access

Two questions sort the types of JIT access: when does the grant end, and what exactly is temporary?

The first has two answers. Time-bound access covers every matching action until the window closes, for example writes to one database for two hours, and most JIT access is this kind. One-off access covers a single operation and is used up by its first match. It fits the reviewed DELETE someone needs to run once, and when a task really is one statement it’s the better choice, because nothing stays open after the statement runs.

For the second, the temporary thing can be a credential, a role or a policy exception. Ephemeral credentials come from a broker and last minutes or an hour, so nobody holds a long-lived password (CI/CD secrets management applies the same idea to pipelines). Temporary elevation is the cloud and identity platform version: the user joins a privileged role or group, then leaves it. A policy exception is different. It leaves the identity alone and lifts a default-deny rule for that identity, often only for matching requests; in Formal, a condition such as input.sql_query.statement_type == "DELETE" && input.db_name == "billing" (from the suspension docs) limits the exception to deletes on one database.

For data access we’d combine them. The ephemeral credential settles who is connecting, a time-bound or one-off exception settles what they may do, and both run out on their own. A temporary role on its own is the coarsest option, since it hands over everything the role allows for the whole window.

Examples of just-in-time access

An engineer has a two-hour migration to run on the production database. She requests write access for two hours with the ticket as the reason, a teammate approves in Slack, and the block on production writes is lifted for her alone. When the two hours are up, the block applies to her again without anyone touching it.

At night, an incident needs root on a server. The on-call engineer asks, the on-call lead approves because the usual approver is asleep, and the access is time-limited and reviewed the next morning. That’s break-glass, planned in advance instead of improvised with a shared password.

Just-in-time admin access follows the same pattern at the identity layer: an administrator activates an admin role for 30 minutes to change an identity provider setting, then drops back to a regular account.

A coding agent debugging an issue needs to read a table. It asks for read access for its current session, the person who started it approves, and the agent’s next session starts without it.

Just-in-time access for AI agents

For agents, the setup JIT usually replaces is a shared database password sitting in the agent’s environment. Every session then has standing access, and nothing records which person wanted it. That’s worse for an agent than for a person. Agents run unattended, act fast and follow instructions that can come from untrusted content, one of the central agentic AI security risks, so a standing credential is available to anyone who can plant instructions in what the agent reads. Just-in-time access for AI agents uses the same loop as for engineers, with three extra rules.

The agent has its own identity (see AI agent identity): a short-lived token from its platform, OIDC for example, that also names the human who started the session. It can request access but never approve it. The person who started the session usually approves, and the grant is created by an identity other than the agent’s, so the agent has no way to grant itself access. And the grant’s scope comes only from verified token claims. The agent writes its own request, so it can pick the reason and the duration, which the approver sees, but which person and which session the grant covers has to come from the token.

The Devin integration shows all three. Until someone approves, a default-deny policy on Devin’s machine user refuses its psql connection with the message Devin is blocked by default; request JIT access. To ask, Devin calls a workflow and passes two values, a short reason and an expiration in minutes. The Slack message that reaches the session’s owner carries both, along with the Devin session ID. If they click Yes, a separate workflow machine user creates the suspension, and its condition matches only the requester’s email and that session ID, both read from the token. The docs explain why the payload stays out of the condition: Devin controls it and could inject CEL. Once the minutes run out the exception ends, and the next Devin session has to ask again. The setup guide has the policy, the workflow and the script.

How do you implement just-in-time privileged access?

You implement just-in-time privileged access by finding the standing privileges you already have, blocking the sensitive actions by default, and turning each grant into a short, scoped and approved exception that leaves a record. These are the just-in-time privileged access best practices we’d follow with any JIT access management tool, roughly in this order:

  1. Inventory who holds production, admin and root rights, and how often each is used. Privileges used once a month can move behind JIT right away. The ones used every hour need a fast approval path first, or people will route around it.
  2. Deny the sensitive action at the resource and make every grant an exception to that deny. A grant someone forgot about then expires into a block.
  3. Offer a few fixed durations instead of a free-text field, and ask for more justification as the window gets longer.
  4. Send approvals to the chat the approver already uses. Ticket queues are fine for permanent access changes and too slow for a task someone wants to start now.
  5. Scope each grant to one identity and one resource, and narrower where the tool allows it: one statement type, one database, one session.
  6. Keep requester and approver apart. Nobody approves their own request, and no agent approves anything.
  7. Store the reason with the activity, so an auditor reading the queries from the window also sees who asked, why, and who said yes.
  8. Settle break-glass before you need it: who approves when the usual approver is asleep, and who reviews each use the next day.

How does JIT access relate to PAM?

Privileged access management (PAM) covers more than just-in-time access: it brokers connections to sensitive systems, manages credentials, records sessions and audits activity. Just-in-time privileged access management is the piece of PAM that decides when a privilege exists at all.

Where that piece sits decides what it can take away. Identity-layer tools, often sold as PIM (privileged identity management), activate and remove role memberships. Access-layer PAM tools sit in the connection to the database or server, so they can also stop a grant in the middle of a session or limit it to one kind of statement. For production data we’d put the check at the access layer, for the reason covered under expiry above. Our StrongDM alternative page sets StrongDM’s access workflows next to Formal’s policy suspensions, and the roundup of PAM tools with just-in-time access shows how ten vendors handle approvals.

How Formal implements just-in-time access

In Formal, a sensitive action is blocked by an ordinary policy, and a JIT grant is a policy suspension of that policy. Policies are written in Rego and enforced by the Formal Connector, a reverse proxy in front of resources such as Postgres, Snowflake, SSH and Kubernetes. A suspension exempts one user or group from one policy, either one-off (the first matching request) or time-bound (every matching request until it expires), and it can be narrowed with a CEL input condition such as input.resource.name == "prod-postgres". It stores a reason for the audit trail. Deleting it revokes access immediately, and Formal removes expired suspensions automatically.

Two behaviors from the docs are worth knowing before you automate this. If an input condition fails to compile, or returns something other than a boolean, the suspension silently never applies and the requester stays blocked, so test the condition before it goes into a workflow. And a suspension created through the API without expiration_minutes expires after 24 hours, which is long for most tasks, so set the duration and oneoff explicitly.

Formal Workflows run the request and the approval. A workflow starts from an API call, or from a form submitted in Slack or with formal form fill in the Endpoint. Its ask-in-chat step sends a Yes/No message to a Slack channel or to up to 25 approvers by email, and the first answer decides. A step running as a machine user then creates the suspension, and a last one messages the requester. Workflows are YAML and can be managed with Terraform or through the API. They sit on the same AI agent governance platform as the policies and the logs.

Employees who hit a block can also ask from the employee Catalog, for a one-time exception or for time-bound access between 30 minutes and 7 days. The request lands in the Access Requests queue, where an admin’s approval creates the suspension. The queue sends no notifications, so time-sensitive requests are better served by a Slack workflow.

For agents that sign in with OIDC, Formal issues federation tokens that expire with the upstream token or after one hour, whichever comes first. JIT is part of Formal PAM, where the same Connector can block a statement before it runs or mask a column in the result.

The Cursor case study lists this outcome: “No standing production access. Engineers request just-in-time access for a specific operational need instead of holding permanent production permissions.”