Skip to content

Commit 6b920c2

Browse files
v1vkuisathaverat
andauthored
fix(semgrep): avoid run-shell-injection (#280)
* fix(semgrep): avoid run-shell-injection * fix(semgrep): avoid run-shell-injection * fix(semgrep): avoid run-shell-injection * fix * Apply suggestions from code review Co-authored-by: Ivan Fernandez Calvo <5400788+kuisathaverat@users.noreply.github.com> --------- Co-authored-by: Ivan Fernandez Calvo <5400788+kuisathaverat@users.noreply.github.com>
1 parent 2b0acde commit 6b920c2

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

oblt-cli/deploy-my-kibana/action.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ runs:
6969

7070
- if: ${{ inputs.github-token != '' }}
7171
name: If GitHub token provided
72-
run: echo "GH_TOKEN=${{ inputs.github-token }}" >> "$GITHUB_ENV"
72+
run: echo "GH_TOKEN=${GH_TOKEN}" >> "$GITHUB_ENV"
73+
env:
74+
GH_TOKEN: ${{ inputs.github-token }}
7375
shell: bash
7476

7577
- uses: elastic/oblt-actions/github/is-member-of@v1
@@ -82,7 +84,7 @@ runs:
8284
- name: Get cluster given the target branch (either edge-lite or release)
8385
if: contains(steps.is_elastic_member.outputs.result, 'true')
8486
run: |-
85-
PR=$(basename ${{ inputs.issue-url }})
87+
PR=$(basename "${ISSUE_URL}")
8688
echo "PR=${PR}" >> $GITHUB_ENV
8789
8890
# issue_comment does not contain any references to github.base_ref
@@ -93,6 +95,8 @@ runs:
9395
else
9496
echo "CLUSTER=release-oblt" >> $GITHUB_ENV
9597
fi
98+
env:
99+
ISSUE_URL: ${{ inputs.issue-url }}
96100
shell: bash
97101

98102
- name: Create GitHub issue
@@ -118,16 +122,19 @@ runs:
118122
119123
### Further details
120124
121-
Caused by @${{ inputs.user }} in ${{ inputs.comment-url }} via this [GitHub workflow build](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }})
125+
Caused by @${GITHUB_USER} in ${COMMENT_URL} via this [GitHub workflow build](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }})
122126
EOT
123127
gh issue \
124128
create \
125129
--label 'deploy-custom-kibana' \
126-
--title "[Deploy Kibana] for user ${{ inputs.user }} with PR kibana@pr-${{ env.PR }} on cluster ${{ env.CLUSTER }}" \
127-
--assignee ${{ inputs.user }} \
130+
--title "[Deploy Kibana] for user ${GITHUB_USER} with PR kibana@pr-${{ env.PR }} on cluster ${{ env.CLUSTER }}" \
131+
--assignee "${GITHUB_USER}" \
128132
--body-file .body-content \
129133
--repo elastic/observability-test-environments | tee .issue
130134
echo "issue=$(cat .issue)" >> "$GITHUB_OUTPUT"
135+
env:
136+
GITHUB_USER: ${{ inputs.user }}
137+
COMMENT_URL: ${{ inputs.comment-url }}
131138
shell: bash
132139

133140
- name: Notify with a reaction if a non-elastician comment

oblt-cli/run/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ runs:
2424
slack-channel: ${{ inputs.slack-channel }}
2525
username: ${{ inputs.username }}
2626
- name: run oblt-cli
27-
run: oblt-cli --verbose ${{ inputs.command }}
27+
run: oblt-cli --verbose ${COMMAND}
2828
shell: bash
2929
env:
3030
GITHUB_TOKEN: ${{ inputs.github-token }}
31+
COMMAND: ${{ inputs.command }}

oblt-cli/undeploy-my-kibana/action.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,18 @@ runs:
5555

5656
- if: ${{ inputs.github-token != '' }}
5757
name: If GitHub token provided
58-
run: echo "GH_TOKEN=${{ inputs.github-token }}" >> "$GITHUB_ENV"
58+
run: echo "GH_TOKEN=${GH_TOKEN}" >> "$GITHUB_ENV"
59+
env:
60+
GH_TOKEN: ${{ inputs.github-token }}
5961
shell: bash
6062

6163
- name: Gather PR Owner
6264
run: |-
63-
PR_AUTHOR=$(gh pr view ${{ inputs.pull-request }} --repo ${{ inputs.repository }} --json author --jq .author.login)
65+
PR_AUTHOR=$(gh pr view "${PR}" --repo "${REPO}" --json author --jq .author.login)
6466
echo "PR_AUTHOR=${PR_AUTHOR}" >> $GITHUB_ENV
67+
env:
68+
PR: ${{ inputs.pull-request }}
69+
REPO: ${{ inputs.repository }}
6570
shell: bash
6671

6772
- name: Create GitHub issue body

0 commit comments

Comments
 (0)