Skip to content

Commit a82094c

Browse files
ShubhamChaturvedi7Shubham Chaturvedi
andauthored
Prevent script injection in GitHub Actions workflows (#2355)
* fix(ci): Prevent script injection in GitHub Actions workflows --------- Co-authored-by: Shubham Chaturvedi <scchatur@amazon.com>
1 parent 70674a8 commit a82094c

3 files changed

Lines changed: 27 additions & 11 deletions

File tree

.github/workflows/go-release.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,17 @@ jobs:
6868
6969
- name: Get release directory name
7070
id: release-dir
71+
env:
72+
PROJECT_NAME: ${{ github.event.inputs.project-name }}
73+
VERSION: ${{ github.event.inputs.version }}
7174
run: |
7275
chmod +x ./submodules/MaterialProviders/scripts/go-release-automation.sh
73-
RELEASE_DIR_NAME=$(./submodules/MaterialProviders/scripts/go-release-automation.sh get_release_dir_name "${{ github.event.inputs.project-name }}" "${{ github.event.inputs.version }}")
74-
echo "releaseDirName=$RELEASE_DIR_NAME" >> $GITHUB_OUTPUT
76+
RELEASE_DIR_NAME=$(./submodules/MaterialProviders/scripts/go-release-automation.sh get_release_dir_name "$PROJECT_NAME" "$VERSION")
77+
{
78+
echo "releaseDirName<<__GH_OUTPUT_EOF__"
79+
echo "$RELEASE_DIR_NAME"
80+
echo "__GH_OUTPUT_EOF__"
81+
} >> "$GITHUB_OUTPUT"
7582
7683
- name: Generate a changelog
7784
uses: orhun/git-cliff-action@v4
@@ -80,13 +87,17 @@ jobs:
8087
args: --bump -u --prepend releases/go/${{ steps.release-dir.outputs.releaseDirName }}/CHANGELOG.md
8188

8289
- name: Run Go release automation script
90+
env:
91+
PROJECT_NAME: ${{ github.event.inputs.project-name }}
92+
VERSION: ${{ github.event.inputs.version }}
8393
run: |
8494
chmod +x ./submodules/MaterialProviders/scripts/go-release-automation.sh
85-
./submodules/MaterialProviders/scripts/go-release-automation.sh run_release_script ${{ github.event.inputs.project-name }} ${{ github.event.inputs.version }}
95+
./submodules/MaterialProviders/scripts/go-release-automation.sh run_release_script "$PROJECT_NAME" "$VERSION"
8696
8797
- name: print diff between development and release directory
98+
env:
99+
PROJECT_NAME: ${{ github.event.inputs.project-name }}
100+
RELEASE_DIR_NAME: ${{ steps.release-dir.outputs.releaseDirName }}
88101
run: |
89-
RELEASE_DIR_NAME="${{ steps.release-dir.outputs.releaseDirName }}"
90-
PROJECT_NAME="${{ github.event.inputs.project-name }}"
91-
DIFF_FILES=$(diff -qr $PROJECT_NAME/runtimes/go/ImplementationFromDafny-go releases/go/$RELEASE_DIR_NAME || true)
92-
echo $DIFF_FILES
102+
DIFF_FILES=$(diff -qr "$PROJECT_NAME/runtimes/go/ImplementationFromDafny-go" "releases/go/$RELEASE_DIR_NAME" || true)
103+
echo "$DIFF_FILES"

.github/workflows/smithy-diff.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,14 @@ jobs:
3333
PR_NUMBER: ${{ github.event.pull_request.number }}
3434
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3535
FILES: ${{ steps.file-changes.outputs.FILES }}
36+
PR_USER: ${{ github.event.pull_request.user.login }}
37+
ACTOR: ${{ github.actor }}
38+
REPO: ${{ github.repository }}
3639
if: ${{env.FILES != ''}}
3740
run: |
3841
# If https://github.com/smithy-lang/smithy-dafny/issues/491 is resolved, remove comment about this issue.
39-
COMMENT="@${{github.event.pull_request.user.login}} and @${{github.actor}}, I noticed you are updating the smithy model files.\nDoes this update need new or updated javadoc trait documentation?\n Are you adding constraints inside list, map or union? Do you know about this issue: https://github.com/smithy-lang/smithy-dafny/issues/491?"
40-
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
41-
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}"
42+
COMMENT="@${PR_USER} and @${ACTOR}, I noticed you are updating the smithy model files.
43+
Does this update need new or updated javadoc trait documentation?
44+
Are you adding constraints inside list, map or union? Do you know about this issue: https://github.com/smithy-lang/smithy-dafny/issues/491?"
45+
COMMENT_URL="https://api.github.com/repos/${REPO}/issues/${PR_NUMBER}/comments"
46+
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST "$COMMENT_URL" -d "$(jq -nc --arg body "$COMMENT" '{body: $body}')"

DynamoDbEncryption/runtimes/rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ readme = "README.md"
1717
[dependencies]
1818
aws-config = "1.8.12"
1919
aws-lc-rs = {version = "1.17.0"}
20-
aws-lc-sys = { version = "0.42", optional = true }
20+
aws-lc-sys = { version = "0.43", optional = true }
2121
aws-lc-fips-sys = { version = "0.13.1", optional = true }
2222
aws-sdk-dynamodb = "1.103.0"
2323
aws-sdk-kms = "1.98.0"

0 commit comments

Comments
 (0)