From 5d9740408ace8897e11a605e6c341c9ad3b9a31a Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Tue, 23 Jun 2020 15:15:22 +0200 Subject: [PATCH] Merge pull request #2923 from overleaf/jpa-sentry-in-staging [misc] sentry: allow reports for resources on the same origin and CDN GitOrigin-RevId: 617939dccef839eb80df0b9d84e6684b5b2e618f --- services/web/app/src/infrastructure/ExpressLocals.js | 2 ++ services/web/frontend/js/utils/sentry.js | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/services/web/app/src/infrastructure/ExpressLocals.js b/services/web/app/src/infrastructure/ExpressLocals.js index 2d935f65f7..465ed00ed2 100644 --- a/services/web/app/src/infrastructure/ExpressLocals.js +++ b/services/web/app/src/infrastructure/ExpressLocals.js @@ -366,6 +366,8 @@ module.exports = function(webRouter, privateApiRouter, publicApiRouter) { recaptchaDisabled: Settings.recaptcha != null ? Settings.recaptcha.disabled : undefined, validRootDocExtensions: Settings.validRootDocExtensions, + sentryAllowedOriginRegex: + Settings.sentry && Settings.sentry.allowedOriginRegex, sentryDsn: Settings.sentry != null ? Settings.sentry.publicDSN : undefined } next() diff --git a/services/web/frontend/js/utils/sentry.js b/services/web/frontend/js/utils/sentry.js index 59852ad449..7e1468c831 100644 --- a/services/web/frontend/js/utils/sentry.js +++ b/services/web/frontend/js/utils/sentry.js @@ -7,11 +7,10 @@ if (window.ExposedSettings.sentryDsn) { Sentry.init({ dsn: window.ExposedSettings.sentryDsn, - // Ignore errors unless they come from overleaf.com/sharelatex.com + // Ignore errors unless they come from our origins // Adapted from: https://docs.sentry.io/platforms/javascript/#decluttering-sentry whitelistUrls: [ - /https:\/\/[a-z]+\.overleaf\.com/, - /https:\/\/[a-z]+\.sharelatex\.com/ + new RegExp(window.ExposedSettings.sentryAllowedOriginRegex) ], ignoreErrors: [