forked from 0386861680/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcsp.js
More file actions
50 lines (48 loc) · 1.18 KB
/
csp.js
File metadata and controls
50 lines (48 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// This module defines a Content Security Policy (CSP) to disallow
// inline scripts and content from untrusted sources.
const { contentSecurityPolicy } = require('helmet')
module.exports = contentSecurityPolicy({
directives: {
defaultSrc: ["'none'"],
connectSrc: [
"'self'",
'*.google-analytics.com',
'*.algolia.net',
'*.algolianet.com'
],
fontSrc: [
"'self'",
'data:',
'github-images.s3.amazonaws.com'
],
imgSrc: [
"'self'",
'*.google-analytics.com',
'github.githubassets.com',
'github-images.s3.amazonaws.com',
'octodex.github.com',
'placehold.it'
],
objectSrc: [
"'self'"
],
scriptSrc: [
"'self'",
'data:',
"'unsafe-eval'", // exception for Algolia instantsearch
"'unsafe-inline'",
'*.google-analytics.com'
],
frameSrc: [ // exceptions for GraphQL Explorer
'https://graphql-explorer.githubapp.com', // production env
'http://localhost:3000' // development env
],
styleSrc: [
"'self'",
"'unsafe-inline'"
],
childSrc: [
"'self'" // exception for search in deprecated GHE versions
]
}
})