Avoid common App Store and Google Play rejections. Open playbook and pre-submission guard with 117 documented rejection patterns and fixes, privacy manifest and Data safety checks, 95 tracked deadlines (EU AI Act, DSA, COPPA, age laws), and a skill for AI coding agents.
Shell accessibilityai-agentsandroidapp-review-guidelinesapp-storeapp-store-connectapp-store-rejectionapp-store-reviewclaude-codecoppadata-safetyeu-ai-actgdprgoogle-playgoogle-play-policyiosmobile-complianceplay-consolepre-submission-checklistprivacy-manifest
fix(guard): stop false criticals from venvs, dist and test dirs, fix the pipefail SIGPIPE, land the review findings (supersedes #584) (#608)
Mirza Iqbalf65baa4568f3
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 12ea7b2..08b3520 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -11,6 +11,17 @@ All notable changes to this playbook are recorded here. The format follows Keep### Fixed+- The guard scanned Python virtualenvs, bundled web output under dist/, and lowercase test folders (test/, tests/, integration_test/) as app source. A virtualenv's vendored API JSON alone raised five false criticals on one Flutter project. Directories are now pruned by name below the project root only, which also fixes a project sitting under a folder named build being scanned as empty (#542).+- Every `find | grep -q .` pipeline exited 141 under `set -o pipefail` once grep stopped reading and find died of SIGPIPE, so a project with more than one PrivacyInfo.xcprivacy (any CocoaPods or SPM project) was reported as missing its privacy manifest, and platform detection could miss a platform. The pipelines now drain their input, as release_string_has already did.+- ANDROID-USER-DATA-DISCLOSURE matched lowercase English words case-sensitively, so it fired on "files" in any documented repo and stayed silent on READ_CONTACTS. It now matches the permission constants and API symbols (#542).+- APPLE-3.1.1-EXTERNAL-PAYMENT and GOOGLE-PLAY-BILLING only recognised native StoreKit and BillingClient symbols, which never appear in a Flutter, React Native, Expo, Capacitor, or Cordova app's source. The store purchase plugins for those frameworks now count.+- APPLE-PRIVACY-NUTRITION-LABELS looked for NSPrivacyCollectedDataTypes but never read .xcprivacy files, where that key lives. They are now scanned.+- BOTH-SUBSCRIPTION-HARD-CANCEL matched "call" inside "automatically", so "renews automatically until cancelled" read as an instruction to call. "call" and "write" now match as whole words.+- ANDROID-USER-DATA-DISCLOSURE now keys off permissions declared in AndroidManifest.xml (contacts, SMS, call log, accounts, all files), the surface Play enforces prominent disclosure on. Bare API symbols matched imports, comments and vendored SDKs. READ_MEDIA_IMAGES and READ_MEDIA_VIDEO moved to their own high finding, GOOGLE-PHOTO-VIDEO-PERMISSIONS-DECLARATION, which stays silent when the Android photo picker is in use.+- GOOGLE-TARGET-API read build.gradle through a bare ** glob, which without globstar only sees one directory level, so android/app/build.gradle was never inspected on a real project. It now reads every build.gradle in the source list, holds the API 36 floor Play enforces since 31 August 2026, and blocks like the rejection it predicts.+- New GOOGLE-PLAY-BILLING-V8-REQUIRED. a com.android.billingclient:billing dependency below major version 8 blocks, since new apps and updates need Billing Library 8 from 31 August 2026.+- Privacy manifest validator. findings Apple TN3181 lists as an invalid manifest (empty reason arrays, a missing or empty NSPrivacyAccessedAPIType, an empty NSPrivacyAccessedAPITypes array, wrong value types, incomplete collected data types) are critical, so they block like the upload rejection they predict. A plist with an unexpected shape is a finding instead of a crash into a silent pass, and a missing python3 surfaces as a medium finding instead of nothing.+- dist/ is pruned as build output but src/dist is kept, since that is an Android product-flavor source set. A copied .pub-cache is pruned as vendor code.- The README install prompt and the one-time check prompt never asked the agent to walk the account and program readiness checklist or the 90-day regulatory deadline window, both of which a code scan cannot see. Both prompts now do.- docs/PLATFORM-MECHANICS-2026.md cited the wrong announcement id for the June 2026 Guideline 4.3 tightening and still said API 35. Now a233fmpw and API 36 with the 1 November 2026 extension.- docs/EU-REGULATORY-2026.md section 2.3 said the EU unified fee model was not implemented. It applies from 1 October 2026 (Core Technology Commission, Attachment 14).diff --git a/agent-os/hooks/app-store-compliance-guard-test.sh b/agent-os/hooks/app-store-compliance-guard-test.shindex 9781cef..a362561 100755--- a/agent-os/hooks/app-store-compliance-guard-test.sh+++ b/agent-os/hooks/app-store-compliance-guard-test.sh@@ -64,7 +64,7 @@ mk_ios_bad_nutrition() {mk_android_bad_privacy() {local d; d="$(mktemp -d)"; mkdir -p "$d/app/src/main"- printf '<manifest xmlns:android="http://schemas.android.com/apk/res/android"><uses-permission android:name="com.google.android.gms.permission.AD_ID"/><uses-permission android:name="android.permission.READ_STEPS"/></manifest>' > "$d/app/src/main/AndroidManifest.xml"+ printf '<manifest xmlns:android="http://schemas.android.com/apk/res/android"><uses-permission android:name="com.google.android.gms.permission.AD_ID"/><uses-permission android:name="android.permission.READ_STEPS"/><uses-permission android:name="android.permission.READ_CONTACTS"/></manifest>' > "$d/app/src/main/AndroidManifest.xml"printf 'android { defaultConfig { targetSdkVersion 34 } }\n' > "$d/app/build.gradle"printf 'class MyActivity { void test() { requestPermissions(new String[]{"camera"}, 1); HealthConnectClient client = null; contacts = "john"; } }\n' > "$d/app/src/main/MyActivity.java"echo "$d"@@ -526,6 +526,161 @@ printf '%s' "$PLIST_EMPTY" > "$D/App/PrivacyInfo.xcprivacy"printf '{}' > "$D/AppTests/Fixtures/PrivacyInfo.xcprivacy"OUT="$(bash "$GUARD" "$D" 2>&1)"echo "$OUT" | grep -q 'APPLE-MANIFEST-UNREADABLE' && bad "Manifest fixture under Tests is skipped" || ok "Manifest fixture under Tests is skipped"++# 47 A Python virtualenv inside the project is not app source. Its vendored JSON mentions betting,+# background location, and localhost, none of which the app ships.+D="$(mktemp -d)"; mkdir -p "$D/App" "$D/app/src/main" "$D/tool/.venv/lib/python3.12/site-packages/api"+printf '<plist/>' > "$D/App/Info.plist"+printf '<manifest package="t"/>' > "$D/app/src/main/AndroidManifest.xml"+printf '{"a": "fixed-odds betting", "b": "ACCESS_BACKGROUND_LOCATION", "c": "http://localhost:8080"}\n' > "$D/tool/.venv/lib/python3.12/site-packages/api/discovery.json"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -Eq '^ \[(CRITICAL|HIGH|MEDIUM)\] +(APPLE-GAMBLING-BRAZIL-LICENSE|APPLE-2\.1-STAGING-BACKEND|GOOGLE-PERM-BACKGROUND-LOCATION) ' && bad "Virtualenv contents are not scanned as app source" || ok "Virtualenv contents are not scanned as app source"+rm -rf "$D"++# 48 Many privacy manifests, as every CocoaPods or SPM project has. `find | grep -q .` exited 141+# under pipefail once grep stopped reading, and reported the app's own manifest missing.+D="$(mktemp -d)"; mkdir -p "$D/ios/Runner" "$D/lib"+printf 'name: t\ndependencies:\n permission_handler: ^11.0.0\n' > "$D/pubspec.yaml"+printf "import 'package:permission_handler/permission_handler.dart';\n" > "$D/lib/main.dart"+printf '<plist><dict></dict></plist>' > "$D/ios/Runner/Info.plist"+printf '{}' > "$D/ios/Runner/PrivacyInfo.xcprivacy"+for i in $(seq 1 1500); do mkdir -p "$D/ios/Pods/SomeVendoredPod$i/Resources"; printf '{}' > "$D/ios/Pods/SomeVendoredPod$i/Resources/PrivacyInfo.xcprivacy"; done+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -Eq '^ \[(CRITICAL|HIGH|MEDIUM)\] +(FLUTTER|APPLE)-PRIVACY-MANIFEST-MISSING ' && bad "Existing privacy manifest is found among many (no SIGPIPE under pipefail)" || ok "Existing privacy manifest is found among many (no SIGPIPE under pipefail)"+rm -rf "$D"++# 49 A project that itself sits under folders named build and test is still scanned. Exclusions+# apply only below the project root.+P="$(mktemp -d)"; D="$P/build/test/app"; mkdir -p "$D"+S="$(mk_ios_bad)"; cp -R "$S/." "$D/"; rm -rf "$S"+OUT="$(bash "$GUARD" "$D" 2>&1)"; RC=$?+echo "$OUT" | grep -q 'APPLE-3.1.1-EXTERNAL-PAYMENT' && [ "$RC" -eq 2 ] && ok "Project under build/ and test/ parent folders is still scanned" || bad "Project under build/ and test/ parent folders is still scanned (rc=$RC)"+rm -rf "$P"++# 50 NSPrivacyCollectedDataTypes lives in PrivacyInfo.xcprivacy, so declaring it there satisfies the check.+D="$(mk_ios_bad_nutrition)"+printf '<plist><dict><key>NSPrivacyCollectedDataTypes</key><array/></dict></plist>' > "$D/App/PrivacyInfo.xcprivacy"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -Eq '^ \[(CRITICAL|HIGH|MEDIUM)\] +APPLE-PRIVACY-NUTRITION-LABELS ' && bad "Privacy manifest declaring collected data types satisfies nutrition labels" || ok "Privacy manifest declaring collected data types satisfies nutrition labels"+rm -rf "$D"++# 51 Lowercase test folders (Flutter test/ and integration_test/, JS tests/) never ship either.+D="$(mktemp -d)"; mkdir -p "$D/App" "$D/test"+printf '<plist/>' > "$D/App/Info.plist"+printf 'func deleteAccount() { api.delete("/users/me") }\n' > "$D/App/A.swift"+printf '// the outgoing page must finish sliding after it is deactivated\n' > "$D/test/T.swift"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -Eq '^ \[(CRITICAL|HIGH|MEDIUM)\] +APPLE-ACCOUNT-DELETION-WEAK ' && bad "Words in a lowercase test/ folder are not app source" || ok "Words in a lowercase test/ folder are not app source"+rm -rf "$D"++# 52 A cross-platform app selling digital goods through a store plugin, and physical goods through a+# payment SDK, is not an external-payment violation. Without the plugin it still is.+mk_flutter_pay() {+ local d; d="$(mktemp -d)"; mkdir -p "$d/ios/Runner" "$d/android/app/src/main" "$d/lib"+ printf 'name: t\ndependencies:\n razorpay_flutter: ^1.3.0\n%b' "$1" > "$d/pubspec.yaml"+ printf '<plist><dict></dict></plist>' > "$d/ios/Runner/Info.plist"+ printf '{}' > "$d/ios/Runner/PrivacyInfo.xcprivacy"+ printf '<manifest package="t"/>' > "$d/android/app/src/main/AndroidManifest.xml"+ echo "$d"+}+D="$(mk_flutter_pay ' in_app_purchase: ^3.2.0\n')"; OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -Eq '^ \[(CRITICAL|HIGH|MEDIUM)\] +(GOOGLE-PLAY-BILLING|APPLE-3\.1\.1-EXTERNAL-PAYMENT) ' && bad "Store purchase plugin satisfies both IAP checks" || ok "Store purchase plugin satisfies both IAP checks"+rm -rf "$D"+D="$(mk_flutter_pay '')"; OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -q 'GOOGLE-PLAY-BILLING' && echo "$OUT" | grep -q 'APPLE-3.1.1-EXTERNAL-PAYMENT' && ok "Payment SDK with no store plugin still fires both IAP checks" || bad "Payment SDK with no store plugin still fires both IAP checks"+rm -rf "$D"++# 53 "renew automatically until cancelled" is a renewal notice, not an instruction to call.+D="$(mktemp -d)"+printf '{"name":"t"}' > "$D/package.json"+printf '<html><body>Your subscription renews automatically until cancelled in your store account settings.</body></html>' > "$D/index.html"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -Eq '^ \[(CRITICAL|HIGH|MEDIUM)\] +BOTH-SUBSCRIPTION-HARD-CANCEL ' && bad "Call inside automatically does not read as call to cancel" || ok "Call inside automatically does not read as call to cancel"+rm -rf "$D"++# 54 and 51, the two fixtures from #542. Prose about files is not a sensitive permission. READ_CONTACTS is.+mk_android_perm() {+ local d; d="$(mktemp -d)"; mkdir -p "$d/android/app/src/main"+ printf '<manifest xmlns:android="http://schemas.android.com/apk/res/android"><uses-permission android:name="android.permission.INTERNET"/>%s</manifest>' "$1" > "$d/android/app/src/main/AndroidManifest.xml"+ printf 'android { compileSdk 36 }\n' > "$d/android/app/build.gradle"+ echo "$d"+}+D="$(mk_android_perm '')"+printf '<html><body>%s</body></html>' "$(for i in $(seq 1 20); do printf 'Export the files. '; done)" > "$D/notes.html"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -Eq '^ \[(CRITICAL|HIGH|MEDIUM)\] +ANDROID-USER-DATA-DISCLOSURE ' && bad "#542 fixture A: prose about files stays silent" || ok "#542 fixture A: prose about files stays silent"+rm -rf "$D"+D="$(mk_android_perm '<uses-permission android:name="android.permission.READ_CONTACTS"/>')"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -q 'ANDROID-USER-DATA-DISCLOSURE' && ok "#542 fixture B: READ_CONTACTS without disclosure fires" || bad "#542 fixture B: READ_CONTACTS without disclosure fires"+rm -rf "$D"++# 56 #542. Bundled web output under dist/ is a build artifact, not source.+D="$(mktemp -d)"; mkdir -p "$D/App" "$D/web/dist/assets"+printf '<plist/>' > "$D/App/Info.plist"+printf 'const u="http://localhost:54321/auth/v1";\n' > "$D/web/dist/assets/index-abc123.js"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -Eq '^ \[(CRITICAL|HIGH|MEDIUM)\] +APPLE-2\.1-STAGING-BACKEND ' && bad "Bundled dist/ output is not scanned as source" || ok "Bundled dist/ output is not scanned as source"+rm -rf "$D"++# 57 targetSdk lives two levels down in every real project. The old ** glob never read android/app/build.gradle+D="$(mktemp -d)"; mkdir -p "$D/android/app/src/main"+printf '<manifest package="t"/>' > "$D/android/app/src/main/AndroidManifest.xml"+printf 'android { defaultConfig { targetSdkVersion 35 } buildTypes { release { minifyEnabled true } } }\n' > "$D/android/app/build.gradle"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -Eq '^ +\[CRITICAL\] +GOOGLE-TARGET-API ' && ok "targetSdk 35 two levels deep fires the API 36 floor" || bad "targetSdk 35 two levels deep fires the API 36 floor"+printf 'android { defaultConfig { targetSdk = 36 } buildTypes { release { isMinifyEnabled = true } } }\n' > "$D/android/app/build.gradle"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -Eq '^ +\[CRITICAL\] +GOOGLE-TARGET-API ' && bad "targetSdk 36 stays silent" || ok "targetSdk 36 stays silent"+rm -rf "$D"++# 58 Play Billing Library 7 dependency fires the v8 floor, 8 stays silent+D="$(mktemp -d)"; mkdir -p "$D/app/src/main/java/t"+printf '<manifest package="t"/>' > "$D/app/src/main/AndroidManifest.xml"+printf 'android { defaultConfig { targetSdkVersion 36 } buildTypes { release { minifyEnabled true } } }\ndependencies { implementation "com.android.billingclient:billing-ktx:7.1.1" }\n' > "$D/app/build.gradle"+printf 'val c = BillingClient.newBuilder(ctx)\n' > "$D/app/src/main/java/t/Pay.kt"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -Eq '^ +\[CRITICAL\] +GOOGLE-PLAY-BILLING-V8-REQUIRED ' && ok "Billing Library 7 fires the v8 floor" || bad "Billing Library 7 fires the v8 floor"+sed -i.bak 's/billing-ktx:7.1.1/billing-ktx:8.0.0/' "$D/app/build.gradle"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -Eq '^ +\[CRITICAL\] +GOOGLE-PLAY-BILLING-V8-REQUIRED ' && bad "Billing Library 8 stays silent" || ok "Billing Library 8 stays silent"+rm -rf "$D"++# 59 READ_MEDIA_IMAGES without the photo picker surfaces the declaration, with the picker it stays silent+D="$(mktemp -d)"; mkdir -p "$D/app/src/main/java/t"+printf '<manifest><uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/></manifest>' > "$D/app/src/main/AndroidManifest.xml"+printf 'android { defaultConfig { targetSdkVersion 36 } buildTypes { release { minifyEnabled true } } }\n' > "$D/app/build.gradle"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -q 'GOOGLE-PHOTO-VIDEO-PERMISSIONS-DECLARATION' && ok "READ_MEDIA_IMAGES without a picker surfaces the declaration" || bad "READ_MEDIA_IMAGES without a picker surfaces the declaration"+printf 'val p = registerForActivityResult(PickVisualMedia()) {}\n' > "$D/app/src/main/java/t/Pick.kt"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -q 'GOOGLE-PHOTO-VIDEO-PERMISSIONS-DECLARATION' && bad "READ_MEDIA_IMAGES with the photo picker stays silent" || ok "READ_MEDIA_IMAGES with the photo picker stays silent"+rm -rf "$D"++# 60 an AccountManager import with no declared permission is not a data-collection signal+D="$(mktemp -d)"; mkdir -p "$D/app/src/main/java/t"+printf '<manifest><uses-permission android:name="android.permission.INTERNET"/></manifest>' > "$D/app/src/main/AndroidManifest.xml"+printf 'android { defaultConfig { targetSdkVersion 36 } buildTypes { release { minifyEnabled true } } }\n' > "$D/app/build.gradle"+printf 'import android.accounts.AccountManager\n// ContactsContract is not used here\n' > "$D/app/src/main/java/t/A.kt"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -q 'ANDROID-USER-DATA-DISCLOSURE' && bad "Symbol in an import without a declared permission stays silent" || ok "Symbol in an import without a declared permission stays silent"+rm -rf "$D"++# 61 src/dist is an Android product-flavor source set and must be scanned, web/dist is build output and must not+D="$(mktemp -d)"; mkdir -p "$D/app/src/main" "$D/app/src/dist/java/t"+printf '<manifest package="t"/>' > "$D/app/src/main/AndroidManifest.xml"+printf 'android { defaultConfig { targetSdkVersion 36 } buildTypes { release { minifyEnabled true } } }\n' > "$D/app/build.gradle"+printf 'import com.stripe.android.Stripe\n' > "$D/app/src/dist/java/t/Pay.kt"+OUT="$(bash "$GUARD" "$D" 2>&1)"+echo "$OUT" | grep -q 'GOOGLE-PLAY-BILLING' && ok "Stripe inside a src/dist flavor tree is still seen" || bad "Stripe inside a src/dist flavor tree is still seen"+rm -rf "$D"++# 62 a privacy manifest whose root is an array fires through the guard, never a silent pass+D="$(mktemp -d)"; mkdir -p "$D/App"+printf '<plist><dict><key>ITSAppUsesNonExemptEncryption</key><false/></dict></plist>' > "$D/App/Info.plist"+printf '<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><array/></plist>' > "$D/App/PrivacyInfo.xcprivacy"+OUT="$(bash "$GUARD" "$D" 2>&1)"; RC=$?+echo "$OUT" | grep -q 'APPLE-MANIFEST-UNREADABLE' && [ "$RC" -eq 2 ] && ok "Array-root manifest blocks" || bad "Array-root manifest blocks (rc=$RC)"rm -rf "$D"echo ""diff --git a/agent-os/hooks/app-store-compliance-guard.sh b/agent-os/hooks/app-store-compliance-guard.shindex 53784d9..576cb6c 100755--- a/agent-os/hooks/app-store-compliance-guard.sh+++ b/agent-os/hooks/app-store-compliance-guard.sh@@ -52,15 +52,24 @@ fi[ -d "$DIR" ] || { log_err "project dir not found. $DIR"; exit 0; }# ----- build a source file list, excluding vendor dirs -----+# Directories are pruned by name, and only below the project root (-mindepth 1). The old full-path+# match also hit the folders ABOVE the root, so a project sitting under a folder named build was+# scanned as empty, and it still walked every excluded tree. Test code, Python virtualenvs, and+# bundled web output (dist) never ship in the binary, and a virtualenv's vendored JSON otherwise+# reads as app source. .xcprivacy is scanned because NSPrivacyCollectedDataTypes lives there.FILELIST="$(mktemp 2>/dev/null || echo /tmp/ascg.$$)"-find "$DIR" -type f \( \+find "$DIR" -mindepth 1 \+ \( -type d \( -name node_modules -o -name Pods -o -name .git -o -name build -o \( -name dist -not -path '*/src/dist' \) \+ -o -name DerivedData -o -name vendor -o -name .dart_tool -o -name Carthage \+ -o -name '*Tests' -o -name androidTest -o -name __tests__ -o -name test -o -name tests \+ -o -name integration_test -o -name .venv -o -name venv -o -name site-packages -o -name .pub-cache \) -prune \) \+ -o -type f \( \-name '*.swift' -o -name '*.m' -o -name '*.h' -o -name '*.kt' -o -name '*.java' \-o -name '*.xml' -o -name '*.plist' -o -name '*.gradle' -o -name '*.kts' \-o -name '*.json' -o -name '*.js' -o -name '*.jsx' -o -name '*.ts' -o -name '*.tsx' \-o -name '*.dart' -o -name '*.xcconfig' -o -name '*.yaml' -o -name '*.yml' \- -o -name '*.pbxproj' -o -name '*.entitlements' -o -name '*.html' \- \) 2>/dev/null \- | grep -vE '/(node_modules|Pods|\.git|build|DerivedData|vendor|\.dart_tool|Carthage|[A-Za-z0-9_]*Tests|androidTest|__tests__)/' \+ -o -name '*.pbxproj' -o -name '*.entitlements' -o -name '*.html' -o -name '*.xcprivacy' \+ \) -print 2>/dev/null \> "$FILELIST"grep_has() { # 0 if regex found in any source file@@ -70,6 +79,13 @@ grep_has() { # 0 if regex found in any source file[ -n "$out" ]}+manifest_has() { # 0 if regex found in any AndroidManifest.xml in the source list+ [ -s "$FILELIST" ] || return 1+ local out+ out="$(grep '/AndroidManifest\.xml$' "$FILELIST" | tr '\n' '\0' | xargs -0 grep -EIls -e "$1" 2>/dev/null | head -1)"+ [ -n "$out" ]+}+# True only if a STRING LITERAL containing the regex appears in RELEASE-reachable source. For# Swift, `#if DEBUG` / `#if !RELEASE` debug-only regions are stripped first, so a URL only a debug# build compiles is not flagged. The string-literal requirement (the match must sit inside "...")@@ -108,24 +124,40 @@ finding() { # severity id title fixprintf ' fix. %s\n' "$4"}+# Cross-platform apps reach StoreKit and Play Billing through a plugin, so the native symbols never+# appear in their source. These are the plugins' own package names.+XPLAT_IAP='in_app_purchase|purchases_flutter|flutter_inapp_purchase|react-native-iap|react-native-purchases|expo-iap|cordova-plugin-purchase|@revenuecat/purchases-capacitor'++# Vendored trees never decide the platform, and the prune applies only below the project root, so a project+# that itself sits under a folder named build or test is still detected. Same SIGPIPE-safe grep as the source scan.+find_app() { # find_app <maxdepth> <find name expression...>+ local depth="$1"; shift+ find "$DIR" -mindepth 1 -maxdepth "$depth" \+ \( -type d \( -name node_modules -o -name Pods -o -name .git -o -name build -o \( -name dist -not -path '*/src/dist' \) \+ -o -name DerivedData -o -name vendor -o -name .dart_tool -o -name Carthage -o -name .pub-cache \) -prune \) \+ -o \( "$@" \) -print 2>/dev/null+}+# ----- platform detection -----+# Every find below pipes into `grep .`, never `grep -q .`, for the reason in release_string_has:+# grep -q exits on the first match, find dies of SIGPIPE, and pipefail turns "found" into "missing".IS_IOS=0; IS_AND=0; IS_WEB=0-find "$DIR" -maxdepth 4 \( -name '*.xcodeproj' -o -name '*.xcworkspace' -o -name 'Package.swift' -o -name 'Podfile' \) 2>/dev/null | grep -vE '/(node_modules|Pods|\.git|build|DerivedData|vendor|\.dart_tool|Carthage)/' | grep -q . && IS_IOS=1-find "$DIR" -maxdepth 4 -name 'Info.plist' 2>/dev/null | grep -vE '/(node_modules|Pods|\.git|build|DerivedData|vendor|\.dart_tool|Carthage)/' | grep -q . && IS_IOS=1-find "$DIR" -maxdepth 5 \( -name 'AndroidManifest.xml' -o -name 'build.gradle' -o -name 'build.gradle.kts' \) 2>/dev/null | grep -vE '/(node_modules|Pods|\.git|build|DerivedData|vendor|\.dart_tool|Carthage)/' | grep -q . && IS_AND=1-find "$DIR" -maxdepth 4 \( -name 'package.json' -o -name 'index.html' -o -name 'webpack.config.js' -o -name 'next.config.js' \) 2>/dev/null | grep -vE '/(node_modules|Pods|\.git|build|DerivedData|vendor|\.dart_tool|Carthage)/' | grep -q . && IS_WEB=1+find_app 4 -name '*.xcodeproj' -o -name '*.xcworkspace' -o -name 'Package.swift' -o -name 'Podfile' | grep . >/dev/null && IS_IOS=1+find_app 4 -name 'Info.plist' | grep . >/dev/null && IS_IOS=1+find_app 5 -name 'AndroidManifest.xml' -o -name 'build.gradle' -o -name 'build.gradle.kts' | grep . >/dev/null && IS_AND=1+find_app 4 -name 'package.json' -o -name 'index.html' -o -name 'webpack.config.js' -o -name 'next.config.js' | grep . >/dev/null && IS_WEB=1# ----- cross-platform framework detection -----# IS_IOS/IS_AND above still fire on the built artifact. This adds framework-specific checks.IS_FLUTTER=0; IS_RN=0; IS_IONIC=0-find "$DIR" -maxdepth 4 -name 'pubspec.yaml' 2>/dev/null | grep -vE '/(node_modules|Pods|\.git|build|DerivedData|vendor|\.dart_tool|Carthage)/' | grep -q . && IS_FLUTTER=1+find_app 4 -name 'pubspec.yaml' | grep . >/dev/null && IS_FLUTTER=1# Scan EVERY package.json within depth (not just the first), so a monorepo root's tooling# package.json never shadows a real apps/mobile/package.json deeper in the tree.while IFS= read -r pkg; dogrep -qE '"react-native"|"expo"' "$pkg" 2>/dev/null && IS_RN=1grep -qE '"@capacitor/core"|"@capacitor/ios"|"@capacitor/android"|"@ionic/(angular|react|vue)"|"cordova-android"|"cordova-ios"' "$pkg" 2>/dev/null && IS_IONIC=1done < <(find "$DIR" -maxdepth 4 -name 'package.json' 2>/dev/null | grep -vE '/(node_modules|ios/Pods)/')-find "$DIR" -maxdepth 4 -name 'capacitor.config.*' 2>/dev/null | grep -vE '/(node_modules|Pods|\.git|build|DerivedData|vendor|\.dart_tool|Carthage)/' | grep -q . && IS_IONIC=1+find_app 4 -name 'capacitor.config.*' | grep . >/dev/null && IS_IONIC=1# config.xml alone is ambiguous (Maven/NuGet/tooling also use that filename), so require the# Cordova widget marker before it counts as a signal.while IFS= read -r cfg; do@@ -170,7 +202,9 @@ if grep_has 'lorem ipsum|example\.(com|org)|YOUR_[A-Z_]+_(KEY|HERE)|INSERT_[A-Z_finding high "BOTH-PLACEHOLDER" "Placeholder content (lorem ipsum, example.com, dummy text) found in sources" "Replace placeholder text and assets with real content."fi# ROSCA and CA/NY/MA negative-option laws bind regardless of the vacated federal rule.-if grep_has 'subscri(be|ption)|auto.renew|membership' && grep_has '[Cc]all.{0,25}[Cc]ancel|[Cc]ancel.{0,25}[Cc]all|[Mm]ail.{0,25}[Cc]ancel|[Ww]rite.{0,25}[Cc]ancel|[Cc]ancel.{0,15}(in.person|by.phone|by.mail)'; then+# "call" and "write" match as whole words only, or "renews automatically until cancelled" and+# "overwrite ... cancel" read as an instruction to call or write in.+if grep_has 'subscri(be|ption)|auto.renew|membership' && grep_has '(^|[^A-Za-z])[Cc]all[^A-Za-z].{0,24}[Cc]ancel|[Cc]ancel.{0,25}[^A-Za-z][Cc]all([^A-Za-z]|$)|[Mm]ail.{0,25}[Cc]ancel|(^|[^A-Za-z])[Ww]rite[^A-Za-z].{0,24}[Cc]ancel|[Cc]ancel.{0,15}(in.person|by.phone|by.mail)'; thenfinding high "BOTH-SUBSCRIPTION-HARD-CANCEL" "Subscription cancellation appears to require a phone call, mail, or an in-person visit" "Provide a self-service cancellation path at least as easy as sign-up (FTC Section 5, ROSCA, and CA/NY/MA negative-option laws)."fi# fastlane precheck derived metadata checks@@ -188,7 +222,7 @@ fi# iOS-only Apple requirement, gated on IS_IOS so an Android-only build is never blocked for it.if [ "$IS_FLUTTER" -eq 1 ]; thenif [ "$IOS_TARGET_ACTIVE" -eq 1 ] && grep_has 'permission_handler|image_picker|geolocator|device_info_plus|package_info_plus|shared_preferences|sqflite|firebase_'; then- if ! find "$DIR" -name 'PrivacyInfo.xcprivacy' 2>/dev/null | grep -q .; then+ if ! find "$DIR" -name 'PrivacyInfo.xcprivacy' 2>/dev/null | grep . >/dev/null; thenfinding critical "FLUTTER-PRIVACY-MANIFEST-MISSING" "Flutter plugins that touch required-reason APIs but no PrivacyInfo.xcprivacy anywhere in the project" "Add an app-level PrivacyInfo.xcprivacy AND confirm each Flutter plugin ships its own (permission_handler, image_picker, and most first-party plugins added theirs from Flutter 3.19+). A missing plugin-level manifest is invisible to Apple's aggregator unless the app manifest also declares that plugin's reason codes. This check only runs against an iOS target."fifi@@ -206,7 +240,7 @@ if [ "$IS_RN" -eq 1 ] && [ "$IOS_TARGET_ACTIVE" -eq 1 ]; thenfifiif grep_has 'Firebase|@react-native-firebase|expo-file-system|expo-application|AsyncStorage|@react-native-async-storage'; then- if ! find "$DIR" -name 'PrivacyInfo.xcprivacy' 2>/dev/null | grep -q .; then+ if ! find "$DIR" -name 'PrivacyInfo.xcprivacy' 2>/dev/null | grep . >/dev/null; thenfinding critical "RN-PRIVACY-MANIFEST-MISSING" "React Native native modules that touch required-reason APIs but no PrivacyInfo.xcprivacy anywhere" "Add an app-level PrivacyInfo.xcprivacy. Native modules bundled transitively via JS deps (analytics, storage, device-info libraries) each need their own manifest aggregated in the final IPA; this is easy to miss because the dependency is JS-side."fifi@@ -224,7 +258,7 @@ if [ "$IS_IONIC" -eq 1 ] && [ "$IOS_TARGET_ACTIVE" -eq 1 ]; thenfinding critical "IONIC-UIWEBVIEW-DEPRECATED" "Deprecated UIWebView symbol referenced (directly or via a stale plugin)" "Apple auto-rejects (ITMS-90809) any binary statically linking UIWebView. Update every Capacitor/Cordova plugin to a version using WKWebView; a stale plugin can pull this in even when app code never references it."fiif grep_has '@capacitor/|Capacitor\.'; then- if ! find "$DIR" -name 'PrivacyInfo.xcprivacy' 2>/dev/null | grep -q .; then+ if ! find "$DIR" -name 'PrivacyInfo.xcprivacy' 2>/dev/null | grep . >/dev/null; thenfinding high "IONIC-PRIVACY-MANIFEST-MISSING" "Capacitor/Cordova plugins present but no PrivacyInfo.xcprivacy" "Capacitor plugin manifest support is less standardized than Flutter's; verify each plugin wrapping a native SDK (camera, geolocation, ads) ships PrivacyInfo.xcprivacy, and add the app-level one."fifi@@ -282,7 +316,7 @@ if [ "$IS_IOS" -eq 1 ]; thengrep_has 'ATTrackingManager|NSUserTrackingUsageDescription' || finding high "APPLE-5.1.2-MISSING-ATT" "Tracking SDK without App Tracking Transparency" "Call the ATT prompt and add NSUserTrackingUsageDescription (Apple 5.1.2)."fiif grep_has 'Stripe|PayPalCheckout|braintree|razorpay'; then- grep_has 'StoreKit|SKProduct|Product\.purchase' || finding critical "APPLE-3.1.1-EXTERNAL-PAYMENT" "External payment SDK without StoreKit" "Route digital goods through in app purchase unless the app is a documented exempt category (Apple 3.1.1)."+ grep_has "StoreKit|SKProduct|Product\.purchase|$XPLAT_IAP" || finding critical "APPLE-3.1.1-EXTERNAL-PAYMENT" "External payment SDK without StoreKit" "Route digital goods through in app purchase unless the app is a documented exempt category (Apple 3.1.1)."fiif grep_has 'api\.openai\.com|anthropic|generativelanguage|chat/completions'; thenfinding medium "APPLE-5.1.2-AI-NO-CONSENT-MODAL" "Third party AI integration detected" "If personal data is sent, show a consent modal naming the AI provider and data types (Apple 5.1.2)."@@ -302,7 +336,7 @@ if [ "$IS_IOS" -eq 1 ]; thenfi# Privacy manifest, the top modern Apple upload rejection since 2024if grep_has 'Firebase|Alamofire|UserDefaults|systemUptime|FileManager\.default|ProcessInfo'; then- if ! find "$DIR" -name 'PrivacyInfo.xcprivacy' 2>/dev/null | grep -q .; then+ if ! find "$DIR" -name 'PrivacyInfo.xcprivacy' 2>/dev/null | grep . >/dev/null; thenfinding critical "APPLE-PRIVACY-MANIFEST-MISSING" "Required reason APIs or SDKs present but no PrivacyInfo.xcprivacy" "Add a privacy manifest with approved reason codes and tracking domains, and confirm each SDK ships its signed manifest."fifi@@ -318,8 +352,12 @@ if [ "$IS_IOS" -eq 1 ]; thendoneif [ -n "$MANIFEST_VALIDATOR" ] && command -v python3 >/dev/null 2>&1; then# Same exclusions as the source file list. A pod's manifest is the vendor's job, a Tests fixture never ships.- find "$DIR" -name 'PrivacyInfo.xcprivacy' 2>/dev/null \- | grep -vE '/(node_modules|Pods|\.git|build|DerivedData|vendor|\.dart_tool|Carthage|[A-Za-z0-9_]*Tests|androidTest|__tests__)/' \+ find "$DIR" -mindepth 1 \+ \( -type d \( -name node_modules -o -name Pods -o -name .git -o -name build -o \( -name dist -not -path '*/src/dist' \) \+ -o -name DerivedData -o -name vendor -o -name .dart_tool -o -name Carthage \+ -o -name '*Tests' -o -name androidTest -o -name __tests__ -o -name test -o -name tests \+ -o -name integration_test -o -name .venv -o -name venv -o -name site-packages -o -name .pub-cache \) -prune \) \+ -o -name 'PrivacyInfo.xcprivacy' -print 2>/dev/null \| while IFS= read -r manifest; dopython3 "$MANIFEST_VALIDATOR" "$manifest" 2>/dev/nulldone > "$FILELIST.manifest" 2>/dev/null || true@@ -330,6 +368,8 @@ if [ "$IS_IOS" -eq 1 ]; thendone < "$FILELIST.manifest"firm -f "$FILELIST.manifest" 2>/dev/null || true+ elif find_app 12 -name 'PrivacyInfo.xcprivacy' | grep . >/dev/null; then+ finding medium "APPLE-MANIFEST-VALIDATOR-UNAVAILABLE" "Privacy manifests present but python3 or scripts/validate-privacy-manifest.py is missing, so their internals were not validated" "Install python3 and keep scripts/validate-privacy-manifest.py next to the guard, or run plutil -lint on each manifest by hand."figrep_has 'ITSAppUsesNonExemptEncryption' || finding high "APPLE-EXPORT-COMPLIANCE-MISSING" "ITSAppUsesNonExemptEncryption not set" "Set it in Info.plist or the build stalls in Missing Compliance and never reaches review."if grep_has 'SKProduct|Product\.purchase|StoreKit'; then@@ -392,7 +432,7 @@ if [ "$IS_AND" -eq 1 ]; thenfinding critical "GOOGLE-PERM-ACCESSIBILITY-MISUSE" "AccessibilityService present" "Use it only for genuine accessibility and declare the use, or remove it."fiif grep_has 'Stripe|PayPal|braintree|razorpay'; then- grep_has 'BillingClient|com\.android\.billingclient' || finding critical "GOOGLE-PLAY-BILLING" "External payment without Play Billing" "Use Play Billing for in app digital goods."+ grep_has "BillingClient|com\.android\.billingclient|$XPLAT_IAP" || finding critical "GOOGLE-PLAY-BILLING" "External payment without Play Billing" "Use Play Billing for in app digital goods."fi# Payments policy exception is literal. only a tax-exempt charity may take donations outside Play# billing (AnkiDroid, August 2026). A donate link to a funding platform is a Payments violation.@@ -401,6 +441,11 @@ if [ "$IS_AND" -eq 1 ]; thenfi# Since 3 August 2026 the developer bears chargeback costs. An app on Play billing that never# handles the refund-review notification loses every fraudulent dispute by default.+ # New apps and updates need Play Billing Library 8 or later since 31 August 2026 (deprecation ladder, extension to 1 November 2026).+ BILLING_MAJOR="$(grep -E '/build\.gradle(\.kts)?$' "$FILELIST" | tr '\n' '\0' | xargs -0 grep -hoE 'com\.android\.billingclient:billing(-ktx)?:[0-9]+' 2>/dev/null | grep -oE '[0-9]+$' | sort -n | tail -1)"+ if [ -n "$BILLING_MAJOR" ] && [ "$BILLING_MAJOR" -lt 8 ]; then+ finding critical "GOOGLE-PLAY-BILLING-V8-REQUIRED" "Play Billing Library $BILLING_MAJOR.x, new apps and updates need version 8 or later since 31 August 2026" "Upgrade com.android.billingclient:billing to 8.x, or request the Play Console extension available until 1 November 2026."+ fiif grep_has 'BillingClient|com\.android\.billingclient'; thengrep_has 'PendingRefundReviewNotification|[Rr]eview[Rr]efund' || finding medium "GOOGLE-PLAY-CHARGEBACK-LIABILITY" "Play billing without chargeback dispute handling" "Handle PendingRefundReviewNotification and call the Review Refund API within 24 hours with the refund preference and usage evidence (Play Console Help answer 17068375)."fi@@ -434,9 +479,11 @@ if [ "$IS_AND" -eq 1 ]; thenif ! grep_has 'privacyPolicy|privacy-policy'; thenfinding high "GOOGLE-MISSING-PRIVACY-POLICY" "No privacy policy reference found" "Publish a privacy policy and set its URL in the Play Console store listing."fi- TSDK="$(grep -hoE 'targetSdk(Version)?[[:space:]=]+[0-9]+' "$DIR"/**/build.gradle* 2>/dev/null | grep -oE '[0-9]+' | sort -n | tail -1)"- if [ -n "$TSDK" ] && [ "$TSDK" -lt 34 ]; then- finding high "GOOGLE-TARGET-API" "targetSdk is $TSDK, below the current Play requirement" "Build against the current required Android target API level and verify the current minimum."+ # Every build.gradle in the source list. A bare ** glob without globstar only saw one directory level, so+ # android/app/build.gradle was never read. Play rejects new apps and updates below API 36 since 31 August 2026.+ TSDK="$(grep -E '/build\.gradle(\.kts)?$' "$FILELIST" | tr '\n' '\0' | xargs -0 grep -hoE 'targetSdk(Version)?[[:space:]=]+[0-9]+' 2>/dev/null | grep -oE '[0-9]+' | sort -n | tail -1)"+ if [ -n "$TSDK" ] && [ "$TSDK" -lt 36 ]; then+ finding critical "GOOGLE-TARGET-API" "targetSdk is $TSDK, below the API 36 floor Play enforces for new apps and updates since 31 August 2026" "Target API 36 or higher (Wear OS and Automotive 35, TV and XR 34), or request the Play Console extension available until 1 November 2026."fi# Android 17 (API 37) targets. contacts picker, location button scope, and local network permission (27 Jan 2027).if [ -n "$TSDK" ] && [ "$TSDK" -ge 37 ] 2>/dev/null; then@@ -494,8 +541,17 @@ if [ "$IS_AND" -eq 1 ]; thenfififinding medium "GOOGLE-12-TESTER-RULE" "Verify the closed testing requirement" "A new personal account needs 12 testers over 14 consecutive days before production."- if grep_has 'contacts|SMS|device accounts|files|personalData'; then- if ! grep_has 'prominent disclosure|user consent|privacy consent|accept policy'; then+ # Play only allows READ_MEDIA_IMAGES and READ_MEDIA_VIDEO on API 33+ when the system picker cannot serve the core+ # feature, and a Play Console declaration is required either way (Photo and Video Permissions policy).+ if manifest_has 'android\.permission\.READ_MEDIA_(IMAGES|VIDEO)'; then+ if ! grep_has 'PickVisualMedia|ACTION_PICK_IMAGES|PhotoPicker|photo_picker'; then+ finding high "GOOGLE-PHOTO-VIDEO-PERMISSIONS-DECLARATION" "READ_MEDIA_IMAGES or READ_MEDIA_VIDEO declared without the Android photo picker" "Use the Android photo picker for one-off selection. Keep broad access only for a core gallery-style feature and complete the Photo and Video Permissions declaration in Play Console."+ fi+ fi+ # Declared permissions in AndroidManifest.xml, the surface Play enforces on (#542). English words matched prose,+ # and bare API symbols match imports, comments and vendored SDKs. READ_MEDIA_* has its own check below.+ if manifest_has 'android\.permission\.(READ_CONTACTS|WRITE_CONTACTS|READ_SMS|SEND_SMS|RECEIVE_SMS|READ_CALL_LOG|WRITE_CALL_LOG|GET_ACCOUNTS|MANAGE_EXTERNAL_STORAGE)'; then+ if ! grep_has 'prominent disclosure|user consent|privacy consent|accept policy|[Pp]rominentDisclosure|[Dd]isclosureDialog|[Cc]onsentDialog|showDisclosure|requestConsent'; thenfinding critical "ANDROID-USER-DATA-DISCLOSURE" "Missing prominent disclosure for sensitive user data" "Provide a prominent in-app disclosure before collecting sensitive personal data, and obtain explicit user consent."fifidiff --git a/data/detection-recipes.json b/data/detection-recipes.jsonindex 2967c43..8029160 100644--- a/data/detection-recipes.json+++ b/data/detection-recipes.json@@ -6,7 +6,7 @@"APPLE-5.1.1-MISSING-USAGE-DESCRIPTION": "for k in NSCameraUsageDescription NSLocationWhenInUseUsageDescription NSPhotoLibraryUsageDescription NSContactsUsageDescription NSMicrophoneUsageDescription; do echo \"$k\"; plutil -extract \"$k\" raw */Info.plist 2>/dev/null || echo ' MISSING or empty'; done","APPLE-5.1.1-NO-ACCOUNT-DELETION": "grep -rn 'createAccount\\|signUp\\|register' --include='*.swift' . && ! grep -rn 'deleteAccount\\|delete_account\\|account deletion' --include='*.swift' .","APPLE-5.1.2-MISSING-ATT": "grep -rn 'AppsFlyer\\|Adjust\\|FBSDK\\|advertisingIdentifier\\|ASIdentifierManager' --include='*.swift' . && ! grep -rn 'ATTrackingManager\\|NSUserTrackingUsageDescription' .",- "APPLE-3.1.1-EXTERNAL-PAYMENT": "grep -rn 'Stripe\\|PayPalCheckout\\|braintree\\|razorpay' --include='*.swift' . && ! grep -rn 'StoreKit\\|SKProduct\\|Product.purchase' --include='*.swift' .",+ "APPLE-3.1.1-EXTERNAL-PAYMENT": "grep -rn 'Stripe\\|PayPalCheckout\\|braintree\\|razorpay' --include='*.swift' --include='pubspec.yaml' --include='package.json' . && ! grep -rnE 'StoreKit|SKProduct|Product.purchase|in_app_purchase|purchases_flutter|flutter_inapp_purchase|react-native-iap|react-native-purchases|expo-iap|cordova-plugin-purchase|@revenuecat/purchases-capacitor' --include='*.swift' --include='pubspec.yaml' --include='package.json' .","APPLE-4.8-SOCIAL-LOGIN-ONLY": "grep -rn 'FacebookLogin\\|GoogleSignIn\\|GIDSignIn' --include='*.swift' . && ! grep -rn 'SignInWithApple\\|ASAuthorizationAppleIDProvider' --include='*.swift' .","APPLE-PRIVACY-MANIFEST-MISSING": "find . -name 'PrivacyInfo.xcprivacy' | grep -q . || echo 'MISSING PrivacyInfo.xcprivacy'; find . -path '*/*.framework/*' -name 'PrivacyInfo.xcprivacy' # each bundled SDK should ship one","APPLE-EXPORT-COMPLIANCE-MISSING": "grep -rn 'ITSAppUsesNonExemptEncryption' */Info.plist || echo 'MISSING ITSAppUsesNonExemptEncryption, build will stall in Missing Compliance'",@@ -23,7 +23,7 @@"GOOGLE-PERM-SMS-CALLLOG": "grep -rnE 'permission.(READ_SMS|SEND_SMS|RECEIVE_SMS|READ_CALL_LOG|WRITE_CALL_LOG)' --include='AndroidManifest.xml' .","GOOGLE-PERM-ACCESSIBILITY-MISUSE": "grep -rn 'BIND_ACCESSIBILITY_SERVICE\\|AccessibilityService' --include='AndroidManifest.xml' --include='*.kt' --include='*.java' .","GOOGLE-TARGET-API": "grep -rnE 'targetSdk(Version)?[ =]+[0-9]+' --include='*.gradle' --include='*.kts' . # must be 36 or higher from 31 Aug 2026",- "GOOGLE-PLAY-BILLING": "grep -rn 'Stripe\\|PayPal\\|razorpay' --include='*.kt' --include='*.java' . && ! grep -rn 'BillingClient\\|com.android.billingclient' .",+ "GOOGLE-PLAY-BILLING": "grep -rn 'Stripe\\|PayPal\\|razorpay' --include='*.kt' --include='*.java' --include='pubspec.yaml' --include='package.json' . && ! grep -rnE 'BillingClient|com.android.billingclient|in_app_purchase|purchases_flutter|flutter_inapp_purchase|react-native-iap|react-native-purchases|expo-iap|cordova-plugin-purchase|@revenuecat/purchases-capacitor' .","ANDROID-DYNAMIC-CODE-LOADING": "grep -rn 'DexClassLoader\\|PathClassLoader\\|loadDex\\|createPackageContext' --include='*.kt' --include='*.java' .","ANDROID-QUERY-ALL-PACKAGES": "grep -rn 'QUERY_ALL_PACKAGES' --include='AndroidManifest.xml' .","ANDROID-OVERLAY-TAPJACKING": "grep -rn 'SYSTEM_ALERT_WINDOW\\|TYPE_APPLICATION_OVERLAY' --include='AndroidManifest.xml' --include='*.kt' --include='*.java' .",@@ -50,7 +50,7 @@"APPLE-GAMBLING-BRAZIL-LICENSE": "grep -rni 'gambling\\|fixed-odds\\|betting' --include='*.swift' . # then verify the SPA license is provided in App Review Information for Brazil storefront","GOOGLE-PLAY-AGE-SIGNALS-MISUSE": "grep -rn 'com.google.android.play:age-signals\\|AgeSignalsManager\\|AgeSignalsRequest' --include='*.gradle' --include='*.kts' --include='*.kt' --include='*.java' . # if present, confirm age signals are never passed to ad, marketing, profiling, or analytics SDKs","APPLE-PRIVACY-NUTRITION-LABELS": "grep -rn 'email\\|phoneNumber\\|userName\\|location\\|coordinates' --include='*.swift' . && ! grep -rn 'NSPrivacyCollectedDataTypes\\|privacyNutritionLabels\\|privacy-nutrition-labels' .",- "ANDROID-USER-DATA-DISCLOSURE": "grep -rn 'contacts\\|SMS\\|device accounts\\|files\\|personalData' --include='*.kt' --include='*.java' --include='*.xml' . && ! grep -rn 'prominent disclosure\\|user consent\\|privacy consent\\|accept policy' .",+ "ANDROID-USER-DATA-DISCLOSURE": "grep -rnE 'android\\.permission\\.(READ_CONTACTS|WRITE_CONTACTS|READ_SMS|SEND_SMS|RECEIVE_SMS|READ_CALL_LOG|WRITE_CALL_LOG|GET_ACCOUNTS|MANAGE_EXTERNAL_STORAGE)' --include='AndroidManifest.xml' . && ! grep -rnE 'prominent disclosure|user consent|privacy consent|accept policy|[Pp]rominentDisclosure|[Dd]isclosureDialog|[Cc]onsentDialog|showDisclosure|requestConsent' .","ANDROID-ADVERTISING-ID": "grep -rn 'com.google.android.gms.permission.AD_ID\\|AD_ID\\|getAdvertisingIdInfo' --include='AndroidManifest.xml' --include='*.kt' --include='*.java' . && ! grep -rn 'opt-out\\|reset AD_ID\\|advertisingIdConsent\\|delete AD_ID' .","ANDROID-RUNTIME-PERMISSIONS": "grep -rn 'requestPermissions\\|checkSelfPermission\\|shouldShowRequestPermissionRationale' --include='*.kt' --include='*.java' . && ! grep -rn 'permission explanation\\|showPermissionRationale\\|explainPermission' .","ANDROID-HEALTH-PERMISSIONS": "grep -rn 'HealthConnectClient\\|com.google.android.gms.permission.HealthConnect\\|READ_STEPS\\|READ_HEART_RATE' --include='*.kt' --include='*.java' --include='AndroidManifest.xml' . && ! grep -rn 'healthConnectConsent\\|healthPrivacyPolicy\\|Health Connect' .",@@ -73,7 +73,7 @@"ANDROID-ACCESSIBILITY-FONTSCALING": "python3 scripts/accessibility-audit.py . --rule ANDROID-ACCESSIBILITY-FONTSCALING","ANDROID-ACCESSIBILITY-HIGHCONTRAST": "python3 scripts/accessibility-audit.py . --rule ANDROID-ACCESSIBILITY-HIGHCONTRAST","ANDROID-ACCESSIBILITY-SCANNER": "python3 scripts/accessibility-audit.py . --rule ANDROID-ACCESSIBILITY-SCANNER",- "BOTH-SUBSCRIPTION-HARD-CANCEL": "grep -rniE 'subscri(be|ption)|auto.renew|membership' --include='*.swift' --include='*.kt' --include='*.java' --include='*.html' --include='*.md' . 2>/dev/null | grep -iE 'call.{0,25}cancel|cancel.{0,25}call|mail.{0,25}cancel|write.{0,25}cancel|cancel.{0,15}(in.person|by.phone|by.mail)'",+ "BOTH-SUBSCRIPTION-HARD-CANCEL": "grep -rniE 'subscri(be|ption)|auto.renew|membership' --include='*.swift' --include='*.kt' --include='*.java' --include='*.html' --include='*.md' . 2>/dev/null | grep -iE '(^|[^a-z])call[^a-z].{0,24}cancel|cancel.{0,25}[^a-z]call([^a-z]|$)|mail.{0,25}cancel|(^|[^a-z])write[^a-z].{0,24}cancel|cancel.{0,15}(in.person|by.phone|by.mail)'","BOTH-E-EVIDENCE-COMPLIANCE-MISSING": "grep -rniE 'e-evidence|european production order|european preservation order|emergency data production' . 2>/dev/null","BOTH-WITHDRAWAL-BUTTON-MISSING": "grep -rniE 'withdrawal button|withdrawal function|withdraw from contract|distance contract' . 2>/dev/null","BOTH-GPSR-COMPLIANCE-MISSING": "grep -rniE 'gpsr|general product safety|product safety|manufacturerInfo|safetyWarning' . 2>/dev/null",@@ -104,6 +104,8 @@"GOOGLE-GENAI-NCII-CONTROLS": "grep -rqn 'generateImage\\|imageGeneration\\|text-to-image\\|faceSwap\\|stable-diffusion' --include='*.kt' --include='*.java' --include='*.xml' --include='*.gradle' --include='*.kts' --include='*.dart' --include='*.ts' . && ! grep -rqi 'moderation\\|safetyClassifier\\|contentFilter' .","GOOGLE-ANON-CHAT-MINOR-BLOCK": "grep -rqi 'random chat\\|anonymous chat\\|chat with strangers\\|Omegle' . && ! grep -rqi 'ageGate\\|minorBlock\\|csae' .","GOOGLE-UNRATED-APP-BANNED": "echo 'manual. open Play Console, App content, Content rating, and confirm the questionnaire is complete and current'",- "APPLE-ENROLLMENT-VERIFICATION-PENDING": "echo 'manual. open developer.apple.com/account, confirm Membership is Active, every agreement and attachment is accepted, and no migration is pending, at least six weeks before the first submission'"+ "APPLE-ENROLLMENT-VERIFICATION-PENDING": "echo 'manual. open developer.apple.com/account, confirm Membership is Active, every agreement and attachment is accepted, and no migration is pending, at least six weeks before the first submission'",+ "GOOGLE-PLAY-BILLING-V8-REQUIRED": "grep -rnoE 'com\\.android\\.billingclient:billing(-ktx)?:[0-9]+' --include='*.gradle' --include='*.kts' . # major must be 8 or higher from 31 Aug 2026",+ "GOOGLE-PHOTO-VIDEO-PERMISSIONS-DECLARATION": "grep -rnE 'android\\.permission\\.READ_MEDIA_(IMAGES|VIDEO)' --include='AndroidManifest.xml' . && ! grep -rnE 'PickVisualMedia|ACTION_PICK_IMAGES|PhotoPicker|photo_picker' ."}}diff --git a/data/regulatory-deadlines.json b/data/regulatory-deadlines.jsonindex 09102c8..bbdc1eb 100644--- a/data/regulatory-deadlines.json+++ b/data/regulatory-deadlines.json@@ -420,7 +420,8 @@"mandatory_date": "2026-08-31","enforcement_date": "2026-08-31","affected_repository_sections": "docs/PLATFORM-MECHANICS-2026.md section 2.4, references/rules/payments.md",- "priority": "critical"+ "priority": "critical",+ "absorbed_into": "GOOGLE-PLAY-BILLING-V8-REQUIRED"},{"id": "GOOGLE-PLAY-TARGET-API-35",@@ -445,7 +446,8 @@"mandatory_date": "2026-08-31","enforcement_date": "2026-08-31","affected_repository_sections": "docs/PLATFORM-MECHANICS-2026.md section 2.5, references/rules/android.md",- "priority": "high"+ "priority": "high",+ "absorbed_into": "GOOGLE-TARGET-API"},{"id": "ANDROID-DEVELOPER-VERIFICATION",diff --git a/data/rejection-patterns.json b/data/rejection-patterns.jsonindex 6b29be4..8d237a5 100644--- a/data/rejection-patterns.json+++ b/data/rejection-patterns.json@@ -199,25 +199,53 @@],"fix": "Check permissions dynamically at runtime, show a clear rationale if denied, and handle denials gracefully."},+ {+ "id": "GOOGLE-PHOTO-VIDEO-PERMISSIONS-DECLARATION",+ "platform": "google",+ "guideline": "Photo and Video Permissions",+ "title": "READ_MEDIA_IMAGES or READ_MEDIA_VIDEO declared without the Android photo picker",+ "severity": "high",+ "detection": "Apps targeting API 33 or higher may only request READ_MEDIA_IMAGES and READ_MEDIA_VIDEO when the system photo picker is not sufficient for core functionality, and every app that keeps them must complete the Photo and Video Permissions declaration in Play Console. A manifest that declares them with no photo picker usage in source is the usual rejection shape.",+ "signals": [+ "READ_MEDIA_IMAGES",+ "READ_MEDIA_VIDEO"+ ],+ "counterSignals": [+ "PickVisualMedia",+ "ACTION_PICK_IMAGES",+ "PhotoPicker",+ "photo_picker"+ ],+ "fix": "Use the Android photo picker for one-off selection. Keep broad access only for a core gallery-style feature and complete the Photo and Video Permissions declaration in Play Console. Reference https://support.google.com/googleplay/android-developer/answer/14115180"+ },{"id": "ANDROID-USER-DATA-DISCLOSURE","platform": "google","guideline": "User Data","title": "Missing prominent disclosure for sensitive user data","severity": "critical",- "detection": "Collecting personal user data (e.g. contacts, SMS, device accounts, files) without a prominent disclosure and explicit user consent block.",+ "detection": "A declared permission that reads contacts, SMS, call logs, device accounts, or all files (the surface Play enforces prominent disclosure on) with no disclosure or consent flow in the app.","signals": [- "contacts",- "SMS",- "device accounts",- "files",- "personalData"+ "READ_CONTACTS",+ "WRITE_CONTACTS",+ "READ_SMS",+ "SEND_SMS",+ "RECEIVE_SMS",+ "READ_CALL_LOG",+ "WRITE_CALL_LOG",+ "GET_ACCOUNTS",+ "MANAGE_EXTERNAL_STORAGE"],"counterSignals": ["prominent disclosure","user consent","privacy consent",- "accept policy"+ "accept policy",+ "prominentDisclosure",+ "disclosureDialog",+ "consentDialog",+ "showDisclosure",+ "requestConsent"],"fix": "Provide a prominent in-app disclosure before collecting sensitive personal data, and obtain explicit user consent."},@@ -1205,7 +1233,7 @@"platform": "google","guideline": "Target API level","title": "App does not target the current required API level",- "severity": "high",+ "severity": "critical","detection": "targetSdkVersion in build.gradle is below the current Google Play requirement. From 31 August 2026, new apps and updates must target Android 16, API level 36, or higher. A Play Console extension to 1 November 2026 is available. Wear OS and Automotive OS must target API 35 or higher, TV and XR API 34 or higher.","signals": ["targetSdkVersion",@@ -1213,6 +1241,20 @@],"fix": "Build against the current required Android target API level. From 31 August 2026 that is API 36 or higher. Submissions below the threshold are rejected automatically."},+ {+ "id": "GOOGLE-PLAY-BILLING-V8-REQUIRED",+ "platform": "google",+ "guideline": "Payments",+ "title": "Play Billing Library below version 8",+ "severity": "critical",+ "detection": "A com.android.billingclient:billing dependency with a major version below 8. New apps and updates must use Play Billing Library 8 or later from 31 August 2026 (deprecation ladder), with a Play Console extension available until 1 November 2026. Already published v7 binaries keep transacting until the 2027 all-apps deadline.",+ "signals": [+ "com.android.billingclient:billing:7",+ "com.android.billingclient:billing-ktx:7",+ "com.android.billingclient:billing:6"+ ],+ "fix": "Upgrade to com.android.billingclient:billing 8.x, or request the Play Console extension before 1 November 2026. Reference https://developer.android.com/google/play/billing/deprecation-faq"+ },{"id": "IONIC-4.2-THIN-WRAPPER","platform": "apple",diff --git a/references/README.md b/references/README.mdindex ce84e51..de790d7 100644--- a/references/README.md+++ b/references/README.md@@ -6,12 +6,12 @@ A structured, AI loadable reference tree. Load the rule category and the app typ- [rules/metadata.md](rules/metadata.md). Metadata and store listing. 10 rules- [rules/privacy.md](rules/privacy.md). Privacy and data. 18 rules-- [rules/payments.md](rules/payments.md). Payments, in app purchase, subscriptions. 10 rules+- [rules/payments.md](rules/payments.md). Payments, in app purchase, subscriptions. 11 rules- [rules/design.md](rules/design.md). Design and login. 6 rules- [rules/performance.md](rules/performance.md). Performance and completeness. 29 rules- [rules/entitlements.md](rules/entitlements.md). Entitlements. 1 rules- [rules/safety.md](rules/safety.md). Safety and user generated content. 3 rules-- [rules/android.md](rules/android.md). Google Play specific. 34 rules+- [rules/android.md](rules/android.md). Google Play specific. 35 rules- [rules/export.md](rules/export.md). Export and build. 1 rules## Guidelines by app typediff --git a/references/rules/android.md b/references/rules/android.mdindex 4a34d0e..c7f806d 100644--- a/references/rules/android.md+++ b/references/rules/android.md@@ -1,6 +1,6 @@# Rules. Google Play specific-34 rules in this category. Generated from data/rejection-patterns.json. Each rule names the guideline, the severity, what triggers it, and the fix.+35 rules in this category. Generated from data/rejection-patterns.json. Each rule names the guideline, the severity, what triggers it, and the fix.## ANDROID-HEALTH-PERMISSIONS@@ -25,15 +25,15 @@ grep -rn 'HealthConnectClient\|com.google.android.gms.permission.HealthConnect\|- Platform. google- Guideline or policy. User Data- Severity. critical-- What triggers it. Collecting personal user data (e.g. contacts, SMS, device accounts, files) without a prominent disclosure and explicit user consent block.+- What triggers it. A declared permission that reads contacts, SMS, call logs, device accounts, or all files (the surface Play enforces prominent disclosure on) with no disclosure or consent flow in the app.- How to fix it. Provide a prominent in-app disclosure before collecting sensitive personal data, and obtain explicit user consent.-- Detection signals. contacts, SMS, device accounts, files, personalData-- Present means handled. prominent disclosure, user consent, privacy consent, accept policy+- Detection signals. READ_CONTACTS, WRITE_CONTACTS, READ_SMS, SEND_SMS, RECEIVE_SMS, READ_CALL_LOG, WRITE_CALL_LOG, GET_ACCOUNTS, MANAGE_EXTERNAL_STORAGE+- Present means handled. prominent disclosure, user consent, privacy consent, accept policy, prominentDisclosure, disclosureDialog, consentDialog, showDisclosure, requestConsentHow to detect.```bash-grep -rn 'contacts\|SMS\|device accounts\|files\|personalData' --include='*.kt' --include='*.java' --include='*.xml' . && ! grep -rn 'prominent disclosure\|user consent\|privacy consent\|accept policy' .+grep -rnE 'android\.permission\.(READ_CONTACTS|WRITE_CONTACTS|READ_SMS|SEND_SMS|RECEIVE_SMS|READ_CALL_LOG|WRITE_CALL_LOG|GET_ACCOUNTS|MANAGE_EXTERNAL_STORAGE)' --include='AndroidManifest.xml' . && ! grep -rnE 'prominent disclosure|user consent|privacy consent|accept policy|[Pp]rominentDisclosure|[Dd]isclosureDialog|[Cc]onsentDialog|showDisclosure|requestConsent' .```## GOOGLE-DATASAFETY-MISMATCH@@ -148,6 +148,22 @@ How to detect.grep -rn 'com.google.android.play:age-signals\|AgeSignalsManager\|AgeSignalsRequest' --include='*.gradle' --include='*.kts' --include='*.kt' --include='*.java' . # if present, confirm age signals are never passed to ad, marketing, profiling, or analytics SDKs```+## GOOGLE-TARGET-API++- Title. App does not target the current required API level+- Platform. google+- Guideline or policy. Target API level+- Severity. critical+- What triggers it. targetSdkVersion in build.gradle is below the current Google Play requirement. From 31 August 2026, new apps and updates must target Android 16, API level 36, or higher. A Play Console extension to 1 November 2026 is available. Wear OS and Automotive OS must target API 35 or higher, TV and XR API 34 or higher.+- How to fix it. Build against the current required Android target API level. From 31 August 2026 that is API 36 or higher. Submissions below the threshold are rejected automatically.+- Detection signals. targetSdkVersion, targetSdk++How to detect.++```bash+grep -rnE 'targetSdk(Version)?[ =]+[0-9]+' --include='*.gradle' --include='*.kts' . # must be 36 or higher from 31 Aug 2026+```+## GOOGLE-ORG-REGISTRATION-REQUIRED- Title. Regulated-category app published from a personal developer account@@ -313,6 +329,23 @@ How to detect.grep -rn 'requestPermissions\|checkSelfPermission\|shouldShowRequestPermissionRationale' --include='*.kt' --include='*.java' . && ! grep -rn 'permission explanation\|showPermissionRationale\|explainPermission' .```+## GOOGLE-PHOTO-VIDEO-PERMISSIONS-DECLARATION++- Title. READ_MEDIA_IMAGES or READ_MEDIA_VIDEO declared without the Android photo picker+- Platform. google+- Guideline or policy. Photo and Video Permissions+- Severity. high+- What triggers it. Apps targeting API 33 or higher may only request READ_MEDIA_IMAGES and READ_MEDIA_VIDEO when the system photo picker is not sufficient for core functionality, and every app that keeps them must complete the Photo and Video Permissions declaration in Play Console. A manifest that declares them with no photo picker usage in source is the usual rejection shape.+- How to fix it. Use the Android photo picker for one-off selection. Keep broad access only for a core gallery-style feature and complete the Photo and Video Permissions declaration in Play Console. Reference https://support.google.com/googleplay/android-developer/answer/14115180+- Detection signals. READ_MEDIA_IMAGES, READ_MEDIA_VIDEO+- Present means handled. PickVisualMedia, ACTION_PICK_IMAGES, PhotoPicker, photo_picker++How to detect.++```bash+grep -rnE 'android\.permission\.READ_MEDIA_(IMAGES|VIDEO)' --include='AndroidManifest.xml' . && ! grep -rnE 'PickVisualMedia|ACTION_PICK_IMAGES|PhotoPicker|photo_picker' .+```+## GOOGLE-12-TESTER-RULE- Title. New personal account without the closed test@@ -331,22 +364,6 @@ grep -rn 'requestPermissions\|checkSelfPermission\|shouldShowRequestPermissionRa- What triggers it. Manual check. The store listing, screenshots, and description must match the app's actual functionality.- How to fix it. Make the listing match the build exactly, with screenshots of real in app screens.-## GOOGLE-TARGET-API--- Title. App does not target the current required API level-- Platform. google-- Guideline or policy. Target API level-- Severity. high-- What triggers it. targetSdkVersion in build.gradle is below the current Google Play requirement. From 31 August 2026, new apps and updates must target Android 16, API level 36, or higher. A Play Console extension to 1 November 2026 is available. Wear OS and Automotive OS must target API 35 or higher, TV and XR API 34 or higher.-- How to fix it. Build against the current required Android target API level. From 31 August 2026 that is API 36 or higher. Submissions below the threshold are rejected automatically.-- Detection signals. targetSdkVersion, targetSdk--How to detect.--```bash-grep -rnE 'targetSdk(Version)?[ =]+[0-9]+' --include='*.gradle' --include='*.kts' . # must be 36 or higher from 31 Aug 2026-```-## GOOGLE-PAYMENTS-DONATION-LINK- Title. In-app donation link to a payment page outside Play billingdiff --git a/references/rules/payments.md b/references/rules/payments.mdindex 27f5918..d7344c0 100644--- a/references/rules/payments.md+++ b/references/rules/payments.md@@ -1,6 +1,6 @@# Rules. Payments, in app purchase, subscriptions-10 rules in this category. Generated from data/rejection-patterns.json. Each rule names the guideline, the severity, what triggers it, and the fix.+11 rules in this category. Generated from data/rejection-patterns.json. Each rule names the guideline, the severity, what triggers it, and the fix.## APPLE-3.1.1-EXTERNAL-PAYMENT@@ -16,7 +16,7 @@How to detect.```bash-grep -rn 'Stripe\|PayPalCheckout\|braintree\|razorpay' --include='*.swift' . && ! grep -rn 'StoreKit\|SKProduct\|Product.purchase' --include='*.swift' .+grep -rn 'Stripe\|PayPalCheckout\|braintree\|razorpay' --include='*.swift' --include='pubspec.yaml' --include='package.json' . && ! grep -rnE 'StoreKit|SKProduct|Product.purchase|in_app_purchase|purchases_flutter|flutter_inapp_purchase|react-native-iap|react-native-purchases|expo-iap|cordova-plugin-purchase|@revenuecat/purchases-capacitor' --include='*.swift' --include='pubspec.yaml' --include='package.json' .```## APPLE-GAMBLING-BRAZIL-LICENSE@@ -49,7 +49,23 @@ grep -rni 'gambling\|fixed-odds\|betting' --include='*.swift' . # then verifyHow to detect.```bash-grep -rn 'Stripe\|PayPal\|razorpay' --include='*.kt' --include='*.java' . && ! grep -rn 'BillingClient\|com.android.billingclient' .+grep -rn 'Stripe\|PayPal\|razorpay' --include='*.kt' --include='*.java' --include='pubspec.yaml' --include='package.json' . && ! grep -rnE 'BillingClient|com.android.billingclient|in_app_purchase|purchases_flutter|flutter_inapp_purchase|react-native-iap|react-native-purchases|expo-iap|cordova-plugin-purchase|@revenuecat/purchases-capacitor' .+```++## GOOGLE-PLAY-BILLING-V8-REQUIRED++- Title. Play Billing Library below version 8+- Platform. google+- Guideline or policy. Payments+- Severity. critical+- What triggers it. A com.android.billingclient:billing dependency with a major version below 8. New apps and updates must use Play Billing Library 8 or later from 31 August 2026 (deprecation ladder), with a Play Console extension available until 1 November 2026. Already published v7 binaries keep transacting until the 2027 all-apps deadline.+- How to fix it. Upgrade to com.android.billingclient:billing 8.x, or request the Play Console extension before 1 November 2026. Reference https://developer.android.com/google/play/billing/deprecation-faq+- Detection signals. com.android.billingclient:billing:7, com.android.billingclient:billing-ktx:7, com.android.billingclient:billing:6++How to detect.++```bash+grep -rnoE 'com\.android\.billingclient:billing(-ktx)?:[0-9]+' --include='*.gradle' --include='*.kts' . # major must be 8 or higher from 31 Aug 2026```## APPLE-3.1.2-MISLEADING-PRICING@@ -113,7 +129,7 @@ grep -rni 'lootbox\|loot box\|gacha\|mystery box\|random reward' .How to detect.```bash-grep -rniE 'subscri(be|ption)|auto.renew|membership' --include='*.swift' --include='*.kt' --include='*.java' --include='*.html' --include='*.md' . 2>/dev/null | grep -iE 'call.{0,25}cancel|cancel.{0,25}call|mail.{0,25}cancel|write.{0,25}cancel|cancel.{0,15}(in.person|by.phone|by.mail)'+grep -rniE 'subscri(be|ption)|auto.renew|membership' --include='*.swift' --include='*.kt' --include='*.java' --include='*.html' --include='*.md' . 2>/dev/null | grep -iE '(^|[^a-z])call[^a-z].{0,24}cancel|cancel.{0,25}[^a-z]call([^a-z]|$)|mail.{0,25}cancel|(^|[^a-z])write[^a-z].{0,24}cancel|cancel.{0,15}(in.person|by.phone|by.mail)'```## BOTH-WITHDRAWAL-BUTTON-MISSINGdiff --git a/scripts/validate-privacy-manifest-test.sh b/scripts/validate-privacy-manifest-test.shindex 54387bb..fc865f4 100755--- a/scripts/validate-privacy-manifest-test.sh+++ b/scripts/validate-privacy-manifest-test.sh@@ -64,6 +64,31 @@ printf 'not a plist' > "$T/g.xcprivacy"$V "$T/g.xcprivacy" >/dev/null 2>&1[ $? -eq 2 ] && ok "unreadable manifest exits 2" || bad "unreadable exit code"+# 8 a plist whose root is an array is not a manifest, and must be a finding rather than a crash into a silent pass+printf '<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><array><string>x</string></array></plist>' > "$T/h.xcprivacy"+OUT="$($V "$T/h.xcprivacy" 2>&1)"; RC=$?+echo "$OUT" | grep -q 'APPLE-MANIFEST-UNREADABLE' && [ $RC -eq 2 ] && ok "root array is unreadable, exit 2" || bad "root array (rc=$RC)"++# 9 an empty NSPrivacyAccessedAPITypes array is invalid per TN3181+printf '<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><dict><key>NSPrivacyAccessedAPITypes</key><array/></dict></plist>' > "$T/i.xcprivacy"+OUT="$($V "$T/i.xcprivacy" 2>&1)"+echo "$OUT" | grep -q 'critical.APPLE-MANIFEST-API-TYPES-EMPTY' && ok "empty accessed API array is critical" || bad "empty accessed API array"++# 10 an accessed API with an empty reasons array is invalid per TN3181, and blocks+printf '<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><dict><key>NSPrivacyAccessedAPITypes</key><array><dict><key>NSPrivacyAccessedAPIType</key><string>NSPrivacyAccessedAPICategoryUserDefaults</string><key>NSPrivacyAccessedAPITypeReasons</key><array/></dict></array></dict></plist>' > "$T/j.xcprivacy"+OUT="$($V "$T/j.xcprivacy" 2>&1)"+echo "$OUT" | grep -q 'critical.APPLE-MANIFEST-API-NO-REASON' && ok "empty reason array is critical" || bad "empty reason array"++# 11 a collected type with the wrong value type is reported, never a crash+printf '<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><dict><key>NSPrivacyCollectedDataTypes</key><string>oops</string></dict></plist>' > "$T/k.xcprivacy"+OUT="$($V "$T/k.xcprivacy" 2>&1)"; RC=$?+echo "$OUT" | grep -q 'APPLE-MANIFEST-BAD-VALUE' && [ $RC -eq 1 ] && ok "wrong value type is a finding" || bad "wrong value type (rc=$RC)"++# 12 a NSPrivacyTracking that is not a Boolean is invalid per TN3181+printf '<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><dict><key>NSPrivacyTracking</key><string>yes</string></dict></plist>' > "$T/l.xcprivacy"+OUT="$($V "$T/l.xcprivacy" 2>&1)"+echo "$OUT" | grep -q 'critical.APPLE-MANIFEST-BAD-VALUE' && ok "non-boolean tracking is critical" || bad "non-boolean tracking"+echo ""echo "validate-privacy-manifest-test: $PASS passed, $FAIL failed"[ "$FAIL" -eq 0 ]diff --git a/scripts/validate-privacy-manifest.py b/scripts/validate-privacy-manifest.pyindex 398371a..e42405a 100755--- a/scripts/validate-privacy-manifest.py+++ b/scripts/validate-privacy-manifest.py@@ -9,6 +9,8 @@ from review.Usage: validate-privacy-manifest.py <path-to-PrivacyInfo.xcprivacy> [...]Exit: 0 clean, 1 findings, 2 could not read a file.+Rules: Apple TN3181 (invalid privacy manifest) and the privacy manifest reference. Reason codes per+ category are not validated here; App Store Connect still checks those.Prints SEVERITY<TAB>ID<TAB>message per finding."""import plistlib@@ -31,55 +33,105 @@ REQUIRED_ON_TYPE = ()-def check(path):- out = []- try:- with open(path, "rb") as fh:- d = plistlib.load(fh)- except Exception as exc: # unreadable or malformed- return [("critical", "APPLE-MANIFEST-UNREADABLE",- f"{path}: cannot parse privacy manifest ({exc})")], True+def _rec(path, sev, ident, msg):+ # one record per line, so a newline in a path or value can never split a finding for the bash reader+ return (sev, ident, f"{path}: {msg}".replace("\n", " ").replace("\t", " "))++def _validate(d, path, out):tracking = d.get("NSPrivacyTracking", False)- domains = d.get("NSPrivacyTrackingDomains", []) or []+ if not isinstance(tracking, bool):+ out.append(_rec(path, "critical", "APPLE-MANIFEST-BAD-VALUE",+ "NSPrivacyTracking must be a Boolean (TN3181)."))+ tracking = bool(tracking)+ domains = d.get("NSPrivacyTrackingDomains", [])+ if not isinstance(domains, list) or any(not isinstance(x, str) for x in domains):+ out.append(_rec(path, "critical", "APPLE-MANIFEST-BAD-VALUE",+ "NSPrivacyTrackingDomains must be an array of strings (TN3181)."))+ domains = [x for x in domains if isinstance(x, str)] if isinstance(domains, list) else []- # ITMS-91064. Apple states the converse in the rejection email, but an- # empty domain list alongside NSPrivacyTracking true is what fails.+ # ITMS-91064, both directions are documented as invalid (TN3181 and the privacy manifest reference)if tracking and not domains:- out.append(("critical", "APPLE-ITMS-91064-TRACKING-NO-DOMAINS",- f"{path}: NSPrivacyTracking is true but NSPrivacyTrackingDomains is empty. "- "List every domain the app or its SDKs contact for tracking "- "(an MMP such as AppsFlyer declares its own in the pod's manifest)."))+ out.append(_rec(path, "critical", "APPLE-ITMS-91064-TRACKING-NO-DOMAINS",+ "NSPrivacyTracking is true but NSPrivacyTrackingDomains is empty. "+ "List every domain the app or its SDKs contact for tracking "+ "(an MMP such as AppsFlyer declares its own in the pod's manifest)."))if domains and not tracking:- out.append(("critical", "APPLE-ITMS-91064-DOMAINS-NO-TRACKING",- f"{path}: NSPrivacyTrackingDomains is non-empty but NSPrivacyTracking is false. "- "Set NSPrivacyTracking to true, or remove the domains."))+ out.append(_rec(path, "critical", "APPLE-ITMS-91064-DOMAINS-NO-TRACKING",+ "NSPrivacyTrackingDomains is non-empty but NSPrivacyTracking is false. "+ "Set NSPrivacyTracking to true, or remove the domains."))types = d.get("NSPrivacyCollectedDataTypes", [])+ if not isinstance(types, list):+ out.append(_rec(path, "critical", "APPLE-MANIFEST-BAD-VALUE",+ "NSPrivacyCollectedDataTypes must be an array of dictionaries."))+ types = []for i, entry in enumerate(types):+ if not isinstance(entry, dict):+ out.append(_rec(path, "critical", "APPLE-MANIFEST-BAD-VALUE",+ f"NSPrivacyCollectedDataTypes entry {i} is not a dictionary."))+ continuelabel = entry.get("NSPrivacyCollectedDataType", f"entry {i}")+ # every key is required per collected type (privacy manifest reference), an invalid manifest blocks uploadfor key in REQUIRED_ON_TYPE:if key not in entry:- out.append(("high", "APPLE-MANIFEST-TYPE-INCOMPLETE",- f"{path}: collected data type {label} is missing {key}."))- for purpose in entry.get("NSPrivacyCollectedDataTypePurposes", []):+ out.append(_rec(path, "critical", "APPLE-MANIFEST-TYPE-INCOMPLETE",+ f"collected data type {label} is missing {key}."))+ purposes = entry.get("NSPrivacyCollectedDataTypePurposes", [])+ if not isinstance(purposes, list):+ out.append(_rec(path, "critical", "APPLE-MANIFEST-BAD-VALUE",+ f"{label} NSPrivacyCollectedDataTypePurposes must be an array of strings."))+ purposes = []+ for purpose in purposes:if purpose not in VALID_PURPOSES:- out.append(("high", "APPLE-MANIFEST-BAD-PURPOSE",- f"{path}: {label} declares unknown purpose {purpose}."))- if not entry.get("NSPrivacyCollectedDataTypePurposes", []):- out.append(("high", "APPLE-MANIFEST-NO-PURPOSE",- f"{path}: {label} declares no purposes; at least one is required."))- # Internally contradictory, but not a documented upload rejection, so it surfaces without blocking.+ out.append(_rec(path, "critical", "APPLE-MANIFEST-BAD-PURPOSE",+ f"{label} declares unknown purpose {purpose}."))+ if not purposes:+ out.append(_rec(path, "critical", "APPLE-MANIFEST-NO-PURPOSE",+ f"{label} declares no purposes; at least one is required."))+ # internally contradictory, but not a documented upload rejection, so it surfaces without blockingif entry.get("NSPrivacyCollectedDataTypeTracking") and not tracking:- out.append(("high", "APPLE-MANIFEST-TRACKING-CONTRADICTION",- f"{path}: {label} is marked used for tracking but NSPrivacyTracking is false."))+ out.append(_rec(path, "high", "APPLE-MANIFEST-TRACKING-CONTRADICTION",+ f"{label} is marked used for tracking but NSPrivacyTracking is false."))- for api in d.get("NSPrivacyAccessedAPITypes", []):- if not api.get("NSPrivacyAccessedAPITypeReasons"):- out.append(("high", "APPLE-MANIFEST-API-NO-REASON",- f"{path}: accessed API {api.get('NSPrivacyAccessedAPIType', '?')} "- "declares no reason codes."))+ if "NSPrivacyAccessedAPITypes" in d:+ apis = d["NSPrivacyAccessedAPITypes"]+ if not isinstance(apis, list):+ out.append(_rec(path, "critical", "APPLE-MANIFEST-BAD-VALUE",+ "NSPrivacyAccessedAPITypes must be an array of dictionaries (TN3181)."))+ apis = []+ elif not apis:+ # TN3181. an empty array is invalid, remove the key when no required reason API is used+ out.append(_rec(path, "critical", "APPLE-MANIFEST-API-TYPES-EMPTY",+ "NSPrivacyAccessedAPITypes is an empty array. Remove the key, or list each required reason API the app uses."))+ for i, api in enumerate(apis):+ if not isinstance(api, dict):+ out.append(_rec(path, "critical", "APPLE-MANIFEST-BAD-VALUE",+ f"NSPrivacyAccessedAPITypes entry {i} is not a dictionary."))+ continue+ api_type = api.get("NSPrivacyAccessedAPIType")+ if not isinstance(api_type, str) or not api_type:+ out.append(_rec(path, "critical", "APPLE-MANIFEST-API-TYPE-MISSING",+ f"NSPrivacyAccessedAPITypes entry {i} has no NSPrivacyAccessedAPIType category string (TN3181)."))+ api_type = api_type or "?"+ reasons = api.get("NSPrivacyAccessedAPITypeReasons")+ # TN3181. a missing key or an empty array is an invalid manifest, the upload is rejected by email+ if not isinstance(reasons, list) or not reasons:+ out.append(_rec(path, "critical", "APPLE-MANIFEST-API-NO-REASON",+ f"accessed API {api_type} declares no reason codes."))++def check(path):+ out = []+ try:+ with open(path, "rb") as fh:+ d = plistlib.load(fh)+ if not isinstance(d, dict):+ raise ValueError("root is not a dictionary")+ _validate(d, path, out)+ except Exception as exc: # unreadable, malformed, or an unexpected shape. never a silent pass+ return [_rec(path, "critical", "APPLE-MANIFEST-UNREADABLE",+ f"cannot parse privacy manifest ({exc})")], Truereturn out, False