Repository navigation
fix(ci): prevent manual candidates from writing shared caches - #127149
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
4852174 to
63c4cf5
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 6:41 AM ET / 10:41 UTC. ClawSweeper reviewWhat this changesCentralizes CI candidate trust in preflight and uses it to prevent manually selected revisions from restoring or writing shared caches unless their identity is trusted. Merge readinessKeep open for protected maintainer review: the preflight-owned policy is coherent and guard-covered, but the new Gradle action’s read-only cache contract could not be directly inspected. Likely related people: Vincent Koc (current CI change) and Peter Steinberger (Android toolchain history). Priority: P2 Review scores
Verification
How this fits togetherCI preflight resolves a requested revision and determines its trust before build and test jobs run. That decision controls downstream access to shared dependency, platform, and build caches. flowchart LR
A[CI trigger] --> B[Preflight revision validation]
B --> C[Candidate trust decision]
C --> D[Cache access mode]
D --> E[Build and test jobs]
E --> F[Shared caches]
Decision needed
Why: The PR’s Android isolation depends on a newly introduced third-party action contract that was unavailable for direct inspection. Before merge
Findings
Agent review detailsSecurityNeeds attention: The new Gradle cache integration needs exact-source or behavioral verification of its no-write mode before the security boundary can be cleared. PR surfaceTests +338, Config +195. Total +533 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one preflight-owned cache-authority flow, verify the pinned Gradle action prevents publication in non-writer modes, then merge after exact-head CI is green. Do we have a high-confidence way to reproduce the issue? Yes at the source boundary: the guard suite executes the target-context and candidate-trust shell paths with controlled inputs. A hosted cache-service trace was not available in this read-only review. Is this the best way to solve the issue? Unclear: making preflight the sole authority is the cleanest owner boundary found, but the Gradle action contract must be verified before this exact implementation is accepted. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8f8895c14134. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Fixes a CI security issue where an arbitrary
workflow_dispatch.target_refcould run candidate-controlled steps before shared cache writers completed, allowing an untrusted manual target to influence caches used by later trusted runs.CodeQL scope:
Why This Change Was Made
CI preflight now owns one canonical candidate trust decision and exports
candidate_trust,cache_mode, andcache_write_allowed. Trust defaults tountrustedwith caches off; pull requests restore only; exact main and validated release identities may write. Release context authorization additionally proves the target SHA is the named release branch head or an ancestor of it.Workflow-owned local actions are loaded from an exact
github.workflow_shaharness, separately from candidate code. Every direct cache surface now consumes the canonical mode or write authorization, including dependency warmup, build/dist, Playwright, extension artifacts, Vitest/Node, Go, Swift, Android SDK, Gradle, Windows, and macOS. Implicit read-write Go/Java caches were replaced with restore/save-aware flows; Gradle uses the maintainedgradle/actions/setup-gradlebasic provider in native read-only mode for non-writers.The architectural owner is CI preflight. Candidate identity is established once there; cache consumers no longer re-derive trust from event shape.
User Impact
No product-facing behavior changes. Maintainers retain pull-request restores and exact main/release cache publication, while arbitrary manual targets can still run tests without reading or writing shared caches.
Evidence
Exact head:
63c4cf5d4ca2d46c6e208777baec3137118600benode scripts/run-vitest.mjs test/scripts/ci-workflow-guards.test.ts: 124 passed, 2 skippednode scripts/run-vitest.mjs test/scripts/pr-ci-dispatch.test.ts test/scripts/pr-prepare-gates.test.ts test/scripts/full-release-validation-at-sha.test.ts: 67 passedactionlint -shellcheck '' -pyflakes '' .github/workflows/ci.yml .github/workflows/android-release.yml: passedpre-commit run zizmor --files .github/workflows/ci.yml .github/workflows/android-release.yml: passedgit diff --check: passednode_modulescontains[email protected]while this checkout requires[email protected]; no dependency install was run inside the Codex worktree. Hosted CI remains authoritative for that lane.Privacy scrub: no personal paths, private hosts/IPs, phone numbers, or non-public email addresses in the diff.
LOC proof:
+279/-85+381/-42Positive production growth is justified by the cache-write security invariant and its explicit owner/lifecycle boundaries. No changelog entry: this is internal CI hardening with no shipped user-facing surface.