Skip to content

Commit fab3ec1

Browse files
FdawgsCopilot
andauthored
refactor(action): avoid code injection (#718)
* refactor(action): avoid code injection * Update action.yml Co-authored-by: Copilot <[email protected]> Signed-off-by: Frazer Smith <[email protected]> --------- Signed-off-by: Frazer Smith <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent f41cfbc commit fab3ec1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

action.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,24 @@ runs:
6868
- name: Merge/approve PR
6969
uses: actions/github-script@v7
7070
id: approver
71+
env:
72+
ACTION_PATH: ${{ github.action_path }}
73+
UPDATE_TYPE: ${{ steps.dependabot-metadata.outputs.update-type }}
74+
DEPENDENCY_TYPE: ${{ steps.dependabot-metadata.outputs.dependency-type }}
75+
DEPENDENCY_NAMES: ${{ steps.dependabot-metadata.outputs.dependency-names }}
7176
with:
7277
github-token: ${{ inputs.github-token }}
7378
script: |
74-
const script = require('${{ github.action_path }}/dist/index.js')
79+
const { ACTION_PATH, UPDATE_TYPE, DEPENDENCY_TYPE, DEPENDENCY_NAMES } = process.env
80+
const script = require(ACTION_PATH + '/dist/index.js')
7581
await script({
7682
github,
7783
context,
7884
inputs: ${{ toJSON(inputs) }},
7985
dependabotMetadata: {
80-
updateType: '${{ steps.dependabot-metadata.outputs.update-type }}',
81-
dependencyType:'${{ steps.dependabot-metadata.outputs.dependency-type }}',
82-
dependencyNames: '${{ steps.dependabot-metadata.outputs.dependency-names }}',
86+
updateType: UPDATE_TYPE,
87+
dependencyType: DEPENDENCY_TYPE,
88+
dependencyNames: DEPENDENCY_NAMES,
8389
}
8490
})
8591

0 commit comments

Comments
 (0)