How to fix: PagerDuty REST API key in source
PD keys grant incident / on-call rotation control.
Why it matters
An exposed PagerDuty API key lets an attacker silence real incidents, reassign on-call rotations, acknowledge alerts automatically, and query your team structure, potentially hiding a real security breach by suppressing the alerts that would trigger a response.
PD keys grant incident / on-call rotation control.
How to fix it
- 1Rotate the key in PagerDuty → User Settings → API Access Keys
- 2Use app-level API keys with minimum required scopes
- 3Restrict key usage to server-side webhook handlers only
Code examples
Store PagerDuty key as environment variable
// Server-side incident creation (never in client code)
async function createIncident(title: string) {
const res = await fetch('https://api.pagerduty.com/incidents', {
method: 'POST',
headers: {
Authorization: `Token token=${process.env.PAGERDUTY_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
incident: { type: 'incident', title, service: { id: 'PXXXXXX', type: 'service_reference' } },
}),
});
return res.json();
}References
Detected automatically by VulnRadar. The check id is secret-pagerduty-key, stable across every scan so you can filter or diff on it.
More secrets checks
Questions
- How severe is PagerDuty REST API key in source?
- VulnRadar rates this high severity in the secrets category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id secret-pagerduty-key, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does PagerDuty REST API key in source map to?
- It maps to CWE-798. In the OWASP Top 10 it falls under A07:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.