From 6c208a9beb2cdc951039d4fa9eec111de5f1f9e3 Mon Sep 17 00:00:00 2001 From: Chris Burgess Date: Sat, 22 Jul 2023 09:08:43 +1200 Subject: [PATCH 1/2] yaml.safeLoad is removed in js-yaml 4 --- legacy/bootstrap.js | 2 +- legacy/config.js | 2 +- legacy/yaml.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/legacy/bootstrap.js b/legacy/bootstrap.js index d961570..42eae58 100644 --- a/legacy/bootstrap.js +++ b/legacy/bootstrap.js @@ -31,7 +31,7 @@ const loadCacheFile = file => { */ const loadLandoFile = file => { try { - return yaml.safeLoad(fs.readFileSync(file)); + return yaml.load(fs.readFileSync(file)); } catch (e) { throw new Error(`There was a problem with parsing ${file}. Ensure it is valid YAML! ${e}`); } diff --git a/legacy/config.js b/legacy/config.js index f9f9380..61e3909 100644 --- a/legacy/config.js +++ b/legacy/config.js @@ -216,7 +216,7 @@ exports.loadFiles = files => _(files) .filter(source => fs.existsSync(source) || fs.existsSync(source.file)) // If the file is just a string lets map it to an object .map(source => { - return _.isString(source) ? {file: source, data: yaml.safeLoad(fs.readFileSync(source))} : source; + return _.isString(source) ? {file: source, data: yaml.load(fs.readFileSync(source))} : source; }) // Add on the root directory for mapping purposes .map(source => _.merge({}, source, {root: path.dirname(source.file)})) diff --git a/legacy/yaml.js b/legacy/yaml.js index 60b454c..45321b0 100644 --- a/legacy/yaml.js +++ b/legacy/yaml.js @@ -28,7 +28,7 @@ module.exports = class Yaml { */ load(file) { try { - return yaml.safeLoad(fs.readFileSync(file)); + return yaml.load(fs.readFileSync(file)); } catch (e) { this.log.error('Problem parsing %s with %s', file, e.message); } From e63168b122704446d8fccbc346f694b5098090ca Mon Sep 17 00:00:00 2001 From: Chris Burgess Date: Mon, 24 Jul 2023 06:16:56 +1200 Subject: [PATCH 2/2] Function yaml.safeDump is removed in js-yaml 4 --- legacy/yaml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/legacy/yaml.js b/legacy/yaml.js index 45321b0..32bd7f4 100644 --- a/legacy/yaml.js +++ b/legacy/yaml.js @@ -49,7 +49,7 @@ module.exports = class Yaml { // Remove any properties that might be bad and dump data = JSON.parse(JSON.stringify(data)); // And dump - fs.writeFileSync(file, yaml.safeDump(data)); + fs.writeFileSync(file, yaml.dump(data)); // Log and return filename return file; }