mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Renamed whitelist -> allowlist
no issue - Renames to follow the naming convention from https://mysqlhighavailability.com/mysql-terminology-updates/
This commit is contained in:
parent
f0242baf9f
commit
92986b77e3
1 changed files with 7 additions and 7 deletions
|
@ -3,7 +3,7 @@ const url = require('url');
|
|||
const os = require('os');
|
||||
const urlUtils = require('../../../../shared/url-utils');
|
||||
|
||||
let whitelist = [];
|
||||
let allowlist = [];
|
||||
const ENABLE_CORS = {origin: true, maxAge: 86400};
|
||||
const DISABLE_CORS = {origin: false};
|
||||
|
||||
|
@ -46,16 +46,16 @@ function getUrls() {
|
|||
return urls;
|
||||
}
|
||||
|
||||
function getWhitelist() {
|
||||
function getAllowlist() {
|
||||
// This needs doing just one time after init
|
||||
if (whitelist.length === 0) {
|
||||
if (allowlist.length === 0) {
|
||||
// origins that always match: localhost, local IPs, etc.
|
||||
whitelist = whitelist.concat(getIPs());
|
||||
allowlist = allowlist.concat(getIPs());
|
||||
// Trusted urls from config.js
|
||||
whitelist = whitelist.concat(getUrls());
|
||||
allowlist = allowlist.concat(getUrls());
|
||||
}
|
||||
|
||||
return whitelist;
|
||||
return allowlist;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,7 +73,7 @@ function handleCORS(req, cb) {
|
|||
}
|
||||
|
||||
// Origin matches whitelist
|
||||
if (getWhitelist().indexOf(url.parse(origin).hostname) > -1) {
|
||||
if (getAllowlist().indexOf(url.parse(origin).hostname) > -1) {
|
||||
return cb(null, ENABLE_CORS);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue