You discover a long-lived PaaS API token committed to a public Git repository by a contractor who left eight months ago. The token has account-admin scope. You don’t know who else has copies. Your CI builds use it, your Terraform state pulls it, and a stale serverless function on a forgotten staging account refreshes a DNS record with it every fifteen minutes. The first instinct — revoke and rotate now — is correct. The execution is where teams pull the trigger badly and trigger a cascade of build failures, broken deploys, and an hour-long firefight that gets blamed on “the security change” instead of the missing inventory.
What’s happening
A PaaS API token is not one credential. It is a scope (read-only, deploy, account-admin), an owner (a human or a service account), an audit trail (which IPs and user agents have hit the API with it), and a constellation of consumers (CI runners, IaC stacks, monitoring webhooks, the founder’s laptop). When you rotate, you are replacing the credential but leaving the constellation intact — except now half of the constellation is still presenting the old credential. The blast radius of a botched rotation is “every automated process that touches the PaaS until each one is reconfigured”, which on a mature environment is between five and twenty consumers, most of which you don’t have an inventory for.
The downtime expectation: zero for the platform itself (the API is fine, the running containers don’t care), measured in minutes for CI/CD (next push fails until the runner picks up the new token), and measured in hours if you discover an unknown consumer in production whose retry behavior masks the failure for a full TTL before something actually breaks. The “downtime” people fear isn’t the rotation — it’s the silent failure that surfaces during the next deploy or the next DNS refresh.
A clean rotation is two-phase: issue the new token alongside the old one, migrate consumers one at a time with verification, and only then revoke the old token. Single-phase rotation (revoke, then provision new) is appropriate for credentials you know are compromised and where the inventory is small enough to fix in under five minutes.
How to verify
Before you rotate, enumerate consumers. The PaaS audit log is the source of truth:
# Pull the last 30 days of API calls for the token's owner
curl -sS -H "Authorization: Bearer ${ADMIN_TOKEN}" \
"https://api.paas.example/v1/audit?actor=svc-deploy&since=$(date -d '30 days ago' +%s)" \
| jq -r '.events[] | [.timestamp,.source_ip,.user_agent,.action] | @tsv' \
| sort -u -k2,4
Look for distinct (source_ip, user_agent) pairs — each one is a consumer you need to reconfigure. GitHub Actions runners show up as actions/runner from GitHub IP ranges; Terraform Cloud as Terraform-Cloud/...; your own bastion as a static IP with curl/....
Cross-check against your secrets vault. If you can grep your Vault paths, the token name should appear in N places:
vault kv list -format=json secret/paas | jq -r '.[]' \
| xargs -I {} vault kv get -format=json secret/paas/{} \
| jq -r 'select(.data.data.token != null) | .data.metadata.created_time + " " + .data.data.token[0:8]'
If the count of grep hits is less than the count of distinct consumers in the audit log, you have shadow consumers — pull the rotation timeline.
The fix
The two-phase runbook, written so an operator with the API token and Vault access can execute it cold:
Phase 1 — issue the replacement, do not revoke yet.
# Issue new token, same scope as the one you're replacing
NEW_TOKEN=$(curl -sS -X POST \
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"name":"svc-deploy-2026-05","scope":"deploy","expires_in_days":365}' \
"https://api.paas.example/v1/tokens" | jq -r '.token')
# Store in Vault under a NEW path — do not overwrite the old one yet
vault kv put secret/paas/svc-deploy-2026-05 token="${NEW_TOKEN}"
Phase 2 — migrate consumers, one at a time, with verification.
For each consumer (CI, Terraform, monitoring webhook):
# Example: GitHub Actions repo secret
gh secret set PAAS_DEPLOY_TOKEN --body "${NEW_TOKEN}" \
--repo your-org/your-repo --env production
# Trigger a no-op deploy or a list call to confirm
gh workflow run deploy.yml --ref main -f dry_run=true \
--repo your-org/your-repo
# Wait for the run to complete green before moving to the next consumer
gh run watch --repo your-org/your-repo
Phase 3 — watch for stragglers, then revoke.
Leave both tokens active for one to seven days depending on how often consumers run. Watch the audit log for any continued use of the old token:
# Anything calling with the OLD token after 24h is an unknown consumer
curl -sS -H "Authorization: Bearer ${ADMIN_TOKEN}" \
"https://api.paas.example/v1/audit?token_id=${OLD_TOKEN_ID}&since=$(date -u -d '1 hour ago' +%FT%TZ)" \
| jq '.events | length'
When that number is zero for at least 24 consecutive hours (longer if you have monthly cron jobs), revoke:
curl -sS -X DELETE \
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
"https://api.paas.example/v1/tokens/${OLD_TOKEN_ID}"
# Tombstone the Vault path so nothing falls back to it
vault kv metadata delete secret/paas/svc-deploy
If the token is known-compromised, single-phase it. Revoke first, accept the five to twenty minutes of consumer breakage, and reconfigure consumers under incident protocol. Don’t compromise the rotation by leaving a public token alive overnight to “make it cleaner.”
Two operational hygiene rules to put in place after the rotation: cap token expiry at twelve months (the platform forces re-issuance and re-inventory), and tag every token with the consumer name and a renewal calendar entry in the same commit that introduces it. A token with no name and no expires_at is debt the next operator will pay for.
Stack Harbor manages PaaS environments end-to-end including credential lifecycle, IAM policies, and rotation runbooks under Managed Cloud Ops. If your token inventory is older than your last platform engineer, book a security audit on the Cloud PaaS tier.