Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

chore(java): validate the Gradle wrapper in every job that runs it, pin its distribution

Adeshina Lasisi07e9851c94b1
diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml
index f4956c1d..c5aaf629 100644
--- a/.github/workflows/java.yml
+++ b/.github/workflows/java.yml
@@ -14,6 +14,15 @@ on:
pull_request:
push:
workflow_dispatch:
+#
+# SUPPLY CHAIN: `laya-java/gradle/wrapper/gradle-wrapper.jar` is a binary that executes at build
+# time, which makes it the one file here a reviewer cannot read. Every job below that runs
+# `./gradlew` validates it against Gradle's published checksums first -- not just the first job,
+# because each job checks out the tree again and runs the jar again, so validating one of them
+# leaves the others executing an unverified binary. The jar in the tree today is the genuine
+# 8.10.2 wrapper (sha256 2db75c40...8046, verified locally against Gradle's published value).
+# The distribution the wrapper then downloads is pinned by `distributionSha256Sum` in
+# `gradle-wrapper.properties`.
permissions:
contents: read
@@ -45,6 +54,12 @@ jobs:
# published checksums before anything runs it. The jar in the tree today is the genuine
# 8.10.2 wrapper (sha256 2db75c40...8046, matching services.gradle.org and the
# gradle/gradle v8.10.2 tag); this keeps a later swap from going unnoticed.
+ #
+ # In EVERY job that runs ./gradlew, not just this one: each job checks the
+ # tree out again and runs the jar again, so validating one leaves the others
+ # executing an unverified binary. release-java.yml's `central` job is the
+ # reason it matters -- it runs the wrapper holding the signing key and the
+ # Maven Central credentials, and Central is append-only.
- uses: gradle/actions/wrapper-validation@0b6dd653ba04f4f93bf581ec31e66cbd7dcb644d # v4
- uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
@@ -179,6 +194,9 @@ jobs:
jdk: ["17", "21", "24"]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
+ # Validate the wrapper jar BEFORE anything can execute it. See this file's
+ # header for why every job that runs ./gradlew needs this, not just one.
+ - uses: gradle/actions/wrapper-validation@0b6dd653ba04f4f93bf581ec31e66cbd7dcb644d # v4
# For check_test_results.py only -- it is standard library, so there is nothing to install.
# Pinned rather than relying on whatever `python` the runner image happens to expose.
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
@@ -303,6 +321,9 @@ jobs:
timeout: 75
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
+ # Validate the wrapper jar BEFORE anything can execute it. See this file's
+ # header for why every job that runs ./gradlew needs this, not just one.
+ - uses: gradle/actions/wrapper-validation@0b6dd653ba04f4f93bf581ec31e66cbd7dcb644d # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"
diff --git a/.github/workflows/release-java.yml b/.github/workflows/release-java.yml
index 6f1895f2..91d62344 100644
--- a/.github/workflows/release-java.yml
+++ b/.github/workflows/release-java.yml
@@ -20,6 +20,15 @@ on:
push:
tags: ["laya-java-v*"]
workflow_dispatch:
+#
+# SUPPLY CHAIN: `laya-java/gradle/wrapper/gradle-wrapper.jar` is a binary that executes at build
+# time, which makes it the one file here a reviewer cannot read. Every job below that runs
+# `./gradlew` validates it against Gradle's published checksums first -- not just the first job,
+# because each job checks out the tree again and runs the jar again, so validating one of them
+# leaves the others executing an unverified binary. The jar in the tree today is the genuine
+# 8.10.2 wrapper (sha256 2db75c40...8046, verified locally against Gradle's published value).
+# The distribution the wrapper then downloads is pinned by `distributionSha256Sum` in
+# `gradle-wrapper.properties`.
permissions:
contents: read
@@ -34,6 +43,9 @@ jobs:
working-directory: laya-java
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
+ # Validate the wrapper jar BEFORE anything can execute it. See this file's
+ # header for why every job that runs ./gradlew needs this, not just one.
+ - uses: gradle/actions/wrapper-validation@0b6dd653ba04f4f93bf581ec31e66cbd7dcb644d # v4
- uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
distribution: temurin
@@ -92,6 +104,9 @@ jobs:
working-directory: laya-java
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
+ # Validate the wrapper jar BEFORE anything can execute it. See this file's
+ # header for why every job that runs ./gradlew needs this, not just one.
+ - uses: gradle/actions/wrapper-validation@0b6dd653ba04f4f93bf581ec31e66cbd7dcb644d # v4
- uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
distribution: temurin
diff --git a/laya-java/gradle/wrapper/gradle-wrapper.properties b/laya-java/gradle/wrapper/gradle-wrapper.properties
index 22f460ba..443ef6eb 100644
--- a/laya-java/gradle/wrapper/gradle-wrapper.properties
+++ b/laya-java/gradle/wrapper/gradle-wrapper.properties
@@ -3,7 +3,9 @@ distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
# Pins the distribution the wrapper downloads. Without it the wrapper trusts whatever
-# services.gradle.org returns; the wrapper jar itself is validated in CI (java.yml).
+# services.gradle.org returns over the wire. This is the value Gradle publishes at
+# distributions/gradle-8.10.2-bin.zip.sha256. The wrapper JAR itself is a separate problem,
+# validated in CI by every job that runs ./gradlew.
distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME