Update CSP for ws (#4350)
This commit is contained in:
parent
ceab39361a
commit
fea29170cd
@ -4,23 +4,21 @@
|
||||
import { HeadersReceivedResponse, session } from 'electron';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const setupContentSecurityPolicy = (_: string): void => {
|
||||
session.defaultSession.webRequest.onHeadersReceived((details, cb: (headersReceivedResponse: HeadersReceivedResponse) => void) => {
|
||||
const headersReceivedResponse = {
|
||||
export function setupContentSecurityPolicy (_: string): void {
|
||||
session.defaultSession.webRequest.onHeadersReceived((details, respond: (response: HeadersReceivedResponse) => void) => {
|
||||
respond({
|
||||
responseHeaders: {
|
||||
...details.responseHeaders,
|
||||
'Content-Security-Policy': ["default-src 'self';" +
|
||||
" style-src-elem 'self' https://fonts.googleapis.com/css 'unsafe-inline';" +
|
||||
" font-src data: 'self' https://fonts.gstatic.com;" +
|
||||
" style-src 'unsafe-inline';" +
|
||||
" connect-src 'self' wss:;" +
|
||||
" connect-src 'self' wss: ws:;" +
|
||||
" img-src 'self' data:;" +
|
||||
// unsafe-eval is needed for the WASM content - same as the extension
|
||||
// script hashes here are for the window.top script (not technically needed)
|
||||
" script-src 'self' 'unsafe-eval' 'sha256-02/ejyoV/iwRdJ4NAsxjzF6WVUtLMPM6Nv96EbAm6u8=' 'sha256-wW/WsLudCDaPo/ibpeK0KslHqYpCzcAKNFxFBXwCHJg='"]
|
||||
}
|
||||
};
|
||||
|
||||
cb(headersReceivedResponse);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user