-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #923 from ensdomains/csp-colocate
colocate csp header data
- Loading branch information
Showing
4 changed files
with
88 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
let csp = '' | ||
|
||
// worker-src | ||
csp += 'worker-src' | ||
// only self worker/service worker | ||
csp += " 'self'" | ||
// end worker-src | ||
csp += ';' | ||
|
||
// script-src | ||
csp += ' script-src' | ||
// allow self | ||
csp += " 'self'" | ||
// allow plausible script | ||
csp += ' plausible.io' | ||
// allow cloudflare analytics script | ||
csp += ' static.cloudflareinsights.com' | ||
// allow loading from the pages domain for this app | ||
csp += ' *.ens-app-v3.pages.dev' | ||
// allow intercom scripts | ||
csp += ' https://app.intercom.io' | ||
csp += ' https://widget.intercom.io' | ||
csp += ' https://js.intercomcdn.com' | ||
// allow inline wasm evaluation | ||
csp += ' wasm-unsafe-eval' | ||
// INLINE SCRIPT HASHES | ||
// hiddenCheckScript | ||
csp += " 'sha256-UyYcl+sKCF/ROFZPHBlozJrndwfNiC5KT5ZZfup/pPc='" | ||
// themeSwitcherScript | ||
csp += " 'sha256-84jekTLuMPFFzbBxEFpoUhJbu81z5uBinvhIKKkAPxg='" | ||
// end script-src | ||
csp += ';' | ||
|
||
// for use with csp meta tag | ||
export const cspWithoutFrameAncestors = csp | ||
|
||
let frameAncestors = '' | ||
|
||
// frame-ancestors | ||
frameAncestors += 'frame-ancestors' | ||
// allow self | ||
frameAncestors += " 'self'" | ||
// allow safe wallet | ||
frameAncestors += ' https://app.safe.global' | ||
// end frame-ancestors | ||
frameAncestors += ';' | ||
|
||
export const cspOnlyFrameAncestors = frameAncestors | ||
export const cspWithFrameAncestors = `${csp} ${frameAncestors}` |