Skip to content

Commit 5d98e3c

Browse files
committed
fix: snyk issue in code linter
1 parent 483b157 commit 5d98e3c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

scripts/lint-code.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
set -euo pipefail
4+
35
# Run eslint with custom reporting:
46
npx eslint -f scripts/eslint-json-relative.js . >build/eslint.json
57
npx ts-node scripts/lint-code.ts build/eslint.json

scripts/lint-code.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as fs from "fs"
2+
import path from "path"
23

34
type ESLintSupression = {
45
kind: string
@@ -39,6 +40,13 @@ if (process.argv.length < 3) {
3940
console.error("Missing arguments: Path to eslint json file")
4041
process.exit(1)
4142
}
43+
const filePath = path.normalize(process.argv[2])
44+
if (filePath.includes("..")) {
45+
console.error(
46+
`Invalid path to eslint json file: '${filePath}' must not contain '..'!`,
47+
)
48+
process.exit(1)
49+
}
4250
const results = JSON.parse(
4351
fs.readFileSync(process.argv[2], "utf8"),
4452
) as ESLintEntry[]

0 commit comments

Comments
 (0)