3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-24 18:15:02 +00:00

Disallow anchors/aliases to objects when loading config YAML

This commit is contained in:
Dragory 2021-08-14 18:22:29 +03:00
parent 72a90ce66a
commit 1e50e459f3
5 changed files with 96 additions and 3 deletions

View file

@ -0,0 +1,11 @@
import yaml from "js-yaml";
import { validateNoObjectAliases } from "./validateNoObjectAliases";
/**
* Loads a YAML file safely while removing object anchors/aliases (including arrays)
*/
export function loadYamlSafely(yamlStr: string): any {
const loaded = yaml.safeLoad(yamlStr);
validateNoObjectAliases(loaded);
return loaded;
}