How to fix: Twilio API Key (SK prefix) in source
Twilio API keys (SK*) with their secret allow programmatic SMS, voice, and account access - different from the Account SID (AC*) which is public-ish.
Why it matters
An exposed Twilio SK key combined with its secret grants full API access: sending unlimited SMS/voice calls billed to your account, accessing all call recordings, and manipulating phone numbers. A single exposed key can result in thousands of dollars in fraudulent telecom charges.
Twilio API keys (SK*) with their secret allow programmatic SMS, voice, and account access - different from the Account SID (AC*) which is public-ish.
How to fix it
- 1Revoke the key at console.twilio.com → Account → API keys & tokens
- 2Audit recent API usage for unauthorized SMS/voice calls
- 3Create a new key with minimum required permissions and store in a secrets manager
Code examples
Twilio: server-side only, key from environment
import twilio from 'twilio';
// SK keys + secret must live server-side only
const client = twilio(
process.env.TWILIO_API_KEY_SID!, // SK...
process.env.TWILIO_API_KEY_SECRET!, // paired secret
{ accountSid: process.env.TWILIO_ACCOUNT_SID! }
);
// This call never happens in a browser component
await client.messages.create({
to: '+15551234567',
from: process.env.TWILIO_FROM_NUMBER!,
body: 'Your verification code is: 123456',
});References
Detected automatically by VulnRadar. The check id is secret-twilio-api-key-sk, stable across every scan so you can filter or diff on it.
More secrets checks
Questions
- How severe is Twilio API Key (SK prefix) in source?
- VulnRadar rates this critical 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-twilio-api-key-sk, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Twilio API Key (SK prefix) 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.