Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
mobile: harden bundle signing checks and Play API error handling
Antonio Ojea550cb6365c88
diff --git a/Makefile b/Makefileindex 41cd61d6..60f935ba 100644--- a/Makefile+++ b/Makefile@@ -110,7 +110,8 @@ mobile-app-apk-emulator: mobile-ffi-android-x86_64 mobile-app-google-services# ANDROID_KEY_PASSWORD environment variables (see mobile/sam-node-app/README.md)..PHONY: mobile-app-bundlemobile-app-bundle: mobile-app-jnilibs-arm64 mobile-app-google-services- @if [ ! -f $(MOBILE_APP_DIR)/android/key.properties ] && [ -z "$$ANDROID_KEYSTORE_PATH" ]; then \+ @if [ ! -f $(MOBILE_APP_DIR)/android/key.properties ] && \+ { [ -z "$$ANDROID_KEYSTORE_PATH" ] || [ -z "$$ANDROID_KEYSTORE_PASSWORD" ] || [ -z "$$ANDROID_KEY_ALIAS" ] || [ -z "$$ANDROID_KEY_PASSWORD" ]; }; then \echo "Error: no upload key configured; Google Play rejects debug-signed bundles." >&2; \echo "Create $(MOBILE_APP_DIR)/android/key.properties or export ANDROID_KEYSTORE_PATH, ANDROID_KEYSTORE_PASSWORD, ANDROID_KEY_ALIAS and ANDROID_KEY_PASSWORD. See $(MOBILE_APP_DIR)/README.md#publishing-to-google-play." >&2; \exit 1; \diff --git a/hack/publish-play.sh b/hack/publish-play.shindex 248a0a00..de38bdb7 100755--- a/hack/publish-play.sh+++ b/hack/publish-play.sh@@ -55,11 +55,18 @@ play() {curl --silent --show-error --fail-with-body --header "@${auth_header}" "$@"}+# A 2xx with the field missing would otherwise send us on to edits/null.+require() {+ [[ -n "$2" && "$2" != "null" ]] || { echo "$1" >&2; exit 1; }+}+edit_id=$(play -X POST "${api}/edits" -H 'Content-Type: application/json' -d '{}' | jq -r .id)+require "failed to open an edit: no id in the response" "${edit_id}"echo "opened edit ${edit_id}"version_code=$(play -X POST "${upload}/edits/${edit_id}/bundles?uploadType=media" \-H 'Content-Type: application/octet-stream' --data-binary "@${bundle}" | jq -r .versionCode)+require "bundle upload returned no versionCode" "${version_code}"echo "uploaded ${bundle} as versionCode ${version_code}"release=$(jq -nc --arg track "${track}" --arg vc "${version_code}" \diff --git a/mobile/sam-node-app/android/app/build.gradle.kts b/mobile/sam-node-app/android/app/build.gradle.ktsindex 029ff835..ca0eac58 100644--- a/mobile/sam-node-app/android/app/build.gradle.kts+++ b/mobile/sam-node-app/android/app/build.gradle.kts@@ -48,8 +48,9 @@ android {buildTypes {release {if (hasReleaseSigning) {- signingConfig = signingConfigs.create("release") {- storeFile = file(releaseStoreFile!!)+ signingConfig = signingConfigs.maybeCreate("release").apply {+ // Relative storeFile paths resolve against android/, where key.properties lives.+ storeFile = rootProject.file(releaseStoreFile!!)storePassword = releaseStorePasswordkeyAlias = releaseKeyAliaskeyPassword = releaseKeyPassword