File tree Expand file tree Collapse file tree 5 files changed +39
-6
lines changed Expand file tree Collapse file tree 5 files changed +39
-6
lines changed Original file line number Diff line number Diff line change @@ -38,13 +38,35 @@ jobs:
38
38
- name : Run action with args
39
39
uses : ./
40
40
with :
41
- args : -Dsonar.someArg=aValue -Dsonar.scanner.internal.dumpToFile=./output.properties
41
+ args : -Dsonar.someArg=aValue -Dsonar.anotherArgWithSpaces="Another Value"
42
42
env :
43
43
SONAR_HOST_URL : http://not_actually_used
44
44
SONAR_SCANNER_JSON_PARAMS : ' {"sonar.scanner.internal.dumpToFile": "./output.properties"}'
45
45
- name : Assert
46
46
run : |
47
47
./test/assertFileContains ./output.properties "sonar.someArg=aValue"
48
+ ./test/assertFileContains ./output.properties "sonar.anotherArgWithSpaces=Another Value"
49
+ argsInputInjectionTest :
50
+ name : >
51
+ 'args' input with command injection
52
+ strategy :
53
+ matrix :
54
+ os : [ ubuntu-latest, windows-latest, macos-latest ]
55
+ runs-on : ${{ matrix.os }}
56
+ steps :
57
+ - uses : actions/checkout@v4
58
+ with :
59
+ token : ${{ secrets.GITHUB_TOKEN }}
60
+ - name : Run action with args
61
+ uses : ./
62
+ with :
63
+ args : -Dsonar.someArg=aValue && echo "Injection"
64
+ env :
65
+ SONAR_HOST_URL : http://not_actually_used
66
+ SONAR_SCANNER_JSON_PARAMS : ' {"sonar.scanner.internal.dumpToFile": "./output.properties"}'
67
+ - name : Assert
68
+ run : |
69
+ ./test/assertFileContains ./output.properties "sonar.someArg=aValue"
48
70
projectBaseDirInputTest :
49
71
name : >
50
72
'projectBaseDir' input
Original file line number Diff line number Diff line change 50
50
run : echo "${RUNNER_TEMP}/sonar-scanner-cli-${{ inputs.scannerVersion }}-${{ runner.os }}-${{ runner.arch }}/bin" >> $GITHUB_PATH
51
51
shell : bash
52
52
- name : Run SonarScanner
53
- run : ${GITHUB_ACTION_PATH}/scripts/run-sonar-scanner-cli.sh ${{ inputs.args }}
53
+ run : |
54
+ args=(${{ inputs.args }})
55
+ cmd=(${GITHUB_ACTION_PATH}/scripts/run-sonar-scanner-cli.sh "${args[@]}")
56
+ "${cmd[@]}"
54
57
shell : bash
55
58
env :
56
59
INPUT_PROJECTBASEDIR : ${{ inputs.projectBaseDir }}
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ set -eou pipefail
4
+
3
5
error () { echo -e " \\ e[31m✗ $* \\ e[0m" ; }
4
6
5
- assertFileExists $1
7
+ scriptDir=$( dirname -- " $( readlink -f -- " ${BASH_SOURCE[0]} " ) " )
8
+
9
+ $scriptDir /assertFileExists " $1 "
6
10
7
- if ! grep -q $2 $1 ; then
11
+ if ! grep -q " $2 " " $1 " ; then
8
12
error " '$2 ' not found in '$1 '"
9
13
exit 1
10
14
fi
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ set -eou pipefail
4
+
3
5
error () { echo -e " \\ e[31m✗ $* \\ e[0m" ; }
4
6
5
- if [ -f $1 ]; then
7
+ if [ -f " $1 " ]; then
6
8
error " File '$1 ' found"
7
9
exit 1
8
10
fi
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ set -eou pipefail
4
+
3
5
error () { echo -e " \\ e[31m✗ $* \\ e[0m" ; }
4
6
5
- if [ ! -f $1 ]; then
7
+ if [ ! -f " $1 " ]; then
6
8
error " File '$1 ' not found"
7
9
exit 1
8
10
fi
You can’t perform that action at this time.
0 commit comments