mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Updated all Origin header checks to handle 'null' (#12246)
closes #12244 As per RFC 6454 the Origin header MUST be set to the string 'null' when in a "privacy-sensitive" context. We were not handling this string and this was causing errors. This commit updates all checks of the 'Origin' header to treat the value 'null' as if the header was not present. ref: https://tools.ietf.org/html/rfc6454#section-7.3
This commit is contained in:
parent
eb4933d27e
commit
244704156c
3 changed files with 3 additions and 3 deletions
|
@ -13,7 +13,7 @@ function getOriginOfRequest(req) {
|
|||
const origin = req.get('origin');
|
||||
const referrer = req.get('referrer') || urlUtils.getAdminUrl() || urlUtils.getSiteUrl();
|
||||
|
||||
if (!origin && !referrer) {
|
||||
if (!origin && !referrer || origin === 'null') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ function handleCORS(req, cb) {
|
|||
const origin = req.get('origin');
|
||||
|
||||
// Request must have an Origin header
|
||||
if (!origin) {
|
||||
if (!origin || origin === 'null') {
|
||||
return cb(null, DISABLE_CORS);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ const corsOptionsDelegate = function corsOptionsDelegate(req, callback) {
|
|||
credentials: true // required to allow admin-client to login to private sites
|
||||
};
|
||||
|
||||
if (!origin) {
|
||||
if (!origin || origin === 'null') {
|
||||
return callback(null, corsOptions);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue