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:
parent
72a90ce66a
commit
1e50e459f3
5 changed files with 96 additions and 3 deletions
11
backend/src/utils/loadYamlSafely.ts
Normal file
11
backend/src/utils/loadYamlSafely.ts
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue