Skip to content

Commit 892efa4

Browse files
fix(ci): harden trigger-maven-release against script-injection
Move tag_name interpolation out of inline JS into an env var and read it via process.env, matching the pattern already used in release.yml. Also scope actions: write to the trigger-maven-release job instead of the whole workflow so release-please runs with minimum privilege. Addresses review feedback from @j10t on PR #161.
1 parent edc94f3 commit 892efa4

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

.github/workflows/release-please.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
permissions:
99
contents: write
1010
pull-requests: write
11-
actions: write
1211

1312
jobs:
1413
release-please:
@@ -32,19 +31,22 @@ jobs:
3231
needs: release-please
3332
if: ${{ needs.release-please.outputs.release_created == 'true' }}
3433
runs-on: ubuntu-latest
34+
permissions:
35+
actions: write
3536
steps:
3637
- name: Trigger Maven Central publish
3738
uses: actions/github-script@v7
39+
env:
40+
TAG_NAME: ${{ needs.release-please.outputs.tag_name }}
3841
with:
3942
github-token: ${{ secrets.GITHUB_TOKEN }}
4043
script: |
44+
const tagName = process.env.TAG_NAME;
4145
await github.rest.actions.createWorkflowDispatch({
4246
owner: context.repo.owner,
4347
repo: context.repo.repo,
4448
workflow_id: 'release.yml',
4549
ref: 'main',
46-
inputs: {
47-
tag_name: '${{ needs.release-please.outputs.tag_name }}'
48-
}
50+
inputs: { tag_name: tagName }
4951
});
50-
console.log('Triggered Maven Central publish workflow for tag: ${{ needs.release-please.outputs.tag_name }}');
52+
console.log(`Triggered Maven Central publish workflow for tag: ${tagName}`);

0 commit comments

Comments
 (0)