Skip to content

Commit db2af79

Browse files
authored
ci: fix semgrep reported run-shell-injection (#4168)
1 parent 43e2745 commit db2af79

File tree

7 files changed

+31
-11
lines changed

7 files changed

+31
-11
lines changed

.github/actions/build-and-publish-docker/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,14 @@ runs:
3131

3232
- name: "Build docker image"
3333
shell: bash
34-
run: ./scripts/docker-release/build_docker.sh "${{ inputs.release_version }}"
34+
run: ./scripts/docker-release/build_docker.sh "${RELEASE_VERSION}"
3535
env:
3636
SONATYPE_FALLBACK: 1
37+
RELEASE_VERSION: ${{ inputs.release_version }}
38+
3739
- name: "Push docker image"
3840
if: ${{ inputs.dry_run == 'false' }}
3941
shell: bash
40-
run: ./scripts/docker-release/push_docker.sh "${{ inputs.release_version }}"
42+
run: ./scripts/docker-release/push_docker.sh "${RELEASE_VERSION}"
43+
env:
44+
RELEASE_VERSION: ${{ inputs.release_version }}

.github/workflows/maven-goal-jdk/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ runs:
3232
- name: Set up TEST_JAVA_BINARY environment variable
3333
shell: bash
3434
run: |
35-
major_version="$(echo '${{ inputs.test-java-version }}' | sed 's/\([0-9]*\).*/\1/')"
35+
major_version="$(echo "${TEST_JAVA_VERSION}" | sed 's/\([0-9]*\).*/\1/')"
3636
java_home_var=JAVA_HOME_${major_version}_${{ runner.arch }}
3737
echo "TEST_JAVA_BINARY=${!java_home_var}/bin/java" >> $GITHUB_ENV
38+
env:
39+
TEST_JAVA_VERSION: ${{ inputs.test-java-version }}
3840

3941
- uses: ./.github/workflows/maven-goal
4042
with:

.github/workflows/maven-goal/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ runs:
2121
java-version-file: .java-version
2222
distribution: temurin
2323
cache: 'maven'
24-
- run: ${{ inputs.command }}
24+
- run: "${COMMAND}"
2525
shell: ${{ inputs.shell }}
26+
env:
27+
COMMAND: ${{ inputs.command }}

.github/workflows/pre-post-release.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,14 @@ jobs:
101101
- name: Push the ${{ inputs.phase }} release branch
102102
run: |
103103
git add --all
104-
git commit -m "${{ inputs.phase }} release: elastic-apm-agent ${{ env.RELEASE_VERSION_TAG }}"
104+
git commit -m "${PHASE} release: elastic-apm-agent ${{ env.RELEASE_VERSION_TAG }}"
105105
git push origin ${{ env.BRANCH_NAME }}
106+
env:
107+
PHASE: ${{ inputs.phase }}
106108

107109
- name: Create the ${{ inputs.phase }} release PR
108-
run: gh pr create --title="${{ inputs.pr_title }}" --base main --head ${{ env.BRANCH_NAME }} -b "${{ inputs.pr_body }}"
110+
run: gh pr create --title="${PR_TITLE}" --base main --head $BRANCH_NAME -b "${PR_BODY}"
109111
env:
110112
GH_TOKEN: ${{ steps.get_token.outputs.token }}
113+
PR_TITLE: ${{ inputs.pr_title }}
114+
PR_BODY: ${{ inputs.pr_body }}

.github/workflows/stash/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ runs:
1313
using: "composite"
1414
steps:
1515
- name: Create stash
16-
run: tar -acf ${{ runner.temp }}/${{ inputs.name }}.tar.zst -C ${{ inputs.path }} ./
16+
run: tar -acf "${{ runner.temp }}/${ARTIFACT_NAME}".tar.zst -C "${ARTIFACT_PATH}" ./
1717
shell: bash
18+
env:
19+
ARTIFACT_NAME: ${{ inputs.name }}
20+
ARTIFACT_PATH: ${{ inputs.path }}
1821

1922
- name: Upload stash
2023
uses: actions/upload-artifact@v4

.github/workflows/unstash/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@ runs:
1919
path: ${{ runner.temp }}
2020

2121
- name: Extract stash
22-
run: tar -xf ${{ runner.temp }}/${{ inputs.name }}.tar.zst -C ${{ inputs.path }}
22+
run: tar -xf "${{ runner.temp }}/${ARTIFACT_NAME}".tar.zst -C "${ARTIFACT_PATH}"
2323
shell: bash
24+
env:
25+
ARTIFACT_NAME: ${{ inputs.name }}
26+
ARTIFACT_PATH: ${{ inputs.path }}

.github/workflows/validate-tag/action.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ runs:
1515
id: validate-tag
1616
shell: 'bash'
1717
run: |
18-
if ! [ $(echo "${{ inputs.tag }}" | grep -P "(\d{1,2})\.(\d{1,2})\.(\d{1,2})") ]; then
18+
if ! [ $(echo "${TAG}" | grep -P "(\d{1,2})\.(\d{1,2})\.(\d{1,2})") ]; then
1919
echo "Tag should be a SemVer format"
2020
exit 1
2121
fi
22-
if [ $(git tag -l "${{ inputs.tag }}") ]; then
23-
echo "The tag ${{ inputs.tag }} already exists"
22+
if [ $(git tag -l "${TAG}") ]; then
23+
echo "The tag ${TAG} already exists"
2424
exit 1
2525
fi
26+
env:
27+
TAG: ${{ inputs.tag }}

0 commit comments

Comments
 (0)