mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
csp: use the sentry origin instead of the URL itself
This commit is contained in:
parent
3d376ba8b3
commit
aea31bce5d
1 changed files with 6 additions and 1 deletions
|
|
@ -22,7 +22,12 @@ export const cspMiddleware = (): AppMiddleware => {
|
||||||
const connectSrc = ["'self'", 'blob:', origin, `${wsProtocol}//${host}`];
|
const connectSrc = ["'self'", 'blob:', origin, `${wsProtocol}//${host}`];
|
||||||
|
|
||||||
if (typeof sentryDsn === 'string') {
|
if (typeof sentryDsn === 'string') {
|
||||||
connectSrc.push(sentryDsn);
|
try {
|
||||||
|
const dsn = new URL(sentryDsn);
|
||||||
|
connectSrc.push(dsn.origin);
|
||||||
|
} catch {
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const policies = [
|
const policies = [
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue