mirror of
https://github.com/wassname/talk.git
synced 2026-07-31 12:50:48 +08:00
Merge pull request #1954 from coralproject/static-uri
Static URI + Social Callback bug
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "talk",
|
||||
"version": "4.6.3",
|
||||
"version": "4.6.4",
|
||||
"description": "A better commenting experience from Mozilla, The New York Times, and the Washington Post. https://coralproject.net",
|
||||
"main": "app.js",
|
||||
"private": true,
|
||||
|
||||
@@ -97,6 +97,11 @@ const HandleGenerateCredentials = (req, res, next) => (err, user) => {
|
||||
res.json({ user, token });
|
||||
};
|
||||
|
||||
const generateAuthPopupCallbackCSP = req =>
|
||||
req.locals.STATIC_URL && req.locals.BASE_URL !== req.locals.STATIC_URL
|
||||
? `default-src 'self' ${req.locals.STATIC_URL};`
|
||||
: "default-src 'self';";
|
||||
|
||||
/**
|
||||
* Returns the response to the login attempt via a popup callback with some JS.
|
||||
*/
|
||||
@@ -106,7 +111,7 @@ const HandleAuthPopupCallback = (req, res, next) => (err, user) => {
|
||||
res.header('Pragma', 'no-cache');
|
||||
|
||||
// Ensure the only scripts that can run here are those on the Talk domain.
|
||||
res.header('Content-Security-Policy', "default-src 'self';");
|
||||
res.header('Content-Security-Policy', generateAuthPopupCallbackCSP(req));
|
||||
|
||||
// Attach static locals to the response locals object.
|
||||
attachStaticLocals(res.locals);
|
||||
|
||||
Reference in New Issue
Block a user