How to fix: Datadog client token in source
Datadog client tokens (pub_*) are intentionally shipped in browser bundles for RUM. They are read-only / ingest-only but leak account.
Why it matters
Datadog client tokens (pub_*) are intentionally public for browser RUM collection. The primary risk is that an unrestricted token allows any site to submit fake RUM data billed to your account. Ensure it is not confused with a full API key, which would be more dangerous.
Datadog client tokens (pub_*) are intentionally shipped in browser bundles for RUM. They are read-only / ingest-only but leak account.
How to fix it
- 1Restrict the client token by service and origin in Datadog Organization Settings
- 2Rotate periodically and audit for unexpected traffic sources
- 3Ensure the full API key is never in client bundles; only the pub_* token
Code examples
Correct: use pub_* token in browser, API key server-only
import { datadogRum } from '@datadog/browser-rum';
datadogRum.init({
applicationId: process.env.NEXT_PUBLIC_DD_APPLICATION_ID!,
clientToken: process.env.NEXT_PUBLIC_DD_CLIENT_TOKEN!, // pub_*: safe in browser
site: 'datadoghq.com',
service: 'my-app',
// Never use the API key here; only the pub_* client token
});References
Detected automatically by VulnRadar. The check id is secret-datadog-client-token, stable across every scan so you can filter or diff on it.
More secrets checks
Questions
- How severe is Datadog client token in source?
- VulnRadar rates this low 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-datadog-client-token, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Datadog client token 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.