Skip to content

Commit 6077c45

Browse files
authored
fix: replace remaining safeLoad with load (#773)
This commit replaces the remaining `safeLoad` function calls with the new `load` and updates the patch version of the transitive `js-yaml` dependency in the `package-lock.json` to fix a recent CVE. Signed-off-by: Norbert Biczo <[email protected]>
1 parent bb85feb commit 6077c45

File tree

4 files changed

+6
-21
lines changed

4 files changed

+6
-21
lines changed

package-lock.json

Lines changed: 3 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/validator/src/cli-validator/utils/read-yaml.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ async function readYaml(path) {
1111
// Use a "promisified" version of fs.readFile().
1212
const readFile = util.promisify(fs.readFile);
1313
const fileContents = await readFile(path, 'utf8');
14-
return jsYaml.safeLoad(fileContents);
14+
return jsYaml.load(fileContents);
1515
}
1616

1717
module.exports = readYaml;

packages/validator/test/scoring-tool/compute-metrics.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('scoring-tool compute-metrics tests', function () {
1414
beforeAll(async function () {
1515
const fileToTest = `${__dirname}/../cli-validator/mock-files/oas3/clean.yml`;
1616
const contents = await readFile(fileToTest, { encoding: 'utf8' });
17-
const apiDef = readYaml.safeLoad(contents);
17+
const apiDef = readYaml.load(contents);
1818
metrics = await computeMetrics(apiDef);
1919
});
2020

packages/validator/test/scoring-tool/metrics.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('scoring-tool metrics tests', function () {
1414
beforeAll(async function () {
1515
const fileToTest = `${__dirname}/../cli-validator/mock-files/oas3/clean.yml`;
1616
const contents = await readFile(fileToTest, { encoding: 'utf8' });
17-
apiDef = readYaml.safeLoad(contents);
17+
apiDef = readYaml.load(contents);
1818
});
1919

2020
it('should initialize members in constructor', function () {

0 commit comments

Comments
 (0)