Increase publish workflow security and tighten permissions - #273
Merged
Conversation
What: Sets permissions to none, pins calls to external actions to specific commits, prevents credentials from actions/checkout from persisting, and replaces direct use of the GitHub variables in the shell execution with indirect usage via shell variables. Why: To minimize the chance of the workflow being hacked or vulnerable to a supply chain hack (pinning the external action calls helps with this), and in preparation to globally restrict permissions for all Hubs Foundation workflows. According to Zizmor, filtering GitHub variables through environment variables prevents code injection via template expansion. Essentially, this should ensure an attacker can't manipulate data in GitHub to achieve remote code execution when the workflow is run. Note: These security improvements were advised by the Zizmor tool and GitHubSecurityLab/actions-permissions@bf82d13 #v1 Beta 9
Member
Author
|
Updated description. |
62 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Sets permissions to none, pins calls to external actions to specific commits, prevents credentials from actions/checkout from persisting, and replaces direct use of the GitHub variables in the shell execution with indirect usage via shell variables.
Why?
To minimize the chance of the workflow being hacked or vulnerable to a supply chain hack (pinning the external action calls helps with this), and in preparation to globally restrict permissions for all Hubs Foundation workflows.
According to Zizmor, filtering GitHub variables through environment variables prevents code injection via template expansion. Essentially, this should ensure an attacker can't manipulate data in GitHub to achieve remote code execution when the workflow is run.
Examples
N/A
How to test
To verify that all the Zizmor issues have been addressed, run the following command from the repository folder and see that Zizmor reports no issues (that we care about) for the publish workflow.
Documentation of functionality
This doesn't change the functionality of the workflow, so no documentation update is needed.
Known limitations
This doesn't update any of the external workflow versions. I feel it is out of scope for this PR and can/should be done along with all the others in further PRs when addressing GitHub's required update to use Node 24+.
Alternatives considered
None.
Open questions
None.
Additional details or related context
These security improvements were advised by the Zizmor tool and
GitHubSecurityLab/actions-permissions/monitor@bf82d13b9b10051d224345ab9184f5ede0a94289 #v1 Beta 9Part of Hubs-Foundation/.github#13