Repository navigation
Conversation
lazzurs
temporarily deployed
to
Android Build
November 23, 2026 02:25 — with
GitHub Actions
Inactive
lazzurs
temporarily deployed
to
Android Build
November 23, 2026 02:25 — with
GitHub Actions
Inactive
This was referenced Nov 23, 2026
Owner
|
#314 is merged, so rebase this onto it and pin the In the same rebase, change
|
1 of 30 tasks
The release keystore was written to disk at the start of the one release job, which then ran pip installs, the bridge tests, Gradle and its plugins and every action in the file, with the passwords exported to three Gradle runs. Any of that code, compromised, could read the key. build-release.yml now has three jobs. `build` runs the same checks and builds the release APK unsigned; it never references the signing secrets. `sign` checks nothing out: it downloads that APK, writes the keystore to the runner's temp directory for one step, signs with the runner image's apksigner (v2 only, as AGP did), and checks the signature, the 16 KB alignment and that the signer is the certificate 1.2.0 was signed with. `publish` attaches the APK and Unicorn's source with `gh` and the run's own token, so the release PAT and softprops/action-gh-release are no longer used. app/build.gradle.kts leaves a release unsigned when no keystore is present, which is what lets `build` run assembleRelease without one. Artifact names, the release title and the assets are unchanged. Since `build` and `sign` both use the Android Build Release environment, a release now asks for approval twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
build-tools 35 and 36 print "Signer #1 certificate SHA-256 digest:", 37 prints "V2 Signer: certificate SHA-256 digest:". The check matched only the first, so on the runner's 37 it refused a correctly signed APK. It now collects every certificate digest the report names and requires exactly one, equal to the release certificate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lazzurs
force-pushed
the
fix/s02-split-release-signing
branch
from
November 23, 2026 13:45
e144dbd to
d818ef9
Compare
lazzurs
temporarily deployed
to
Android Build
November 23, 2026 13:45 — with
GitHub Actions
Inactive
lazzurs
temporarily deployed
to
Android Build
November 23, 2026 13:45 — with
GitHub Actions
Inactive
This was referenced Nov 23, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes audit finding S-02: the release keystore was written to disk at the start of the one release job, which then ran
pip install, the bridge tests, Gradle and its plugins, and every action in the file, with the keystore passwords exported to three Gradle runs (one of themassembleDebug). Any of that code, compromised, could read the key. The app is sideloaded with no Play App Signing behind it, so a stolen key signs updates that install over every existing install.What changes
build-release.ymlis split into three jobs:permissionsbuildcontents: readMAPS_API_KEYonlysign{}SIGNING_KEY,KEY_STORE_PASSWORD,KEY_PASSWORDpublishcontents: writeGITHUB_TOKENbuildruns the same checks as before (translation check,./gradlew test, the bridge tests,build -x lint,assembleDebug) and thenassembleRelease, which now producesapp-release-unsigned.apk. It uploads that as an internal artifact (unsigned-release-apk, kept 1 day). It never references a signing secret.signchecks nothing out and runs nothing from the repository or from a package registry. It downloads the unsigned APK, finds the newest build-tools on the runner image, checks the APK is zip-aligned (16 KB pages,zipalign -c -P 16 4), writes the keystore to$RUNNER_TEMPwithumask 077for one step and deletes it on exit, and signs withapksigner, with the passwords passed asenv:references, never on the command line. Then it verifies: v2 signature present, exactly one signer, signer certificate SHA-256 equalse85e6f91…ecf92(the certificate 1.2.0 and earlier were signed with), and alignment still intact. It writes the APK's SHA-256 to the job summary and uploads the signed APK under the same artifact name as before (<date> - OpenTagViewer - OpenTagViewer - APK(s) release generated).publishchecks out (no persisted credentials), downloads the signed APK, fetches and hash-checks Unicorn's source tarball exactly as before, and runsgh release upload --clobberandgh release edit --title "OpenTagViewer Android App <version>". Same two assets and the same title as before.app/build.gradle.kts: the release build type uses the release signing config only when its keystore file exists, soassembleReleasewith no keystore produces an unsigned APK instead of failing. A maintainer building locally with the keystore still gets a signed APK as before.Signing settings are kept as AGP used them: v2 only (the published 1.2.0 APK verifies as v1 false, v2 true, v3 false), same alias (
upload), same key. So an APK from this workflow installs over 1.2.0 the same way.Also in this PR:
softprops/action-gh-releaseand theANDROID_BUILD_RELEASE_GITHUB_TOKENPAT are no longer used by this workflow (the audit's S-03 fix suggests this replacement). The exporter workflow still uses both; that is untouched here.${{ secrets.SIGNING_KEY }}interpolated into a script, and the new steps take the tag, version and passwords fromenv:. The other interpolations S-08 lists (--tag "${{ github.ref }}", theMAPS_API_KEYecho) are on lines this PR doesn't touch, so they are left for a separate change.CONTRIBUTING.md: the CI table row and "Releasing the Android app" describe the split, the certificate check and the double approval.What the maintainer needs to do
Android Build Releaseunder the same names.buildandsignboth useAndroid Build Release, which has you as a required reviewer: once when the run starts (build), once ~20 minutes later (sign). If that's annoying, moveMAPS_API_KEYto a new environment with no reviewers (or toAndroid Build, if that environment'sMAPS_API_KEYis the same release key; I can't see secret values, so I couldn't check) and pointbuildat it. Then only signing asks. That also stops relying on GitHub's behaviour of passing a job only the secrets that job references, which is what currently keeps the signing secrets off thebuildrunner.ANDROID_BUILD_RELEASE_GITHUB_TOKENcan be deleted from the environment. Nothing references it any more.EXPECTED_SIGNER_SHA256in the workflow, orsignwill refuse to publish.Other workflows checked
macos-exporter-python.ymldoesn't sign anything: no keystore or code-signing secret, onlyMACOS_EXPORTER_APP_GITHUB_TOKENfor the release upload.build-debug.ymlusesDEBUG_KEYSTORE_BASE64, which is the deliberately public-grade debug key (see CONTRIBUTING), so it's out of scope. No other workflow touches signing secrets.Verified
actionlinton the new workflow: no new findings (only the existing SC2086 notes on untouched lines, plus SC2012 info on thels build-toolsline).A dry run on my fork, generated mechanically from this exact workflow with the release-only bits swapped out: push trigger instead of
release, no environments, the fork's missingMAPS_API_KEYreplaced by the debug default, a throwaway keystore generated withkeytool, and thegh releasecalls replaced by a listing. Final run: https://github.com/lazzurs/OpenTagViewer/actions/runs/45187049391 (all three jobs green; re-run after rebasing onto Pin every action to a commit SHA, and let Dependabot move them #314, with the pinned SHAs). In that run:buildpassed the full test suite and producedapp-release-unsigned.apkapksigner verifyfails on the unsigned APK (sobuildsigned nothing)signsigned it withpermissions: {}, and verification passed against the throwaway key's certificate$RUNNER_TEMPafterwardspublishdownloaded the signed APK and fetched and hash-checked the Unicorn tarball.The dry run caught a bug in the first version of this PR. build-tools 35 and 36 print
Signer #1 certificate SHA-256 digest:, but 37 (whatubuntu-latesthas now) printsV2 Signer: certificate SHA-256 digest:, so the original check refused a correctly signed APK. It now collects every certificate digest the report names and requires exactly one, equal to the pin. That's the second commit.Locally, the exact verify script extracted from the workflow, run against the published
OpenTagViewer-1.2.0.apkwith build-tools 35, 36 and 37: it passes with the real pin and fails with any other on all three. This also confirmed 1.2.0 is v2-only and is signed bye85e6f91…ecf92.Because this touches
app/build.gradle.kts, the PR's own checks ran on the rebased head: Instrumented tests (emulator), build, Static checks and check all pass. The earlier fork runs on the pre-rebase head are Generate APK (Debug) (884 instrumented tests, 0 failed) and Static checks. The first attempt there hit the 00:00–02:00 UTC flake inDebugModeReachesEveryScreenTest(AMapWithTagsOnItseeds a report at "now − 2 h", which is yesterday at that hour); a rerun after 02:00 passed.Not verified
gh release upload/gh release editagainst a real release. I can't create releases. The first real release through this workflow is the test, so it's worth watching that run.contents: writeonGITHUB_TOKENis enough forgh release editon this repository. It should be (the old comment in this file says the action falls back to that same grant), but it hasn't been exercised here.Relationship to the other two PRs
This is one of three PRs from the same audit (S-02, S-03, S-04), tracked in #318. S-03 (#314) has since merged, and this branch is rebased onto it. Every
uses:inbuild-release.ymlfollows #314's convention, using the same SHAs #314 pinned elsewhere:actions/checkout@3d3c42e… # v7.0.1,actions/setup-java@d1374f8… # v6.3.0,actions/setup-python@6d4fd22… # v7.1.0,actions/upload-artifact@cf430e0… # v7.0.2, and the newly usedactions/download-artifact@9000827… # v8.0.2. Thesoftprops/action-gh-releaseline #314 had pinned in this file is gone, because this PR replaces it withgh release.🤖 Generated with Claude Code