Skip to content

Potential fix for code scanning alert no. 6: Cache Poisoning via execution of untrusted code - #411

Draft
garloff wants to merge 2 commits into
mainfrom
alert-autofix-6
Draft

garloff wants to merge 2 commits into
mainfrom
alert-autofix-6

Conversation

@garloff

@garloff garloff commented Nov 3, 2026

Copy link
Copy Markdown
Member

Potential fix for https://github.com/SovereignCloudStack/docs/security/code-scanning/6

Best fix: avoid running untrusted checkout + cache in a workflow_dispatch job that can operate in default-branch cache scope. In this file, the minimal safe change is to remove workflow_dispatch from this workflow and make checkout event-appropriate for PRs by using the PR head SHA directly. This preserves intended PR build behavior while removing the dangerous manual-dispatch privileged path that CodeQL points to.

Concretely in .github/workflows/build.yml:

  1. Delete the workflow_dispatch: trigger.
  2. Replace ref: ${{ github.head_ref }} with ref: ${{ github.event.pull_request.head.sha }} so PR builds use the exact PR commit.
  3. Keep cache/build steps as-is for PR context (cache scope is then tied to PR branch context rather than manual default-branch privileged dispatch path).

No new methods or external dependencies are needed.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

garloff and others added 2 commits November 3, 2026 08:03
…ution of untrusted code

This is what github suggests to avoid cache poisoning

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Kurt Garloff <kurt@garloff.de>

This branch has not been deployed

No deployments
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.

1 participant