Skip to content

Commit 7907891

Browse files
committed
Harden security with inputs.
Removes a few inputs; gives up on trying to get a list of files in a single input. Uses temporary directory to store SARIF file.
1 parent 7f54939 commit 7907891

File tree

2 files changed

+7
-25
lines changed

2 files changed

+7
-25
lines changed

README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,8 @@ You only need to set them if the defaults do not work for your situation.
4040
`hlint-bin`
4141
: Path to the hlint binary.
4242

43-
`args`
44-
: Extra arguments to pass to HLint.
45-
4643
`path`
47-
: Path or array of paths that HLint will be told to scan.
48-
49-
`sarif_file`
50-
: The name of the SARIF file to write and upload to GitHub code scanning.
44+
: Path of file or directory that HLint will be told to scan.
5145

5246
`category`
5347
: String used by GitHub code scanning for matching the analyses.
@@ -65,10 +59,6 @@ Instead, its goal is to file [GitHub code scanning] alerts.
6559
To use HLint for status checks, e.g., during pushes or pull requests,
6660
see [haskell/actions/hlint-run] instead.
6761

68-
This action has not hardened security with its inputs yet.
69-
Do *not* use this action in a situation where uncontrolled input can be passed to it.
70-
E.g., another action which would pass its input to this one.
71-
7262
## Code of conduct
7363

7464
Be nice; see [`CODE_OF_CONDUCT.md`](docs/CODE_OF_CONDUCT.md) for details.

action.yaml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,10 @@ inputs:
2020
description: Path to the hlint binary.
2121
required: false
2222
default: hlint
23-
args:
24-
description: An array of extra arguments to pass to HLint.
25-
required: false
26-
default: null
2723
path:
28-
description: Path or array of paths that HLint will be told to scan.
24+
description: Path of file or directory that HLint will be told to scan.
2925
required: false
3026
default: .
31-
sarif_file:
32-
description: The name of the SARIF file to write and upload to GitHub code scanning.
33-
required: false
34-
default: hlint.sarif
3527
category:
3628
description: String used by GitHub code scanning for matching the analyses.
3729
required: false
@@ -48,17 +40,17 @@ runs:
4840
steps:
4941

5042
- name: Run HLint
51-
run: $BINARY --no-exit-code --sarif ${ARGS} ${PATHS} >> ${SARIF_FILE}
43+
run: |
44+
"$BINARY" --no-exit-code --sarif "$FILEPATH" >> $TMPDIR/hlint.sarif
5245
shell: bash
5346
env:
54-
ARGS: ${{ join(inputs.args, ' ') }}
5547
BINARY: ${{ inputs.binary }}
56-
PATHS: ${{ join(inputs.path, ' ') }}
57-
SARIF_FILE: ${{ inputs.sarif_file }}
48+
FILEPATH: ${{ inputs.path }}
49+
TMPDIR: ${{ runner.temp }}
5850

5951
- id: upload-sarif
6052
name: Upload SARIF file
6153
uses: github/codeql-action/upload-sarif@v2
6254
with:
63-
sarif_file: ${{ inputs.sarif_file }}
55+
sarif_file: ${{ runner.temp }}/hlint.sarif
6456
category: ${{ inputs.category }}

0 commit comments

Comments
 (0)