Filter out link-sharing token sent to Sentry (#25787)

GitOrigin-RevId: 647f1a2e20e7883f7ab9c862bb0d90cf96360c24
This commit is contained in:
Rebeka Dekany
2025-05-21 18:20:28 +02:00
committed by Copybot
parent 17c2f9c922
commit 7390a1ff0f

View File

@@ -73,6 +73,19 @@ function sentryReporter() {
return null // Block the event from sending
}
// Do not send link-sharing token to Sentry
if (event.request?.headers?.Referer) {
const refererUrl = new URL(event.request.headers.Referer)
if (
refererUrl.hostname === location.hostname &&
refererUrl.pathname.startsWith('/read/')
) {
refererUrl.pathname = '/read/'
event.request.headers.Referer = refererUrl.toString()
}
}
return event
},
})