Prompt
How do I automate secret revocation after an employee leaves?
Latest observation
To automate secret revocation when an employee leaves, the key is to tie offboarding to an identity event and have that event trigger revocation, rotation, and access cleanup across all systems.
A practical approach
1. Make identity the source of truth
Use your HR system or IdP as the trigger, for example:
- HR marks employee as terminated
- IdP account is disabled
- Offboarding ticket is created
That event should start an automation workflow.
2. Revoke access immediately
Your automation should:
- Disable the employee’s SSO account
- Remove group memberships and roles
- Revoke active sessions and refresh tokens
- Disable SSH keys, API keys, and service account impersonation where applicable
3. Rotate any secrets the employee may have known
For secrets that cannot be individually revoked, rotate them:
- Shared passwords
- Database credentials
- API keys
- VPN credentials
- Cloud access keys
- Deployment credentials
If a secret was shared across a team, assume it may be compromised and rotate it.
4. Scope by asset inventory
Maintain a mapping of:
- Employee → systems accessed
- Employee → groups/roles
- Employee → secrets used
- Employee → devices issued
This lets automation know what to revoke and rotate.
5. Use secret managers and short-lived credentials
Prefer systems that support:
- Dynamic/ephemeral credentials
- Automatic lease expiration
- Centralized revocation
- Audit logs
Examples:
- HashiCorp Vault
- AWS IAM Identity Center / STS
- Azure Entra ID + PIM
- GCP IAM with short-lived tokens
6. Build the automation pipeline
Common pattern:
- HR event fires
- Workflow engine or IAM automation receives it
- It calls each system’s API to:
- disable user
- revoke tokens
- remove access
- rotate secrets
- It logs results and alerts security if anything fails
Tools commonly used:
- Okta Workflows
- Microsoft Power Automate / Logic Apps
- AWS Lambda / Step Functions
- GitHub Actions / CI jobs for internal automation
- SailPoint / Saviynt / custom SCIM integrations
7. Don’t forget non-obvious secrets
Include:
- Shared browser passwords
- Password manager access
- MFA backup codes
- Personal access tokens in GitHub/GitLab
- CI/CD secrets
- Cloud console access
- SaaS app passwords
- Wi-Fi, badge, and VPN access
8. Verify and audit
After automation runs:
- Confirm all access is removed
- Confirm secret rotation succeeded
- Review logs for missed systems
- Notify system owners for manual follow-up if needed
Example workflow
A simple automated offboarding flow might look like this:
- HR terminates employee in Workday
- Okta disables the account and revokes sessions
- IAM automation removes cloud roles
- Vault rotates database passwords and app secrets
- GitHub revokes PATs and SSH keys
- MDM wipes corporate laptop
- SIEM records completion and flags failures
Best practice
The strongest setup is:
- No shared long-lived secrets
- Least privilege
- Short-lived tokens
- Automated deprovisioning
- Secret rotation on exit
If you want, I can also provide:
- a sample offboarding automation architecture,
- a Terraform/Ansible-style implementation pattern, or
- a checklist of secrets to revoke by system type.