Skip to main content
INS // Insights

PagerDuty keys out of CI

Updated November 2026 · 7 min read

Rutagon removes full-access PagerDuty keys from continuous integration, for a team whose pipeline still holds an account API key so a job can open an incident. A PagerDuty API key of that kind leaves the CI variables, and a scoped OAuth client calls the API instead.

Book a technical call

PagerDuty API key

The key in CI is usually an account-level API key or a user token that can do far more than the job does. The job creates an incident, looks up an on-call, or posts a change. The key can administer the account. It sits in a masked variable, which means it is still a standing secret every build can read. Masking is not scope. The delivery deletes that variable after the pipeline works with an OAuth client whose scopes cover the calls the job actually makes, and nothing broader we can avoid.

PagerDuty's developer surface is the place those calls and the OAuth client are defined. We use the published interface at the PagerDuty developer platform. We do not scrape the web app with a personal login. The client is registered in your PagerDuty account. The pipeline obtains a short-lived token for the run. The full-access key is revoked, not left beside the new client "for emergencies." An emergency path that is a copy of the old key is the old key.

Routing keys for the events endpoint are a different secret. They integrate one service's events, and they are not a full-access REST key. This engagement removes the REST key from CI. We do not rotate every events routing key in the company unless you placed that routing key in CI as if it were the admin key. If you did, it leaves CI too. If it lives only in the application that emits events, we name it and we do not pretend this job deleted it.

Hardcoded credentials in CI is the neighboring cleanup when the secret is baked into a repository rather than a variable. The last long-lived key removed from CI is the pattern for AWS keys specifically. Here the key is PagerDuty. The same rule applies: the pipeline identity is scoped, and the standing admin credential is gone. Security automation is the lane.

Rutagon does the cutover from Alaska. We list every project variable, organization variable, and repository secret whose name or value prefix shows a PagerDuty REST key. A key hidden in a general-purpose vault variable that the job also uses is in scope once we see the job read it. We do not stop at the variable that happens to be named PAGERDUTY.

What the pipeline gets instead

The OAuth client has the scopes the job needs. A job that creates incidents does not receive a client that can delete users, change the account plan, or read every schedule in the company if a narrower scope exists for the call. Where the published scopes are broader than the single call, we use the narrowest published scope that lets the job succeed, and we write that limitation down. We do not invent a scope the product does not offer and then fail the build.

The client secret is still a secret. It is stored in the CI secret store, not in the repository. It is not a full-access API key, and it is not pasted into a shell history on a laptop. Access to change the client is the PagerDuty admin you name, not every developer who can edit a pipeline file. The pipeline requests a token at runtime. The token is not written to the log. A debug flag that prints headers is turned off for that step, and we check a sample log to prove the token did not land there.

removed: full-access API key in CI variables
replacement: oauth client registered in the account
scopes: the calls the job makes, narrowed to published scopes
token: obtained for the run, not stored as the account key
log_check: a sample build log with the token absent
revoked: the old key, after a green run

The order is fixed. The new client works on a branch for one successful job. Then the old key is removed from CI. Then the old key is revoked in PagerDuty. Then we run the job again. A revoke before the new path works is an outage we will not cause. A new path that works while the old key still sits in CI is not finished, because the standing key is the finding.

Local scripts that developers run with the same key are on the list. A key removed from CI and left in a dotfile on three laptops will be copied back. We replace those scripts with the same client flow or we delete the script if the pipeline now does the job. Someone's laptop is not an emergency exception we leave undocumented.

What we will not leave behind

We will not leave the full-access key in a second variable with a less obvious name. The search includes values we are allowed to fingerprint, names, and the job definitions that reference them. A finding we cannot revoke because nobody knows which integration it feeds is escalated, not skipped. The owner you name decides. An unknown key is not "probably unused" and left in place.

We will not move the key into AWS Secrets Manager and call that elimination. A standing full-access key in a secret store is still a standing full-access key. The CI job would still retrieve an admin credential. The replacement is the OAuth client and a short-lived token. A store may hold the client secret. It does not hold a copy of the key we just revoked.

We will not widen into every SaaS token in the company. Datadog, Slack, and the cloud provider have their own standing secrets. If we see them in the same CI project we are editing, we will name them. We will not revoke them inside this engagement unless the statement of work says so. Scope creep is how the PagerDuty key survives another quarter while a larger program is designed.

Events-only integrations that already use a routing key inside the application, and never in CI, stay. We document that they were out of scope. An auditor who asks "did you remove every PagerDuty string in the company" gets an honest boundary. The boundary is CI and the full-access REST keys that pipelines and the scripts beside them used.

Handover is the list of keys removed, the client and its scopes, the green run after revocation, and the log sample. Your team can create the next pipeline step without pasting an account key. On a production SaaS platform a deploy credential that could administer more than the deploy was treated as a defect even when it was masked. A PagerDuty key that can administer the account, stored for a job that opens one incident, is that defect.

How a new job stays narrow

The client we leave is allowed to mint tokens for the scopes on that client. A new pipeline job that needs a new kind of call gets a scope change you review, or a separate client. It does not get the old account key pasted back because the scope change takes a day. We would rather the new job wait than restore the finding.

Documentation in the repository says the job obtains a token and which client it uses. It does not contain the secret. A sample command in a README with a real key is a finding we remove in the same pass. Examples use placeholders. We grep for the key prefix after the cutover.

If PagerDuty is reached through a shared library, the library is updated once so every caller picks up the client. Updating one pipeline and leaving the library to inject the old variable is how the key returns. The library is in scope when it is in a repository you authorize.

Frequently Asked Questions

Is an events routing key the same as the API key you remove?

No. A routing key posts events for one integration, while a full-access REST key administers the account. This engagement removes the REST key from CI. A routing key is removed only if it was stored in CI as that admin secret.

Do you revoke the old key before the new client works?

No. One job succeeds with the OAuth client first, then the variable is deleted and the key is revoked in PagerDuty. The job runs again after the revoke. A revoke that breaks the only path is not the delivery.

Is the OAuth client secret the same problem as the API key?

It is still a secret, stored in the CI secret store, not in git. It is not a full-access account key. The token for each run is short-lived and scoped. We check a sample log to show the token was not printed.

Will you move the API key into a vault and stop there?

No. A full-access key in a vault is still a full-access key the job would retrieve. The replacement is the scoped OAuth client. The vault may hold the client secret, and it does not keep a copy of the revoked key.

What about keys on developer laptops?

Scripts that use the same key are switched to the client or removed. A key that remains in a dotfile will be copied back into CI. Those copies are part of the list, not an undocumented exception.

Book a technical call. 907-841-8407. contact@rutagon.com.