Skip to content

Add opt-in Gradle restrictions to Java remediation - #118

Merged
francoisl merged 1 commit into
mainfrom
rory/restrict-gradle-java
Oct 22, 2026
Merged

francoisl merged 1 commit into
mainfrom
rory/restrict-gradle-java

Conversation

@roryabraham

@roryabraham roryabraham commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Details

Centralize the repeated "Restrict Gradle to the protected JDK" steps from the Java certificate rollout. Patching one JVM does not prevent Gradle from selecting or downloading another, unprotected toolchain.

Add opt-in restrict-gradle: 'true' to block-compromised-java-certificates action, defaulting to 'false'. After successful certificate remediation, it:

  • Configures the protected JDK as Gradle's JVM and sole toolchain installation, disables auto-detection/downloads, and clears extra environment-provided toolchains.
  • Uses GRADLE_USER_HOME, falling back to $HOME/.gradle; appends overriding properties while preserving unrelated bytes and file permissions. Repeat runs with the same settings are no-ops.
  • Requires JAVA_HOME to match the protected java-home, including equivalent symlink paths, so the Gradle launcher starts on the protected JVM.
  • Keeps the portable certificate-remediation script focused on blocklists; callers opt in to the Gradle policy explicitly.

Run the action after Java setup and Gradle cache restoration, before Gradle. The selected JDK must satisfy the project's toolchain and daemon criteria; incompatible requirements fail instead of downloading/selecting another JVM. Multi-JDK builds can retain their own explicit policy.

Related Issues

For https://github.com/Expensify/Expensify/issues/694720

Manual Tests

n/a - automated tests only.

Linked PRs

Follow-up to #117.

After this merges, consumers can bump their action SHA, set restrict-gradle: 'true', and remove the duplicated inline Gradle-property steps:

Add opt-in Gradle hardening after successful certificate remediation. Prevent cached JVM settings and automatic toolchain selection from bypassing the protected JDK while preserving unrelated Gradle properties.
@roryabraham
roryabraham requested a review from francoisl October 22, 2026 23:04
@roryabraham
roryabraham marked this pull request as ready for review October 22, 2026 23:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T23:08:44.535672Z 74e300c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@francoisl
francoisl merged commit b70c378 into main Oct 22, 2026
21 of 22 checks passed
@francoisl
francoisl deleted the rory/restrict-gradle-java branch October 22, 2026 23:26
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.

2 participants