-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Strong CSP Support #4943
[WIP] Strong CSP Support #4943
Changes from 22 commits
386245b
1223ded
23012bc
e5c1a51
e18b1ad
9531f55
b840984
9ec8c96
709fc5c
7e7092f
986adfb
9e7ee16
f3eddab
2c76ed9
178e4fe
6e02af3
27488ac
ea22175
ae54cc6
b1ba505
b06f8ba
87d8b40
ca2fff8
1865373
1066028
5ef8249
3acf7a3
de93117
f34704c
3aa6580
d0d0288
d4ef249
b728131
6ae263e
f3cc533
4b7688b
6cf5d18
fb82831
8f6a76f
a83d16c
fe088b2
077d5a0
5d5643a
e09a1e7
8343a93
96fc0cc
75227c3
0c67bcd
cb76f38
657d4e0
632d0e4
6167a49
c46ec20
1b50af9
8898e59
68741ef
4f6c8dc
6d5ab37
2c85d20
c584de5
db4b51c
4ec0e01
8a6de18
96c2040
cd718cc
56bd0e5
0bbdd3d
d8cd11c
ba45a21
5d2c75b
d1017f8
fd2300a
dfe452c
3c42323
5697389
9f9d2c4
98509ca
15cf4f4
bbd7306
eaa0672
8fea414
3608c1a
abfaa78
247aa1d
cf30cb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
window.module = {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this is still needed with the latest webpack, it might not be needed anymore There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing it breaks everything. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed here: #5093 |
||
window.__NEXT_DATA__ = JSON.parse( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be done in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. There’s a function appended to the beginning of each page.js and they load async so they could be called at any moment. This means that these functions need to be defined before any other scripts are loaded, which is only possible by loading it first as the client/index.js could be loaded third and two pages have loaded first and there’s no function to register them. Also, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I meant reading the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @timneutkens Becuase |
||
document | ||
.getElementById('server-app-state') | ||
.textContent.replace(/%3C\/script%3E/g, '</script>') | ||
) | ||
window.__NEXT_LOADED_PAGES__ = [] | ||
window.__NEXT_REGISTER_PAGE = function (route, fn) { | ||
window.__NEXT_LOADED_PAGES__.push({ route: route, fn: fn }) | ||
} | ||
if (window.__NEXT_DATA__.page === '_error') { | ||
window.__NEXT_REGISTER_PAGE(window.__NEXT_DATA__.cleanPathname, function () { | ||
var error = new Error(`Page does not exist: ${window.__NEXT_DATA__.cleanPathname}`) | ||
error.statusCode = 404 | ||
return { error: error } | ||
}) | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare module 'copy-webpack-plugin' { | ||
declare module.exports: any; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's no need to
Policy
after CSP.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You’re right. That’s left over from before when there were more variables set on the key “CSP” so there was CSP.policy, and CSP.nonce, etc
I need to go through and rewrite the README too I just haven’t had much time lately