Skip to content

Make the Gradle build cache read-only by default - #509

Merged
andrew merged 1 commit into
git-pkgs:mainfrom
pinguinfuss:issue-497-gradle-read-only
Oct 18, 2026
Merged

andrew merged 1 commit into
git-pkgs:mainfrom
pinguinfuss:issue-497-gradle-read-only

Conversation

@pinguinfuss

Copy link
Copy Markdown
Contributor

Fixes #497.

gradle.build_cache.read_only now defaults to true, so a client that can reach the proxy can't PUT to /gradle/ and overwrite cache entries that end up in other people's builds. GET and HEAD work as before.

This is a breaking change for setups that upload to the cache: set read_only: false (or PROXY_GRADLE_BUILD_CACHE_READ_ONLY=false) on the instance your CI jobs push to. docs/configuration.md describes this, and the README and dashboard snippets now push only from CI (isPush = System.getenv("CI") != null, Kotlin DSL).

PROXY_GRADLE_BUILD_CACHE_READ_ONLY is parsed strictly. The shared envBool treats anything other than true/1 as false, so with the new default a value like yes or TRUE would have opened uploads. The variable now accepts what strconv.ParseBool accepts; any other value keeps the cache read-only and logs a warning at startup. The other boolean variables are unchanged.

Tests cover the new default, a config file with a partial build_cache block, the environment values, and the server wiring (PUT returns 405 by default and 201 with read_only: false).

…n reach the proxy can no longer overwrite cache entries; CI jobs that upload now need gradle.build_cache.read_only: false (or PROXY_GRADLE_BUILD_CACHE_READ_ONLY=false). The environment variable is parsed strictly, so a value like "yes" keeps uploads off and logs a warning instead of opening them. Fixes git-pkgs#497.
@pinguinfuss
pinguinfuss marked this pull request as ready for review October 18, 2026 11:03

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The read-only default, explicit upload opt-in, and strict environment parsing are covered by configuration and HTTP server tests. The configuration documentation explains the changed default for existing upload setups.

@andrew
andrew merged commit 83e2fb4 into git-pkgs:main Oct 18, 2026
6 checks passed
@pinguinfuss
pinguinfuss deleted the issue-497-gradle-read-only branch October 21, 2026 01:43
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.

Make the Gradle build cache read-only by default

2 participants