Skip to content

Commit f57ec1c

Browse files
committed
Escape user input from env
1 parent 3176874 commit f57ec1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/git.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const getDiffForFile = (filePath: string, staged = false): string => {
2424
"--diff-filter=ACM",
2525
staged && "--staged",
2626
"--unified=0",
27-
process.env.ESLINT_PLUGIN_DIFF_COMMIT ?? "HEAD",
27+
JSON.stringify(process.env.ESLINT_PLUGIN_DIFF_COMMIT) ?? "HEAD",
2828
"--",
2929
sanitizeFilePath(filePath),
3030
]
@@ -48,7 +48,7 @@ const getDiffFileList = (staged = false): string[] => {
4848
"--diff-filter=ACM",
4949
"--name-only",
5050
staged && "--staged",
51-
process.env.ESLINT_PLUGIN_DIFF_COMMIT ?? "HEAD",
51+
JSON.stringify(process.env.ESLINT_PLUGIN_DIFF_COMMIT) ?? "HEAD",
5252
]
5353
.filter(Boolean)
5454
.join(" ");

0 commit comments

Comments
 (0)