Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix various issues detected by zizmor#9785

Merged
dhalbert merged 3 commits into
adafruit:mainfrom
jepler:zizmor
Nov 4, 2024
Merged

Fix various issues detected by zizmor#9785
dhalbert merged 3 commits into
adafruit:mainfrom
jepler:zizmor

Conversation

@jepler

@jepler jepler commented Nov 3, 2024

Copy link
Copy Markdown

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

dhalbert commented Nov 3, 2024

Copy link
Copy Markdown
Collaborator

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

jepler commented Nov 4, 2024

Copy link
Copy Markdown
Author

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

@dhalbert dhalbert left a comment

Copy link
Copy Markdown
Collaborator

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
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