mirror of
https://github.com/abrendan/MicDropMessages.git
synced 2025-08-26 06:22:02 +02:00
Initial commit
This commit is contained in:
28
node_modules/helmet-csp/dist/lib/check-options/check-directive/sandbox.js
generated
vendored
Normal file
28
node_modules/helmet-csp/dist/lib/check-options/check-directive/sandbox.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var config_1 = __importDefault(require("../../config"));
|
||||
var is_function_1 = __importDefault(require("../../is-function"));
|
||||
module.exports = function sandboxCheck(key, value) {
|
||||
if (value === false) {
|
||||
return;
|
||||
}
|
||||
if (value === true) {
|
||||
return;
|
||||
}
|
||||
if (!Array.isArray(value)) {
|
||||
throw new Error("\"" + value + "\" is not a valid value for " + key + ". Use an array of strings or `true`.");
|
||||
}
|
||||
if (value.length === 0) {
|
||||
throw new Error(key + " must have at least one value. To block everything, set " + key + " to `true`.");
|
||||
}
|
||||
value.forEach(function (expression) {
|
||||
if (is_function_1.default(expression)) {
|
||||
return;
|
||||
}
|
||||
if (config_1.default.sandboxDirectives.indexOf(expression) === -1) {
|
||||
throw new Error("\"" + expression + "\" is not a valid " + key + " directive. Remove it.");
|
||||
}
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user