Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update fast-json-patch for security #227

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -35,7 +35,7 @@
},
"dependencies": {
"ajv": "^8.0.0",
"fast-json-patch": "^2.0.0",
"fast-json-patch": "^3.1.1",
"glob": "^7.1.0",
"js-yaml": "^3.14.0",
"json-schema-migrate": "^2.0.0",
Expand Down
6 changes: 4 additions & 2 deletions src/commands/ajv.ts
Expand Up @@ -86,9 +86,11 @@ export default function (argv: ParsedArgs): AjvCore {
registerer = require("ts-node").register()
} catch (err) {
/* istanbul ignore next */
if (err.code === "MODULE_NOT_FOUND") {
if ((err as {code?: string; message: string}).code === "MODULE_NOT_FOUND") {
throw new Error(
`'ts-node' is required for the TypeScript configuration files. Make sure it is installed\nError: ${err.message}`
`'ts-node' is required for the TypeScript configuration files. Make sure it is installed\nError: ${
(err as Error).message
}`
)
}

Expand Down
4 changes: 2 additions & 2 deletions src/commands/util.ts
Expand Up @@ -52,14 +52,14 @@
json = require(file)
}
} catch (err) {
const msg: string = err.message
const msg: string = (err as Error).message
console.error(`error: ${msg.replace(" module", " " + suffix)}`)
process.exit(2)
}
return json
}

export function logJSON(mode: string, data: any, ajv?: Ajv): string {

Check warning on line 62 in src/commands/util.ts

View workflow job for this annotation

GitHub Actions / build (10.x)

Argument 'data' should be typed with a non-any type

Check warning on line 62 in src/commands/util.ts

View workflow job for this annotation

GitHub Actions / build (12.x)

Argument 'data' should be typed with a non-any type

Check warning on line 62 in src/commands/util.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Argument 'data' should be typed with a non-any type
switch (mode) {
case "json":
data = JSON.stringify(data, null, " ")
Expand All @@ -82,7 +82,7 @@
return ajv.compile(schema)
} catch (err) {
console.error(`schema ${schemaFile} is invalid`)
console.error(`error: ${err.message}`)
console.error(`error: ${(err as Error).message}`)
process.exit(1)
}
}