Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

softprops/action-gh-release@v2 dependency within the workflow #2

Open
leighmcculloch opened this issue Dec 4, 2024 · 0 comments
Open

Comments

@leighmcculloch
Copy link

In the release workflow there's a third-party dependency softprops/action-gh-release that presents a couple concerns from a security hardening perspective:

- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG_NAME }}
draft: false
prerelease: false
body: ${{ inputs.release_description }}
files: '${{ env.BUILD_DIR_PATH }}/compilation_workflow_release/${{ env.WASM_FILE_NAME }}'
token: ${{ secrets.release_token }}

1️⃣ – not pinned

The action is referenced with a mutable reference v2 rather than an immutable commit-sha.

Pinning to commit-sha's is a security best practices in GitHub Actions and the only way to make the reference immutable:

Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository

Ref: https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-third-party-actions

2️⃣ – unnecessary permissions

The third party action is given the secrets.release_token that users of the workflow are encouraged to have given three permissions:

permissions: # required permissions for the workflow
id-token: write
contents: write
attestations: write

The third party action does not need the attestation or id-token permissions.

Permissions cannot be controlled per step, but they can be controlled per job. A common way to separate the action into a different job is to have the first job upload an artifact, and a second job download that artifact. The second job can have a token with a narrower set of permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant