Skip to content

Harden Android SDK installation, caching, and release workflows - #956

Open
amyu wants to merge 7 commits into
mainfrom
codex/scope-cache-to-android-sdk
Open

amyu wants to merge 7 commits into
mainfrom
codex/scope-cache-to-android-sdk

Conversation

@amyu

@amyu amyu commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Cache only ~/.android/sdk. Generate fixed-length v8 keys from the platform, architecture, SDK path, bootstrap archive digest, and either structured component versions or the caller's custom key. Only the latest successful install in a job can save the SDK, using the key captured during setup. Upgrading performs a fresh installation. Old caches that may contain keys can be deleted in the consuming repository.
  • Run the extracted SDK Manager from its own directory. Windows sends license responses over stdin. Validate NDK package revisions before cache access and export the NDK directory only after a successful install or restore and a filesystem containment check.
  • Verify the downloaded command-line tools ZIP with SHA-256 before replacing an existing SDK or extracting the archive. The manifest covers 77 archives in Google's SDK catalog. A revision outside the manifest requires a trusted command-line-tools-sha256 for the runner platform. The Renovate update task adds the default revision's four published digests and rebuilds both bundles.
  • Upgrade the affected runtime dependencies, including a scoped minimatch override and a compatibility patch so @actions/glob selects SDK directories using the supported partial-match API. Package with Node's built-in filesystem API and verify the sample Gradle distribution against its official digest.
  • Validate release input as data, tag the dispatched main commit, and publish without moving existing tags. A retry can finish publishing a tag pointing at the same commit. Read and update release documentation through the GitHub API using the dispatched commit as the base. The release workflow needs no checkout or persisted Git credentials.
  • Set read-only token permissions for lint and tests and disable persisted checkout credentials in validation jobs. Pin the Renovate container by digest and request explicit installation-token permissions for this repository, including read access to Dependabot alerts.

Verification

  • Ran a frozen install, lint, formatting, type checks, regression tests and the distribution build. Both full and production pnpm audits report zero advisories. Verified the fixed dependency versions in both shipped bundles.
  • Checked the four default digests against Google's download page. For historical entries, matched the F-Droid transparency log to Google's published SHA-1 where available, or streamed Google's archive and checked its published checksum and size before recording SHA-256. Verified mismatched content fails before extraction or SDK removal.
  • Tested the setup and post entry points with a continued installation failure, failed NDK validation, two installations in one job, a later cache hit or cache-disabled install, and a failed job. Covered component boundary collisions, long custom keys, and the real cache library's archive path selection. Confirmed that GitHub Actions uploaded the SDK directory and that fresh Ubuntu runners restored both generated and custom keys. The SDK 35 sample build passed after restoration. Exercised the Windows SDK Manager invocation, NDK directory checks, unknown archive pins, and SDK checksum updates with missing or conflicting metadata.
  • Verified five release cases with a mocked GitHub API, including retries, invalid versions and occupied tags. Also exercised the release documentation update and its no-change path. Validated the workflows with actionlint and the GitHub Actions lockfile verifier. Ran Renovate 44.257.9 configuration validation and local dependency extraction for the image digest, SDK revision and scoped dependency override.

GitHub release immutability and the main branch ruleset were enabled separately. The ruleset requires a PR, the lint and dist checks, and zero approving reviews. The scheduled Renovate job uses the workflow on main; its live token and the next real release will exercise those paths after merge.

@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T15:19:38.134237Z acc1f7e PR opened
ℹ️ 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.

@amyu amyu changed the title Limit the Android cache to the SDK directory Restrict Android SDK caching and SDK Manager command lookup Nov 22, 2026
@amyu amyu changed the title Restrict Android SDK caching and SDK Manager command lookup Harden Android SDK installation, caching, and release workflows Nov 22, 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