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

Fix various issues detected by zizmor #9785

Merged
merged 3 commits into from
Nov 4, 2024
Merged

Conversation

jepler
Copy link
Member

@jepler jepler commented Nov 3, 2024

zizmor is "A tool for finding security issues in GitHub Actions setups." It found multiple diagnostics in our actions; I have made an attempt to fix the findings.

@dhalbert
Copy link
Collaborator

dhalbert commented Nov 3, 2024

What is the security hole about computing a value in the .yaml during an action instead of computing the value and putting it in the environment? (I'd think maybe it is the other way around.)

@jepler
Copy link
Member Author

jepler commented Nov 4, 2024

What is the security hole about computing a value in the .yaml during an action instead of computing the value and putting it in the environment? (I'd think maybe it is the other way around.)

zizmor calls this "template injection". https://woodruffw.github.io/zizmor/audits/#template-injection and github has detailed how this is unsafe in a shell context here: https://securitylab.github.com/resources/github-actions-untrusted-input/#script-injections

Compare what happens when the malicious TITLE is supplied via environment variable vs when it is interpolated into a shell script directly before the shell script is evalutated by (ba)sh:

$ TITLE='zzz";echo${IFS}"hello";#' sh -c 'echo "$TITLE"'
zzz";echo${IFS}"hello";#
$ sh -c 'echo "zzz";echo${IFS}"hello";#"'
zzz
hello

The shell script snippets also have to handle weird inputs via proper quoting, but zizmor is not (as far as I know) trying to diagnose incorrect use of shell, just the workflow syntax.

@jepler jepler requested a review from dhalbert November 4, 2024 21:13
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Thanks, Dr. Zizmor.

@dhalbert dhalbert merged commit bf412b4 into adafruit:main Nov 4, 2024
562 checks passed
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

Successfully merging this pull request may close these issues.

2 participants