Skip to main content

How do I configure Content-Security-Policy (CSP) filters?

Issue

I want examples of how to set the "Additional Ignored Sources" field in my project's CSP settings so I can filter out noisy CSP reports, such as those from browser extensions.

Applies To

  • All SaaS Customers and Self-Hosted Users

  • Inbound Filters

Resolution

The "Additional Ignored Sources" field filters out CSP reports you do not want to ingest. Find it under Project Settings, then Security Headers, then CSP Instructions. Sentry matches each pattern against the report's blocked_uri, source_file, and document_uri.

How matching works:

  • Add one pattern per line.

  • Sentry matches on scheme, domain, and port. Paths are ignored.

  • Use * as a wildcard for any scheme, domain segment, or port.

Accepted pattern formats:

evil.com                     # domain only
*.evil.com # any subdomain of evil.com
http://*.example.com:8080 # scheme + wildcard domain + port
*://cdn.*.com:* # any scheme, wildcard domain, any port
*:8080 # any source on port 8080
chrome://* # a specific scheme
chrome-extension # browser extension sources
moz-extension # browser extension sources
localhost:3000 # local development
http://192.168.1.1:3000 # IPv4 address
http://[2001:db8::1]:8080 # IPv6 address (in brackets)

Matching examples, given these patterns:

*.evil.com
http://*.example.com:8080
*://cdn.*.com:*
localhost

Incoming source

Ignored?

Reason

https://sub.evil.com

Yes

Matches *.evil.com

https://notevil.com

No

Matches no pattern

http://api.example.com:8080

Yes

Matches http://*.example.com:8080

https://api.example.com:8080

No

Scheme does not match

http://api.example.com:9090

No

Port does not match

https://cdn.fonts.com

Yes

Matches *://cdn.*.com:*

https://static.cdn.com

No

cdn. must be at the start

http://localhost:3000

Yes

Matches localhost

http://localhost.com

No

Does not match localhost

A common use case is filtering browser extension noise by adding chrome-extension and moz-extension. For more on collecting and configuring CSP reports, see the Security Policy Reporting documentation.

Did this answer your question?