How to fix: Sentry DSN in source
Sentry DSNs (public key + org + project embedded in an ingest URL) are meant to ship in client bundles. The risk is event-quota abuse and project/org disclosure, not data access.
Why it matters
Sentry DSNs are intentionally public: the JS SDK cannot function without shipping one to the browser. The residual risk is that anyone with the DSN can submit arbitrary events to your project, exhausting your event quota or flooding your issue stream with junk, and the DSN discloses your Sentry org slug and numeric project ID.
Sentry DSNs (public key + org + project embedded in an ingest URL) are meant to ship in client bundles. The risk is event-quota abuse and project/org disclosure, not data access.
How to fix it
- 1Enable inbound data filters and rate limiting on the project in Sentry → Project Settings → Inbound Filters
- 2Set a spike protection / per-key rate limit in Sentry → Project Settings → Client Keys (DSN)
- 3Regenerate the DSN in Client Keys settings if you are seeing abusive event volume
Code examples
Sentry init: DSN from public env var is expected
// sentry.client.config.ts: shipping the DSN to the browser is normal
import * as Sentry from '@sentry/nextjs';
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, // public by design
tracesSampleRate: 0.1,
});
// Harden against abuse in the Sentry dashboard, not by hiding the DSN:
// Project Settings -> Inbound Filters -> enable rate limitingReferences
Detected automatically by VulnRadar. The check id is secret-sentry-dsn-public, stable across every scan so you can filter or diff on it.
More secrets checks
Questions
- How severe is Sentry DSN 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-sentry-dsn-public, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Sentry DSN in source map to?
- It maps to CWE-200. In the OWASP Top 10 it falls under A05: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.