Merge pull request #5069 from FreeCodeCamp/fix/reduce-header-size
Reduce header size
This commit is contained in:
@ -1,87 +1,55 @@
|
|||||||
import helmet from 'helmet';
|
import helmet from 'helmet';
|
||||||
|
|
||||||
const trusted = [
|
const trusted = [
|
||||||
"'self'",
|
"'self'"
|
||||||
'blob:',
|
|
||||||
'104.236.218.15',
|
|
||||||
'*.freecodecamp.com',
|
|
||||||
'http://www.freecodecamp.com',
|
|
||||||
'http://freecodecamp.com',
|
|
||||||
'https://www.freecodecamp.com',
|
|
||||||
'https://freecodecamp.com',
|
|
||||||
'https://freecodecamp.org',
|
|
||||||
'*.freecodecamp.org',
|
|
||||||
// NOTE(berks): add the following as the blob above was not covering www
|
|
||||||
'http://www.freecodecamp.org',
|
|
||||||
'ws://freecodecamp.com/',
|
|
||||||
'ws://www.freecodecamp.com/',
|
|
||||||
'*.gstatic.com',
|
|
||||||
'*.google-analytics.com',
|
|
||||||
'*.googleapis.com',
|
|
||||||
'*.google.com',
|
|
||||||
'*.gstatic.com',
|
|
||||||
'*.doubleclick.net',
|
|
||||||
'*.twitter.com',
|
|
||||||
'*.twitch.tv',
|
|
||||||
'*.twimg.com',
|
|
||||||
"'unsafe-eval'",
|
|
||||||
"'unsafe-inline'",
|
|
||||||
'*.bootstrapcdn.com',
|
|
||||||
'*.cloudflare.com',
|
|
||||||
'https://*.cloudflare.com',
|
|
||||||
'localhost:3001',
|
|
||||||
'ws://localhost:3001/',
|
|
||||||
'http://localhost:3001',
|
|
||||||
'localhost:3000',
|
|
||||||
'ws://localhost:3000/',
|
|
||||||
'http://localhost:3000',
|
|
||||||
'*.ionicframework.com',
|
|
||||||
'https://syndication.twitter.com',
|
|
||||||
'*.youtube.com',
|
|
||||||
'*.jsdelivr.net',
|
|
||||||
'https://*.jsdelivr.net',
|
|
||||||
'*.ytimg.com',
|
|
||||||
'*.bitly.com',
|
|
||||||
'http://cdn.inspectlet.com/',
|
|
||||||
'https://cdn.inspeclet.com/',
|
|
||||||
'wss://inspectletws.herokuapp.com/',
|
|
||||||
'http://hn.inspectlet.com/',
|
|
||||||
'*.googleapis.com',
|
|
||||||
'*.gstatic.com',
|
|
||||||
'https://hn.inspectlet.com/',
|
|
||||||
'https://*.github.com'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function csp() {
|
export default function csp() {
|
||||||
return helmet.csp({
|
return helmet.csp({
|
||||||
defaultSrc: trusted,
|
defaultSrc: trusted,
|
||||||
scriptSrc: [
|
scriptSrc: [
|
||||||
|
"'unsafe-eval'",
|
||||||
|
"'unsafe-inline'",
|
||||||
|
'*.google-analytics.com',
|
||||||
|
'*.gstatic.com',
|
||||||
|
'https://*.cloudflare.com',
|
||||||
|
'*.cloudflare.com',
|
||||||
'https://*.gitter.im',
|
'https://*.gitter.im',
|
||||||
'*.optimizely.com',
|
'https://*.cdnjs.com',
|
||||||
'*.aspnetcdn.com',
|
'*.cdnjs.com',
|
||||||
'*.d3js.org',
|
'https://*.jsdelivr.com',
|
||||||
'https://cdn.inspectlet.com/inspectlet.js',
|
'*.jsdelivr.com',
|
||||||
'http://cdn.inspectlet.com/inspectlet.js',
|
'*.twimg.com',
|
||||||
'http://beta.freecodecamp.com'
|
'https://*.twimg.com'
|
||||||
].concat(trusted),
|
].concat(trusted),
|
||||||
'connect-src': [
|
connectSrc: [
|
||||||
'vimeo.com'
|
'vimeo.com'
|
||||||
].concat(trusted),
|
].concat(trusted),
|
||||||
styleSrc: [
|
styleSrc: [
|
||||||
|
"'unsafe-inline'",
|
||||||
|
'*.gstatic.com',
|
||||||
'*.googleapis.com',
|
'*.googleapis.com',
|
||||||
'*.gstatic.com'
|
'*.bootstrapcdn.com',
|
||||||
|
'https://*.bootstrapcdn.com',
|
||||||
|
'*.cloudflare.com',
|
||||||
|
'https://*.cloudflare.com'
|
||||||
|
].concat(trusted),
|
||||||
|
fontSrc: [
|
||||||
|
'*.cloudflare.com',
|
||||||
|
'https://*.cloudflare.com',
|
||||||
|
'*.bootstrapcdn.com',
|
||||||
|
'*.googleapis.com',
|
||||||
|
'*.gstatic.com',
|
||||||
|
'https://*.bootstrapcdn.com'
|
||||||
].concat(trusted),
|
].concat(trusted),
|
||||||
imgSrc: [
|
imgSrc: [
|
||||||
// allow all input since we have user submitted images for
|
// allow all input since we have user submitted images for
|
||||||
// public profile
|
// public profile
|
||||||
'*',
|
'*',
|
||||||
'data:'
|
'data:'
|
||||||
].concat(trusted),
|
],
|
||||||
fontSrc: [
|
|
||||||
'*.googleapis.com',
|
|
||||||
'*.gstatic.com'
|
|
||||||
].concat(trusted),
|
|
||||||
mediaSrc: [
|
mediaSrc: [
|
||||||
|
'*.bitly.com',
|
||||||
'*.amazonaws.com',
|
'*.amazonaws.com',
|
||||||
'*.twitter.com'
|
'*.twitter.com'
|
||||||
].concat(trusted),
|
].concat(trusted),
|
||||||
@ -90,7 +58,8 @@ export default function csp() {
|
|||||||
'*.gitter.im https:',
|
'*.gitter.im https:',
|
||||||
'*.vimeo.com',
|
'*.vimeo.com',
|
||||||
'*.twitter.com',
|
'*.twitter.com',
|
||||||
'*.ghbtns.com'
|
'*.ghbtns.com',
|
||||||
|
'*.freecatphotoapp.com'
|
||||||
].concat(trusted),
|
].concat(trusted),
|
||||||
// set to true if you only want to report errors
|
// set to true if you only want to report errors
|
||||||
reportOnly: false,
|
reportOnly: false,
|
||||||
|
Reference in New Issue
Block a user