How to fix: PayPal OAuth client secret in source
PayPal client secrets are paired with a client ID and grant order/refund/payout operations on the merchant account.
Why it matters
An exposed PayPal client secret paired with the client ID lets an attacker create fraudulent orders, issue refunds to attacker-controlled accounts, trigger payouts, and access all transaction history on your merchant account.
PayPal client secrets are paired with a client ID and grant order/refund/payout operations on the merchant account.
How to fix it
- 1Rotate the secret at developer.paypal.com → My Apps & Credentials → Edit App → Regenerate Secret
- 2Keep the client secret server-side only; the client ID alone is safe in browsers
- 3Use the PayPal JS SDK (which handles auth client-side) for browser integrations
Code examples
Server-side PayPal token exchange (client secret stays server-only)
// Fetch an access token on the server: never expose client_secret to browsers
async function getPayPalAccessToken() {
const credentials = Buffer.from(
`${process.env.PAYPAL_CLIENT_ID}:${process.env.PAYPAL_CLIENT_SECRET}`
).toString('base64');
const res = await fetch('https://api-m.paypal.com/v1/oauth2/token', {
method: 'POST',
headers: {
Authorization: `Basic ${credentials}`,
'Content-Type': 'application/x-www-form-urlencoded',
},
body: 'grant_type=client_credentials',
});
const { access_token } = await res.json();
return access_token;
}References
Detected automatically by VulnRadar. The check id is secret-paypal-client-secret, stable across every scan so you can filter or diff on it.
More secrets checks
Questions
- How severe is PayPal OAuth client secret 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-paypal-client-secret, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does PayPal OAuth client secret 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.