Skip to content

The version input defaults to latest and can't be "locked"Β #52

@nafarlee

Description

@nafarlee

Currently, the default for the version input is the special value latest which, as noted in the README, causes the latest released version of the zizmor image to be pulled/run:

zizmor-action/action.yml

Lines 41 to 44 in da5ac40

version:
description: The version of zizmor to use
required: false
default: latest

Further, the version input is checked to ensure it is either this special value or a three-part version string that could correspond to a particular zizmor image:

zizmor-action/action.sh

Lines 38 to 41 in da5ac40

version_regex='^v?[0-9]+\.[0-9]+\.[0-9]+$'
[[ "${GHA_ZIZMOR_VERSION}" == "latest" || "${GHA_ZIZMOR_VERSION}" =~ $version_regex ]] \
|| die "'version' must be 'latest' or an exact X.Y.Z version"

zizmor-action/action.sh

Lines 63 to 82 in da5ac40

image="ghcr.io/zizmorcore/zizmor:${GHA_ZIZMOR_VERSION#v}"
# Notes:
# - We run the container with ${GITHUB_WORKSPACE} mounted as /workspace
# and with /workspace as the working directory, so that user inputs
# like '.' resolve correctly.
# - We pass the GitHub token as an environment variable so that zizmor
# can run online audits/perform online collection if requested.
# - ${GHA_ZIZMOR_INPUTS} is intentionally not quoted, so that
# it can expand according to the shell's word-splitting rules.
# However, we put it after `--` so that it can't be interpreted
# as one or more flags.
#
# shellcheck disable=SC2086
docker run \
--rm \
--volume "${GITHUB_WORKSPACE}:/workspace:ro" \
--workdir "/workspace" \
--env "GH_TOKEN=${GHA_ZIZMOR_TOKEN}" \
"${image}" \

Considering this action is intended to help detect (among other things) insecure "mutable" references to external GitHub Actions plugins, I find this behavior concerning. In the event that zizmor's supply-chain is compromised and a malicious version of the image is published as latest, any users of zizmor-action that have kept the defaults would be impacted

Users can choose to target an exact version, but as before, if the zizmor supply-chain is compromised I think GitHub Packages would allow an attacker to delete published tags and republish malicious versions under the same tags

Would it be possible to:

  1. Modify the version input to allow exact image digests
  2. If so, change the default version to specify a particular image digest. If not, change the default version to specify an exact three-part version string

I am willing to put in PRs for one/both of these if there is an appetite for these changes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions