mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-23 00:06:17 -04:00
Formally disallow flowcontrol operations from being used in bake recipes
This commit is contained in:
parent
939208903a
commit
53e69835ff
4 changed files with 81 additions and 74 deletions
|
@ -28,16 +28,22 @@ class NodeRecipe {
|
|||
* @param {String | Function | Object} ing
|
||||
*/
|
||||
_validateIngredient(ing) {
|
||||
// CASE operation name given. Find operation and validate
|
||||
if (typeof ing === "string") {
|
||||
const op = operations.find((op) => {
|
||||
return sanitise(op.opName) === sanitise(ing);
|
||||
});
|
||||
if (op) {
|
||||
return op;
|
||||
return this._validateIngredient(op);
|
||||
} else {
|
||||
throw new TypeError(`Couldn't find an operation with name '${ing}'.`);
|
||||
}
|
||||
// CASE operation given. Check its a chef operation and check its not flowcontrol
|
||||
} else if (typeof ing === "function") {
|
||||
if (ing.flowControl) {
|
||||
throw new TypeError(`flowControl operations like ${ing.opName} are not currently allowed in recipes for chef.bake`);
|
||||
}
|
||||
|
||||
if (operations.includes(ing)) {
|
||||
return ing;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue