export CspPolicies map so plugins can whitelist themselves
This commit is contained in:
parent
11143adb02
commit
0336ea1cb2
1 changed files with 2 additions and 2 deletions
|
@ -13,7 +13,7 @@ const CssSrc = ["style-src", "font-src"];
|
||||||
const MediaAndCssSrc = [...MediaSrc, ...CssSrc];
|
const MediaAndCssSrc = [...MediaSrc, ...CssSrc];
|
||||||
const MediaScriptsAndCssSrc = [...MediaAndCssSrc, "script-src", "worker-src"];
|
const MediaScriptsAndCssSrc = [...MediaAndCssSrc, "script-src", "worker-src"];
|
||||||
|
|
||||||
const Policies: PolicyMap = {
|
export const CspPolicies: PolicyMap = {
|
||||||
"*.github.io": MediaAndCssSrc, // github pages, used by most themes
|
"*.github.io": MediaAndCssSrc, // github pages, used by most themes
|
||||||
"raw.githubusercontent.com": MediaAndCssSrc, // github raw, used by some themes
|
"raw.githubusercontent.com": MediaAndCssSrc, // github raw, used by some themes
|
||||||
"*.gitlab.io": MediaAndCssSrc, // gitlab pages, used by some themes
|
"*.gitlab.io": MediaAndCssSrc, // gitlab pages, used by some themes
|
||||||
|
@ -92,7 +92,7 @@ const patchCsp = (headers: Record<string, string[]>) => {
|
||||||
|
|
||||||
pushDirective("script-src", "'unsafe-inline'", "'unsafe-eval'");
|
pushDirective("script-src", "'unsafe-inline'", "'unsafe-eval'");
|
||||||
|
|
||||||
for (const [host, directives] of Object.entries(Policies)) {
|
for (const [host, directives] of Object.entries(CspPolicies)) {
|
||||||
for (const directive of directives) {
|
for (const directive of directives) {
|
||||||
pushDirective(directive, host);
|
pushDirective(directive, host);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue