android: certificate failures found behind OkHttp 5's fast fallback; release-key check reads apksigner 37 (#8533)
release / go (push) Successful in 1m46s
release / web (push) Successful in 1m11s
release / integration (push) Successful in 2m33s
release / govulncheck (push) Successful in 18s
release / android (push) Successful in 4m52s
release / Build signed APK (push) Successful in 5m4s
release / Build + push container image (push) Successful in 17s
release / go (push) Successful in 1m46s
release / web (push) Successful in 1m11s
release / integration (push) Successful in 2m33s
release / govulncheck (push) Successful in 18s
release / android (push) Successful in 4m52s
release / Build signed APK (push) Successful in 5m4s
release / Build + push container image (push) Successful in 17s
Run 11511 failed in two places.
ServerProbe: OkHttp 5 tries a host's addresses in parallel. When all of
them fail it throws one failure and attaches the others as suppressed
exceptions. For localhost, the refused ::1 connection was thrown, and the
certificate error from 127.0.0.1 was only attached, so the probe said
"Couldn't reach" instead of naming the certificate. A real server with
both IPv4 and IPv6 addresses would hit the same. isCertificateFailure now
searches suppressed exceptions as well as causes, up to 16 in all.
Release-key check: apksigner from build-tools 37 labels signers by
signature scheme ("V3.0 Signer: certificate SHA-256 digest: ...") instead
of "Signer #1 certificate ...". The step's grep matched nothing, and
pipefail ended it with no message. The step now collects every
certificate SHA-256 digest whatever the label, and still requires exactly
one distinct digest, equal to the release key's. I checked the parsing on
both label formats, on two keys and on no output: it passes our key in
either format and fails the other two cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -560,10 +560,14 @@ jobs:
|
||||
signer="$(ls "$sdk"/build-tools/*/apksigner 2>/dev/null | sort -V | tail -1 || true)"
|
||||
test -n "$signer" || { echo "::error::no apksigner under '$sdk/build-tools'"; exit 1; }
|
||||
certs="$("$signer" verify --print-certs app/build/outputs/apk/release/app-release.apk)"
|
||||
printf '%s\n' "$certs" | grep -E '^Signer #[0-9]+ certificate (DN|SHA-256 digest)'
|
||||
# One signer, and it is ours. A second signer would be a lineage or
|
||||
# apksigner's signer label varies between versions: "Signer #1
|
||||
# certificate ..." before build-tools 37, "V3.0 Signer: certificate
|
||||
# ..." from 37 on. So the digests are read without relying on it.
|
||||
printf '%s\n' "$certs" | grep -E 'certificate (DN|SHA-256 digest):' || true
|
||||
# One signer, and it is ours: exactly one distinct SHA-256 across
|
||||
# every scheme apksigner reports. A second key would be a lineage or
|
||||
# a mistake; either way not something to ship unexamined.
|
||||
digests="$(printf '%s\n' "$certs" | sed -n 's/^Signer #[0-9]* certificate SHA-256 digest: //p')"
|
||||
digests="$(printf '%s\n' "$certs" | sed -n 's/^.*certificate SHA-256 digest: //p' | sort -u)"
|
||||
if [ "$digests" != "$RELEASE_CERT_SHA256" ]; then
|
||||
if printf '%s' "$certs" | grep -q 'CN=Android Debug'; then
|
||||
echo "::error::the release APK is signed with a debug key"
|
||||
|
||||
Reference in New Issue
Block a user