Skip to content

Commit

Permalink
fix: snyk issue in code linter
Browse files Browse the repository at this point in the history
  • Loading branch information
ahochsteger committed Dec 26, 2024
1 parent 483b157 commit 5d98e3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scripts/lint-code.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -euo pipefail

# Run eslint with custom reporting:
npx eslint -f scripts/eslint-json-relative.js . >build/eslint.json
npx ts-node scripts/lint-code.ts build/eslint.json
Expand Down
8 changes: 8 additions & 0 deletions scripts/lint-code.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as fs from "fs"
import path from "path"

type ESLintSupression = {
kind: string
Expand Down Expand Up @@ -39,6 +40,13 @@ if (process.argv.length < 3) {
console.error("Missing arguments: Path to eslint json file")
process.exit(1)
}
const filePath = path.normalize(process.argv[2])
if (filePath.includes("..")) {
console.error(
`Invalid path to eslint json file: '${filePath}' must not contain '..'!`,
)
process.exit(1)
}
const results = JSON.parse(
fs.readFileSync(process.argv[2], "utf8"),
) as ESLintEntry[]
Expand Down

0 comments on commit 5d98e3c

Please sign in to comment.