Skip to content

Potential fix for code scanning alert no. 33: Cache Poisoning via caching of untrusted files - #427

Merged
yshavit merged 2 commits into
mainfrom
alert-autofix-33
Sep 8, 2026
Merged

yshavit merged 2 commits into
mainfrom
alert-autofix-33

Conversation

@yshavit

@yshavit yshavit commented Sep 7, 2026 •

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/yshavit/mdq/security/code-scanning/33

Best general fix: do not save cache entries in privileged/default-branch release workflows that may process untrusted or caller-controlled revisions. If caching is needed, isolate it to low-privilege PR workflows or strictly scope keys to trusted immutable refs and avoid saving when trust is uncertain.

Best single fix here (without changing build functionality): keep restore behavior for performance, but disable cache writes so poisoned content cannot be persisted. In GitHub Actions, replace actions/cache with actions/cache/restore for this step. This preserves dependency restoration speed while removing the vulnerable “save” path that causes poisoning risk.

Change required in .github/workflows/build-release.yml:

  • In the build job around lines 116–127, change the cache step from uses: actions/cache@... to uses: actions/cache/restore@....
  • Keep path and key unchanged.

No new imports, methods, or dependencies are needed.

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


Some clippy improvements thrown in, to make CI happy.

yshavit and others added 2 commits September 7, 2026 03:58
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@yshavit
yshavit marked this pull request as ready for review September 8, 2026 03:53
@yshavit
yshavit merged commit 9e84112 into main Sep 8, 2026
14 checks passed
@yshavit
yshavit deleted the alert-autofix-33 branch September 8, 2026 03:55
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