csp: allow WASM
Some checks failed
Lint / lint (backend) (push) Blocked by required conditions
Lint / lint (frontend) (push) Blocked by required conditions
Lint / lint (frontend-embed) (push) Blocked by required conditions
Lint / lint (frontend-shared) (push) Blocked by required conditions
Lint / lint (misskey-bubble-game) (push) Blocked by required conditions
Lint / lint (misskey-js) (push) Blocked by required conditions
Lint / lint (misskey-reversi) (push) Blocked by required conditions
Lint / lint (sw) (push) Blocked by required conditions
Lint / typecheck (backend) (push) Blocked by required conditions
Lint / typecheck (misskey-js) (push) Blocked by required conditions
Lint / typecheck (sw) (push) Blocked by required conditions
Lint / pnpm_install (push) Successful in 2m2s
Publish Docker image / Build (push) Successful in 5m14s
Test (production install and build) / production (20.16.0) (push) Successful in 1m16s
Test (backend) / unit (20.16.0) (push) Successful in 8m43s
Lint / pnpm_install (pull_request) Successful in 1m22s
Publish Docker image / Build (pull_request) Successful in 4m57s
Test (backend) / e2e (20.16.0) (push) Has been cancelled
Test (production install and build) / production (20.16.0) (pull_request) Successful in 1m25s
Lint / lint (backend) (pull_request) Successful in 2m17s
Test (backend) / unit (20.16.0) (pull_request) Successful in 8m22s
Lint / lint (frontend) (pull_request) Successful in 2m27s
Lint / lint (frontend-embed) (pull_request) Successful in 2m20s
Lint / lint (frontend-shared) (pull_request) Successful in 2m18s
Test (backend) / e2e (20.16.0) (pull_request) Failing after 11m46s
Lint / lint (misskey-bubble-game) (pull_request) Successful in 2m27s
Lint / lint (misskey-js) (pull_request) Successful in 2m24s
Lint / lint (misskey-reversi) (pull_request) Successful in 2m34s
Lint / lint (sw) (pull_request) Successful in 2m33s
Lint / typecheck (backend) (pull_request) Successful in 2m7s
Lint / typecheck (misskey-js) (pull_request) Successful in 1m49s
Lint / typecheck (sw) (pull_request) Successful in 2m1s

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
ゆめ 2024-11-11 05:16:32 -06:00
parent 20fc81c7b7
commit b72a84a389
No known key found for this signature in database

View file

@ -12,7 +12,7 @@ export type CSPHashed = {
};
export function generateCSP(hashedMap: Map<string, CSPHashed>, options: {
mediaProxy ?: string,
mediaProxy?: string,
}) {
const keys = Array.from(hashedMap.keys());
const scripts = keys
@ -28,7 +28,7 @@ export function generateCSP(hashedMap: Map<string, CSPHashed>, options: {
['media-src', ['\'self\'', 'data:', options.mediaProxy].filter(Boolean)],
['font-src', ['\'self\'']],
['style-src', ['\'self\'', ...styles]],
['script-src', ['\'self\'', ...scripts]],
['script-src', ['\'self\'', '\'unsafe-wasm-eval\'', ...scripts]],
['object-src', ['\'none\'']],
['frame-src', ['\'none\'']],
['base-uri', ['\'self\'']],
@ -36,14 +36,14 @@ export function generateCSP(hashedMap: Map<string, CSPHashed>, options: {
['child-src', ['\'self\'']],
['form-action', ['\'self\'']],
['manifest-src', ['\'self\'']],
...(process.env.NODE_ENV === 'production' ?
[
['upgrade-insecure-requests', []],
] : []),
...(process.env.NODE_ENV === 'production' ?
[
['upgrade-insecure-requests', []],
] : []),
] as [string, string[]][])
.map(([name, values]) => {
return `${name} ${values.join(' ')}`;
}).join('; ');
.map(([name, values]) => {
return `${name} ${values.join(' ')}`;
}).join('; ');
}
export function hashResource(res: string): CSPHashed {