When someone leaves, their API keys stay: how to offboard the access people create
Most offboarding checklists stop at the same point: disable the login, collect the laptop, remove the person from the group chat. That handles the person. It doesn't handle what the person built. Over a year or two, an
Most offboarding checklists stop at the same point: disable the login, collect the laptop, remove the person from the group chat. That handles the person. It doesn't handle what the person built.
Over a year or two, an engineer, analyst or ops lead creates access that isn't tied to their own sign-in. A service account for a nightly job. An API key pasted into a reporting script. An OAuth grant that lets a SaaS tool read the shared drive. And now, an AI agent connected to their mailbox or the ticketing system. Some of this breaks loudly when they leave. Most of it keeps running with nobody watching.
The quiet part is the risk. Verizon's 2025 Data Breach Investigations Report says credential abuse is still the most common way attackers get in, and that the median time to remediate leaked secrets found in a GitHub repository was 94 days. A key with no owner is a key nobody rotates.
This is the order I'd work in.
1. Start the list during the notice period
In the first week of notice, ask the person leaving for a written list: every service account, API key, token, webhook, scheduled job and AI tool they set up or connected. They know more than any scan will find. Make it a handover task with a due date, not a favour.
2. Check their list against what your systems show
Memory misses things, so verify. Look in:
- Your identity provider (Okta, Microsoft Entra, Google Workspace): app grants and OAuth consents made by that user.
- Cloud consoles (AWS, Azure, GCP): access keys, roles and service principals they created or last used.
- Code repositories and CI/CD: secrets stored under their name, deploy keys, personal access tokens used by pipelines.
- SaaS admin panels: integrations they installed, especially anything with "read all files" or "send as user" permissions.
- AI tools: any agent or assistant connected through their account to mail, files, CRM or chat.
Anything the systems show that isn't on their list goes to the top of the review.
3. Give every item a named owner
A person, not a team. "The data team" owns nothing at 2 a.m. when a job fails. The new owner should know what the item does and be able to say whether it still needs to exist.
4. Decide: keep, move or retire
- Keep it if it's needed and already runs on its own identity with narrow permissions. Change the owner and move on.
- Move it if it runs on the departing person's own credentials. Create a dedicated service identity, give it only the permissions the job actually uses, switch the job over and confirm the next run succeeds.
- Retire it if nobody can explain what it's for. Disable it rather than delete it, and wait two weeks to see if anything complains.
5. Rotate the secrets they could see
They probably had access to more secrets than they created: shared vault folders, .env files, config for tools they administered. Rotate those too. It isn't about trust. Former employees' laptops and password managers get compromised like anyone else's.
6. Disable the login on time, delete the account last
Cut interactive access on the last day as normal. Hold off deleting the account until steps 3 to 5 are done, because in some platforms deleting a user also removes or breaks what they owned. Then watch the logs for a week for failed authentications tied to the old account. Each one is something you missed.
7. Give AI agents their own line
Agents are where this gets harder each month. An agent connected "as me" inherits everything that person could do, and it may keep its own saved connections outside your identity provider. IBM's Cost of a Data Breach Report 2025 found that 13% of organisations reported breaches of AI models or applications, and 97% of those said they lacked proper AI access controls. For each agent the person connected, revoke its tokens in the source app (not only inside the agent), and if the work still matters, rebuild it under a dedicated identity with an owner.
8. Make sure the list exists next time
The real win is never having to rebuild this from memory again. Three habits cover most of it:
- Every new service account, key or agent gets an owner and an expiry date when it's created.
- Quarterly access reviews include non-human identities, not only people.
- The offboarding checklist has a "things you created" section that both the manager and IT sign off.
You can do all of this with admin consoles and a spreadsheet. It's slower, and it depends on someone remembering every time, so it's worth automating the discovery step once you've done it by hand a couple of times. Whatever you use, the steps above are what matter: an owner, a decision and a rotation for everything a departing person leaves behind.
Originally published on my Substack: https://nurankhan.substack.com/p/when-someone-leaves-their-api-keys
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.