mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
csp: fix connect-src
This commit is contained in:
parent
02ada73f48
commit
3d376ba8b3
1 changed files with 7 additions and 3 deletions
|
|
@ -19,12 +19,16 @@ export const cspMiddleware = (): AppMiddleware => {
|
|||
const configDB = await configDBCache;
|
||||
const sentryDsn = configDB.getIn(':pleroma', ':frontend_configurations', ':soapbox_fe', 'sentryDsn');
|
||||
|
||||
const connectSrc = ["'self'", 'blob:', origin, `${wsProtocol}//${host}`];
|
||||
|
||||
if (typeof sentryDsn === 'string') {
|
||||
connectSrc.push(sentryDsn);
|
||||
}
|
||||
|
||||
const policies = [
|
||||
'upgrade-insecure-requests',
|
||||
`script-src 'self'`,
|
||||
`connect-src 'self' blob: ${origin} ${wsProtocol}//${host}` + typeof sentryDsn === 'string'
|
||||
? ` ${sentryDsn}`
|
||||
: '',
|
||||
`connect-src ${connectSrc.join(' ')}`,
|
||||
`media-src 'self' https:`,
|
||||
`img-src 'self' data: blob: https:`,
|
||||
`default-src 'none'`,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue