mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
If enabled, add Sentry API to the CSP whitelist
This commit is contained in:
parent
57d504d18a
commit
fe73399d4b
1 changed files with 5 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ const { config } = require('./importer');
|
|||
|
||||
const dev = process.env.REACT_APP_ENV === 'development';
|
||||
const googleAnalyticsEnabled = !!process.env.REACT_APP_GOOGLE_ANALYTICS_ID;
|
||||
const sentryClientEnabled = !!process.env.REACT_APP_PUBLIC_SENTRY_DSN;
|
||||
|
||||
/**
|
||||
* Middleware for creating a Content Security Policy
|
||||
|
|
@ -32,6 +33,7 @@ module.exports = (reportUri, enforceSsl, reportOnly) => {
|
|||
const googleFonts = 'https://fonts.googleapis.com/';
|
||||
const stripeJs = 'https://js.stripe.com/';
|
||||
const stripeQ = 'https://q.stripe.com/';
|
||||
const sentryApi = 'https://sentry.io/api/';
|
||||
|
||||
const scriptSrc = [self, inline, googleMaps, stripeJs];
|
||||
|
||||
|
|
@ -61,6 +63,9 @@ module.exports = (reportUri, enforceSsl, reportOnly) => {
|
|||
scriptSrc.push(googleAnalytics);
|
||||
imgSrc.push(googleAnalytics);
|
||||
}
|
||||
if (sentryClientEnabled) {
|
||||
connectSrc.push(sentryApi);
|
||||
}
|
||||
if (dev) {
|
||||
// The default Core docker-compose setup server images from this
|
||||
// URL locally.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue