-
Notifications
You must be signed in to change notification settings - Fork 68
Improve security of GitHub Actions workflows #1298
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
Improve security of GitHub Actions workflows #1298
Conversation
|
Skipping CI for Draft Pull Request. |
02703ca to
0735e2b
Compare
|
It will probably take a couple of passes to double check everything on this. Since this is such a sweeping change, I think once we feel this is no longer WIP, we setup your fork to cut releases to your own quay and test those workflows as well. |
0735e2b to
1dee373
Compare
|
I've reduced the scope of this PR to skip explicitly adding permissions on jobs/workflows for now, instead just leaving TODOs. In follow-up PRs, we should audit the necessary scope of the tokens for each job using a tool like https://github.com/GitHubSecurityLab/actions-permissions, and then assign the necessary permissions based on findings. |
|
from change #1298: |
Code Review by GeminiThis pull request significantly improves the security posture of your GitHub Actions workflows, addressing several critical attack vectors. The commit message is exceptionally clear, detailing the vulnerabilities addressed and even noting what will be tackled in a follow-up PR. Here's a detailed review: General Observations & Strengths
Specific Feedback and Suggestions
|
Code Review by GeminiThis pull request significantly improves the security posture of your GitHub Actions workflows, addressing several common attack vectors. The changes are well-aligned with the detailed commit message and demonstrate a strong commitment to security best practices. Here's a breakdown of the review: Overall AssessmentThe changes are excellent and directly address the stated goals:
Detailed FeedbackSecurity Vulnerabilities & Best Practices
Performance Optimizations
Idiomatic Go
Minor Suggestions
ConclusionThis pull request represents a substantial and well-executed security improvement for your GitHub Actions workflows. The changes are thorough, correctly implemented, and demonstrate a proactive approach to supply chain security. Approved. |
1dee373 to
f495956
Compare
f495956 to
50ae9ce
Compare
|
Edited to add scanning with actionlint, which also runs |
|
from change #1298: |
|
from change #1298: |
50ae9ce to
a18b9d2
Compare
|
/lgtm |
|
from change #1298: |
|
from change #1298: |
|
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like to see a final pass that all of the release tags for actions used are up-to-date. Otherwise, lgtm
Signed-off-by: Caleb Xu <caxu@redhat.com>
Signed-off-by: Caleb Xu <caxu@redhat.com>
a18b9d2 to
fb1d072
Compare
|
Updated. Since the last time I visited this, Zizmor also added an audit on
More about the Alternatively, we can also disable/ignore this particular audit if this seems unreasonable. |
|
from change #1298: |
|
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: acornett21, bcrochet, caxu-rh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This change addresses several attack vectors and weaknesses which have been seen in the wild over the past few years:
${{ ... }}in scripts, where they are added literally, assign the value to an environment variable and use the environment variable in the script. The shell will expand the environment variable and escape any problematic inputs.tj-actions/changed-filesaction resulted in the potential compromise of secrets for any workflows which ran the action without pinning it to a known good version.Excessive token permissions. The GitHub token used inside the workflow run has write access to most things in the repo, unless permissions are explicitly specified. Tools are also available to audit workflows and identify the minimal required set of permissions.We'll tackle this in a follow-up PR.actions/checkoutaction, a copy of the workflow credential (e.g.GITHUB_TOKEN) will be persisted in the checked-out repository's.git/config. This makes it easier to perform some further operations in the repo, e.g. pushing a commit or tag later. This can pose an issue if the checked-out repository is then uploaded as an artifact, which can be publicly downloaded.This change also introduces scanning using zizmor, a static analyzer for GitHub Actions workflows, to run on pushes to main and all pull requests.