Skip to content

Avoid caching by default#1359

Open
dscho wants to merge 3 commits intogit-for-windows:mainfrom
dscho:default-to-not-cache-by-default
Open

Avoid caching by default#1359
dscho wants to merge 3 commits intogit-for-windows:mainfrom
dscho:default-to-not-cache-by-default

Conversation

@dscho
Copy link
Copy Markdown
Member

@dscho dscho commented Apr 24, 2026

GitHub Actions caches are shared across branches and workflows within a repository, which makes them susceptible to cache-poisoning attacks. This has been demonstrated in practice by tools such as Cacheract and documented in "The Monsters in Your Build Cache". The trust boundary between cache writers and cache readers is not well-defined, so the safest default is to not cache at all. Users who have evaluated the trade-off for their threat model can still opt in with cache: true or cache: auto.

To alleviate the performance impact this would mean for the build-installers flavor, we changed the git-sdk-* ci-artifacts workflows to provide pre-built .tar.zst archives. On runner images whose tar.exe supports Zstandard (Windows Server 2025 / windows-latest), the build-installers flavor is now served directly from these CI artifacts. Older images such as windows-2022 fall back to the existing git-clone-and-build approach.

dscho added 3 commits April 24, 2026 14:16
As of git-for-windows/git-sdk-64#113,
git-for-windows/git-sdk-arm64#56 and
git-for-windows/git-sdk-32#55, the
`ci-artifacts` releases of the git-sdk-* repositories now provide
pre-built `build-installers` artifacts as `.tar.zst` files (e.g.
`git-sdk-x86_64-build-installers.tar.zst`). Downloading and extracting
these is substantially faster than the previous approach of cloning the
repository and running `please.sh create-sdk-artifact`.

The built-in `tar.exe` on Windows Server 2025 and Windows 11 24H2
(OS build 26100 and later) supports Zstandard decompression natively
via libarchive (which is the reason why above-mentioned PRs use that
format to publish the `build-installers` artifact).

Older runner images such as `windows-2022` (build 20348) lack this
support, so we detect the OS build number at runtime and fall back to
the existing `getViaGit` code path when Zstandard extraction would fail.

The `getViaCIArtifacts` function now accepts a `flavor` parameter so
both `minimal` (which continues to use `.tar.gz`) and `build-installers`
(which uses `.tar.zst`) can be served from the same code path with
hardcoded, per-flavor asset names that match the actual release assets.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
GitHub Actions caches are shared across branches and workflows within
a repository. This is an architectural property of the caching system
that makes it inherently susceptible to cache-poisoning attacks: a
low-privileged workflow (or a workflow triggered by a pull request from
a fork via `on: pull_request_target`, a splendid footgun) can write
malicious content into a cache entry, which a higher-privileged workflow
on the default branch may later restore and execute.

This attack surface has been demonstrated in practice by tools such
as Cacheract (https://github.com/AdnaneKhan/Cacheract) and
documented extensively in "The Monsters in Your Build Cache"
(https://adnanthekhan.com/2024/05/06/the-monsters-in-your-build-cache-github-actions-cache-poisoning/).
The OpenSSF has also flagged this vector in their guidance on
mitigating attack vectors in GitHub workflows
(https://openssf.org/blog/2024/08/12/mitigating-attack-vectors-in-github-workflows/).

Now that not only the `minimal` but also the `build-installers`
flavor (which were previously cached by default) are downloaded from
the `ci-artifacts` release instead of being built from scratch every
single time, the performance impact of this change is expected to be
negligible.

Given that the trust boundary between cache writers and cache readers is
not well-defined, the safest default is to not use caching at all. Users
who have evaluated the trade-off for their specific threat model can
still opt in explicitly with `cache: true` or `cache: auto`.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho mentioned this pull request Apr 24, 2026
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