Skip to content

Conversation

sprt
Copy link
Contributor

@sprt sprt commented Jun 26, 2025

This provides fixes for the alerts surfaced by our Zizmor scanning.

After this PR, only 2 alerts remain (re: pull_request_target) which I plan to dismiss as wontfix: https://github.com/kata-containers/kata-containers/security/code-scanning?query=pr%3A11475+is%3Aopen+

Test run: https://github.com/kata-containers/kata-containers/actions/runs/15908722729

sprt added 2 commits June 26, 2025 12:29
This fixes a Zizmor error where some variables are vulnerable to template
injection.

https://github.com/kata-containers/kata-containers/security/code-scanning/67

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
This removes the permission from the workflow since it's already present
at the job level.

https://github.com/kata-containers/kata-containers/security/code-scanning/111

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
This adds Zizmor GHA security scanning as a PR gate.

Note that this does NOT require that Zizmor returns 0 alerts, but rather
that Zizmor's invocation completes successfully (regardless of how many
alerts it raises).

I will set up the former after this commit is merged (through the GH UI).

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
@sprt sprt added security Potential or actual security issue labels Jun 26, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

A security fix for CI configuration to mitigate alerts from Zizmor scanning and improve environment variable consistency in GitHub Actions workflows.

  • Included a new required test for "GHA security analysis / zizmor" in the gatekeeper tests.
  • Updated several release and deployment workflows to use environment-defined variables for improved clarity and secure parameter passing.
  • Removed the "id-token: write" permission in the CI-on-push workflow to further restrict access.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/testing/gatekeeper/required-tests.yaml Added required test for GHA security analysis (zizmor)
.github/workflows/release.yaml Refactored helm registry login using environment variables
.github/workflows/release-s390x.yaml Introduced TARGET_ARCH from inputs for tag construction
.github/workflows/release-ppc64le.yaml Introduced TARGET_ARCH from inputs for tag construction
.github/workflows/release-arm64.yaml Introduced TARGET_ARCH from inputs for tag construction
.github/workflows/release-amd64.yaml Introduced TARGET_ARCH from inputs for tag construction
.github/workflows/publish-kata-deploy-payload.yaml Switched from direct inputs to using env variables for registry, repo, and tag
.github/workflows/ci-on-push.yaml Removed the unneeded "id-token: write" permission

@@ -6,7 +6,7 @@ required_tests:
- Shellcheck required / shellcheck-required
# TODO: cargo-deny-runner.yaml not yet treated as conditional
- Cargo Crates Check Runner / cargo-deny-runner

- GHA security analysis / zizmor
Copy link
Member

Choose a reason for hiding this comment

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

If the PR isn't a workflow change and therefore the job isn't triggered, how will this interact with the required test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm good point, and it seems like the code scanning protection rule is pretty basic, ie. "this tool needs to run or else": https://github.com/kata-containers/kata-containers/settings/rules/6331013

So how about we remove the path restriction from the zizmor action?

paths: [".github/workflows/**"]

Copy link
Member

Choose a reason for hiding this comment

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

I think the path restriction makes sense, so I wonder if we need to have a category of workflow checks (e.g. zizmor & action lint) that only are required when there is a workflow change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My issue is that this would only be supported by gatekeeper required tests, not GH UI required tests. GH would still expect (1) zizmor to run for each PR and (2) (I think) zizmor results to be collected for each PR.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I don't think we can make it required through github in the current state

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, in that case I vote to remove the path restriction since (1) the Zizmor job is relatively cheap and (2) the gatekeeper job is still not a required check either.

The way GH works, we can only require Zizmor results on ALL PR runs, or
none, so remove the path filter.

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
Copy link
Member

@stevenhorsman stevenhorsman left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@sprt sprt merged commit fe532f9 into main Jul 3, 2025
55 of 58 checks passed
@sprt sprt deleted the sprt/zizmor-fixes branch July 3, 2025 18:29
@sprt
Copy link
Contributor Author

sprt commented Jul 3, 2025

Forced-merged as workflow change.

@stevenhorsman
Copy link
Member

Forced-merged as workflow change.

We still should have two approvals for PRs

@sprt
Copy link
Contributor Author

sprt commented Jul 3, 2025

Argh sorry, completely overlooked that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security Potential or actual security issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants