Cut a user off now
When an account is compromised or someone leaves in a hurry, stop their sign-in, sessions, tokens and agents in minutes, and know what still lags and for how long.
API
A laptop is stolen, a password turns up in a paste, or someone leaves on bad terms. You need everything they hold to stop now: new sign-ins, the sessions they have open, the tokens apps hold for them, and the agents that act in their name. No single switch does all of it, so this runbook takes four steps, in an order that closes each door before the next. Done in order, it takes a few minutes.
Before you start:
- Who can do it: a realm administrator, in a group that holds
RealmOwner(Delegated administration). - Where: today this is done through the API, with your session in
$CVYUH_SESSION(Call the API). Sign in once and keep the session for the whole runbook. - What you need: the user’s name, here
ben, and their id (GET https://foobar.cvyuh.com/api/v0/am/objects/v1/user/benanswers it asid).
Cut them off
Section titled “Cut them off”-
Deactivate the user. From this moment they can’t sign in, no app can get a new token for them, every refresh token they hold stops working, and introspection reports their tokens inactive:
Terminal window curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/user/ben \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "status": "inactive" }'Deactivating also stops every agent whose chain leads up to
ben: each agent’s token request walks up its chain to the user at the top, and an inactive user stops it. -
End every session they hold. Deactivating doesn’t end sessions already open, so end them all. Each ending is a sign-out: apps that listen for back-channel logout end their own sessions, and tokens issued under the session are revoked:
Terminal window curl https://foobar.cvyuh.com/api/v0/am/sessions/v1/end \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "qbe": { "filter": { "field": "user", "op": "=", "value": "<ben id>" } } }'The realm answers how many it ended:
{ "ended": 3 }. -
Stop the agents they own. An agent whose business owner is
benbut whose chain leads up to someone else keeps running after step 1. List the agents he owns:Terminal window curl https://foobar.cvyuh.com/api/v0/am/objects/v1/user/ben/relationships/ownedAgents \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"and quarantine each one, which also stops every agent under it:
Terminal window curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/agent/invoice-agent \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "status": "quarantined" }'Quarantine can be undone; kill an agent only when you’re sure (Stop an agent).
-
Rotate what they knew. If they could read an app’s client secret, rotate it, so a copy they kept stops working once the overlap you choose ends (Rotating a secret with an overlap).
How fast each kind of API stops
Section titled “How fast each kind of API stops”New sign-ins, new tokens and refreshes stop at once, everywhere, because only the realm issues them. A token already issued stops as fast as the API that checks it learns of it:
| Where the token is checked | It stops working |
|---|---|
| The realm itself: userinfo, refresh, token exchange | At once |
| An API that introspects each token, or asks the realm for a decision | At once |
| An API behind the gateway | Within seconds, at the gateway’s next revocation poll (10 seconds by default) |
| An API that checks signatures and reads status lists | Within a minute |
| An API that checks signatures only | When the token expires: five minutes by default |
| An app’s own session, if the app ignores back-channel logout | When the app next needs a token, or its own session ends |
See How fast revocation takes effect to make the slow rows faster.
Check it worked
Section titled “Check it worked”- The user reads
"status": "inactive", andGET https://foobar.cvyuh.com/api/v0/am/sessions/v1with a filter on their id lists no sessions. - Their agents read
quarantined. - On the audit trail (Read a user’s or agent’s trail, or
Audit → Authentication and Audit → Config in the dashboard):
- the deactivation, as
PATCHEDwithstatusbefore and after; - one
LOGOUTfor each session ended; AGENT_QUARANTINEDfor each agent;- from then on, any attempt:
LOGIN_FAILEDwith the reasonAUTH_USER_INACTIVE, andTOKEN_ISSUEDrefused for any app or agent that asks for a token for them.
- the deactivation, as
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| The user still reaches an app | The app checks tokens by signature only, or keeps its own session and ignores logout | Wait out the access token (5 minutes by default); put the API behind the gateway or have it introspect; have the app listen for back-channel logout |
| An agent still gets tokens | Its chain leads to another user, and it wasn’t quarantined | Quarantine it (step 3), or the agent above it |
Ending sessions answers { "ended": 0 } | They had no live session, or the id is wrong | Check the id from the user’s record |
| An app still uses a secret they knew | It wasn’t rotated | Rotate it (step 4) |
Undo it
Section titled “Undo it”Set { "status": "active" } on the user, and set each agent back to active (released agents are recorded as
AGENT_RELEASED). Sessions don’t come back: the user signs in again, and apps ask for new tokens.
Related
Section titled “Related”- End a user’s sessions: sessions alone, when the account isn’t at risk.
- Turn access off and on: the user’s
statusandaccountExpiry. - Stop an agent: quarantine, kill and retire.
- Session management: listing and ending sessions.
- Look into a locked account: reading the trail.