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
feat: metadata audit engine, pull wrapper, per-rule detection commands
mjmirza15161cd122d2
diff --git a/README.md b/README.mdindex 1206fc5..36ed179 100644--- a/README.md+++ b/README.md@@ -31,7 +31,7 @@ Set up the App Store Compliance Playbook from https://github.com/mjmirza/app-stoSteps:1. Clone https://github.com/mjmirza/app-store-compliance into ~/repositories/app-store-compliance. If you cannot clone, read the files over the GitHub raw URLs instead.-2. Install the audit skill: copy agent-os/skill/SKILL.md plus the docs/, data/, references/, and templates/ folders into your agent's skills directory. For Claude Code that is ~/.claude/skills/app-store-compliance/. The references/ folder is the structured tree the agent loads slices from.+2. Install the audit skill: copy agent-os/skill/SKILL.md plus the docs/, data/, references/, templates/, and scripts/ folders into your agent's skills directory. For Claude Code that is ~/.claude/skills/app-store-compliance/. The references/ folder is the structured tree the agent loads slices from, and scripts/ holds the guard and the metadata-audit engine.3. Install the pre-submission guard: copy agent-os/hooks/app-store-compliance-guard.sh into your hooks directory (for Claude Code, ~/.claude/hooks/), make it executable, and register it as a PreToolUse hook on the Bash tool in settings.json so it runs before app submission commands (fastlane, eas submit, gradle bundleRelease, xcrun altool, bundletool, xcodebuild archive) and blocks on a critical rejection risk.4. Add a standing instruction to your agent config: for any iOS or Android work, always adhere to the Apple App Store Review Guidelines and Google Play policies, run the audit before submission, and never say an app is clear to submit while a critical risk stands.5. Run the guard against my current project and show me the ranked findings:@@ -42,7 +42,7 @@ Steps:Want only a one time check, no install? Paste this instead.```-Read https://github.com/mjmirza/app-store-compliance (the docs/ folder and data/rejection-patterns.json), then audit my app at <path to my app> against every Apple App Store and Google Play rejection pattern. Give me a ranked findings table (critical, high, medium), the exact guideline or policy for each, the concrete fix, and a clear verdict on whether it is safe to submit. Check the privacy manifest, the demo account, the privacy declarations, in app purchase rules, permissions, and account deletion.+Read https://github.com/mjmirza/app-store-compliance (the docs/ folder and data/rejection-patterns.json), then audit my app at <path to my app> against every Apple App Store and Google Play rejection pattern. Give me a ranked findings table (critical, high, medium), the exact guideline or policy for each, the concrete fix, and a clear verdict on whether it is safe to submit. Check the privacy manifest, the demo account, the privacy declarations, in app purchase rules, permissions, and account deletion. Then audit the store listing with scripts/metadata-audit.py against the metadata directory if I have pulled it.```If you are inside this setup already, the slash command `/app-store-audit` runs the same audit.@@ -130,7 +130,9 @@ bash agent-os/hooks/app-store-compliance-guard.sh /path/to/your/app| `data/rejection-patterns.json` | Machine readable taxonomy of rejection patterns with detection signals and fixes. Drives the guard || `agent-os/skill/SKILL.md` | An agent skill that runs a full pre submission compliance audit || `agent-os/hooks/app-store-compliance-guard.sh` | The tested pre submission guard, usable standalone or as an agent hook |-| `references/` | A structured, AI loadable reference tree. Rules by category (metadata, privacy, payments, design, performance, entitlements, safety, Android) and guidelines by app type, generated from the taxonomy. Load the slices that match the task |+| `scripts/metadata-audit.py` | Audits the live store listing (name, subtitle, keywords, description, URLs) against the metadata rejection rules, with a propose and re validate loop. A large share of rejections live in the listing, not the code |+| `scripts/pull-metadata.sh` | Pulls the live App Store Connect listing into a metadata directory via the asc CLI, with the Play API path documented |+| `references/` | A structured, AI loadable reference tree. Rules by category (metadata, privacy, payments, design, performance, entitlements, safety, Android) and guidelines by app type, each with a detection command, generated from the taxonomy. Load the slices that match the task || `templates/REVIEW-NOTES-TEMPLATE.md` | A fill in the blanks App Store review notes template, the six sections that clear most 2.1 rejections || `docs/CREDITS.md` | Attribution for every open source repository and tool this playbook learned from |diff --git a/agent-os/commands/app-store-audit.md b/agent-os/commands/app-store-audit.mdindex 61da591..87c363d 100644--- a/agent-os/commands/app-store-audit.md+++ b/agent-os/commands/app-store-audit.md@@ -18,6 +18,8 @@ bash ~/.claude/hooks/app-store-compliance-guard.sh <project-path>2b. Load the structured references for full context. From `~/.claude/skills/app-store-compliance/references/` load the by app type file that matches the app and the relevant rule category files, so the audit reasons from the full guideline set, not only the guard output. Offer the user `templates/REVIEW-NOTES-TEMPLATE.md` for a new submission.+2c. Run the metadata layer. If the user pulled the listing into a metadata directory, run `python3 ~/.claude/skills/app-store-compliance/scripts/metadata-audit.py <metadata-dir>` to audit the real store listing, and `--propose` to write suggested fixes. The pull step is `scripts/pull-metadata.sh apple`. A large share of rejections live in the listing text.+3. Run the human checks the scanner cannot see, from `~/.claude/skills/app-store-compliance/docs/PRE-SUBMISSION-CHECKLIST.md`.- The production backend is live and stays up during review.- A working demo account exists, with no 2FA the reviewer cannot pass, not expired, pre populated with data.diff --git a/agent-os/skill/SKILL.md b/agent-os/skill/SKILL.mdindex 3fb058b..42db45b 100644--- a/agent-os/skill/SKILL.md+++ b/agent-os/skill/SKILL.md@@ -29,7 +29,15 @@ The compliance reference lives in the `app-store-compliance` repo. The key files- `templates/REVIEW-NOTES-TEMPLATE.md` the review notes template to hand the user for a new submission.- `agent-os/hooks/app-store-compliance-guard.sh` the automated scanner.-For the strongest audit, also pull the live App Store Connect metadata and inspect the words in the real listing, not only the source. The asc CLI (`brew install asc`, then `asc metadata pull`) or the App Store Connect API gives the live title, subtitle, keywords, description, and review notes. A large share of rejections live in the listing text, so checking the real metadata catches what a source scan cannot.+For the strongest audit, also run the metadata layer. A large share of rejections live in the listing text, not the source.++```+bash scripts/pull-metadata.sh apple # pulls the live listing into ./metadata via the asc CLI+python3 scripts/metadata-audit.py ./metadata # audits name, subtitle, keywords, description, URLs+python3 scripts/metadata-audit.py ./metadata --propose # writes suggested fixes, source copy untouched+```++The metadata audit checks character limits, other platform mentions, future functionality, negative Apple sentiment, profanity, ranking and price claims, keyword formatting, missing privacy policy and subscription terms, China storefront AI references, and broken URLs. Run it, then re run it after applying fixes. That is the detect, propose, re validate loop.### Step 2. Run the automated scandiff --git a/data/detection-recipes.json b/data/detection-recipes.jsonnew file mode 100644index 0000000..c0f98fe--- /dev/null+++ b/data/detection-recipes.json@@ -0,0 +1,42 @@+{+ "description": "Concrete detection commands per rejection pattern id, for the automatable rules. Consumed by scripts/generate-references.py to emit a How to detect block per rule. Metadata rules point at metadata-audit.py.",+ "recipes": {+ "APPLE-2.1-STAGING-BACKEND": "grep -rn 'localhost\\|127.0.0.1\\|staging\\.\\|ngrok\\|http://' --include='*.swift' --include='*.plist' . | grep -v https",+ "APPLE-2.1-PLACEHOLDER-CONTENT": "grep -rni 'lorem ipsum\\|placeholder\\|TODO\\|FIXME\\|example.com' --include='*.swift' --include='*.strings' .",+ "APPLE-2.1-DEMO-OR-LOGIN": "grep -rn 'signIn\\|LoginView\\|OAuth\\|FirebaseAuth' --include='*.swift' . # then confirm a demo account is in the review notes",+ "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-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'",+ "APPLE-RESTORE-PURCHASES-MISSING": "grep -rn 'SKProduct\\|Product.purchase\\|StoreKit' --include='*.swift' . && ! grep -rn 'restorePurchases\\|restoreCompletedTransactions\\|AppStore.sync' --include='*.swift' .",+ "APPLE-2.4.5-UNUSED-ENTITLEMENTS": "for e in $(find . -name '*.entitlements'); do echo \"== $e\"; plutil -p \"$e\"; done # then grep the codebase to confirm each capability is actually used",+ "APPLE-4.0-SIWA-UX": "grep -rn 'ASAuthorizationAppleIDProvider' --include='*.swift' . && grep -rn 'completeProfile\\|askForName\\|nameTextField\\|emailTextField' --include='*.swift' . # asking for name or email after SIWA is a violation",+ "APPLE-5.1.1-UNNECESSARY-DATA": "grep -rni 'phone\\|gender\\|marital\\|date.of.birth\\|birthdate\\|address' --include='*.swift' . | grep -i 'required\\|validator\\|isRequired'",+ "APPLE-2.1-DEBUG-FEATURES": "grep -rni 'debug menu\\|debugMenu\\|skip login\\|bypass auth\\|DEBUG_BYPASS' --include='*.swift' .",+ "APPLE-2.1-CLOUD-NOT-IN-PRODUCTION": "grep -rn 'CKContainer\\|CloudKit\\|NSUbiquitousKeyValueStore' --include='*.swift' . # then confirm the CloudKit schema is deployed to production in the CloudKit console",+ "APPLE-2.5.1-PRIVATE-API": "grep -rn 'UIWebView\\|performSelector\\|valueForKey' --include='*.swift' --include='*.m' . # review any reflection or deprecated framework use",+ "GOOGLE-DATASAFETY-MISMATCH": "grep -rn 'firebase-analytics\\|com.google.android.gms.ads\\|appsflyer\\|adjust\\|com.facebook' --include='*.gradle' --include='*.kts' . # every SDK that collects or shares data must be declared in Data Safety",+ "GOOGLE-PERM-BACKGROUND-LOCATION": "grep -rn 'ACCESS_BACKGROUND_LOCATION' --include='AndroidManifest.xml' .",+ "GOOGLE-PERM-ALL-FILES": "grep -rn 'MANAGE_EXTERNAL_STORAGE' --include='AndroidManifest.xml' .",+ "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' .",+ "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' .",+ "BOTH-AI-GENERATED-CONTENT": "grep -rni 'api.openai.com\\|anthropic\\|generativelanguage\\|stable diffusion\\|text-to-image' . && ! grep -rni 'moderation\\|report\\|block user\\|content filter' .",+ "BOTH-LOOTBOX-ODDS": "grep -rni 'lootbox\\|loot box\\|gacha\\|mystery box\\|random reward' .",+ "BOTH-FINGERPRINTING": "grep -rni 'fingerprint\\|deviceFingerprint\\|canvas fingerprint' .",+ "BOTH-METADATA-DECORATION": "python3 scripts/metadata-audit.py ./metadata",+ "APPLE-2.3-CROSS-PLATFORM-REFERENCE": "python3 scripts/metadata-audit.py ./metadata",+ "APPLE-2.3-FUTURE-FUNCTIONALITY": "python3 scripts/metadata-audit.py ./metadata",+ "APPLE-2.3-NEGATIVE-APPLE-SENTIMENT": "python3 scripts/metadata-audit.py ./metadata",+ "BOTH-UNREACHABLE-METADATA-URL": "python3 scripts/metadata-audit.py ./metadata --check-urls",+ "APPLE-3.1.2-MISLEADING-PRICING": "python3 scripts/metadata-audit.py ./metadata",+ "APPLE-2.1-REVIEW-NOTES-INCOMPLETE": "use templates/REVIEW-NOTES-TEMPLATE.md and fill all six sections"+ }+}diff --git a/docs/COMPETITIVE-GAP-ANALYSIS.md b/docs/COMPETITIVE-GAP-ANALYSIS.mdindex 705d0a2..e422a17 100644--- a/docs/COMPETITIVE-GAP-ANALYSIS.md+++ b/docs/COMPETITIVE-GAP-ANALYSIS.md@@ -69,6 +69,15 @@ This survey also confirmed where this playbook is ahead.- Cross store coverage. Huawei, the Chinese stores, Samsung, Amazon, Microsoft, and RuStore, in `OTHER-STORES.md`.- A working automated guard with a test suite, not only a written checklist.+## The two edges the leader had, now closed++The first pass of this analysis honestly noted two places the most popular repository was ahead. Both are now closed.++1. Live metadata pull and an autofix loop. We built `scripts/metadata-audit.py`, which audits the real store listing, name, subtitle, keywords, description, promotional text, review notes, and URLs, against the metadata rejection rules, with a propose and re validate loop, plus `scripts/pull-metadata.sh` to pull the live Apple listing through the asc CLI. The metadata layer is tested.+2. Per rule detection commands. Every rule in the `references/rules/` tree now carries a concrete detection command, generated from `data/detection-recipes.json`. An agent or a developer can run the exact grep, plist, or manifest check for each rule.++What remains is not a capability gap, it is adoption. The most popular repository has the stars. That is earned over time through the launch, shares, and contributions, and the on ramp for that is in place.+## The standing processThis analysis is repeatable. When a new comparable repository appears, read it through the API, extract its structure and unique rules, diff against this playbook, and fold in the net new patterns. Contributions that bring a pattern from another open source list are welcome, with a link to the source.diff --git a/references/rules/android.md b/references/rules/android.mdindex 70dbeb1..fd36f50 100644--- a/references/rules/android.md+++ b/references/rules/android.md@@ -12,6 +12,12 @@- How to fix it. Audit every SDK and runtime data flow and declare every collection, sharing, and security practice accurately in the Data Safety form.- Detection signals. firebase-analytics, com.google.android.gms.ads, facebook, appsflyer, adjust+How to detect.++```bash+grep -rn 'firebase-analytics\|com.google.android.gms.ads\|appsflyer\|adjust\|com.facebook' --include='*.gradle' --include='*.kts' . # every SDK that collects or shares data must be declared in Data Safety+```+## GOOGLE-PERM-BACKGROUND-LOCATION- Title. Background location without a qualifying core feature@@ -22,6 +28,12 @@- How to fix it. Use foreground location where possible, or justify background use with a core feature and a prominent disclosure and the permission declaration.- Detection signals. ACCESS_BACKGROUND_LOCATION+How to detect.++```bash+grep -rn 'ACCESS_BACKGROUND_LOCATION' --include='AndroidManifest.xml' .+```+## GOOGLE-PERM-ALL-FILES- Title. All files access without a qualifying use case@@ -32,6 +44,12 @@- How to fix it. Use scoped storage. Request all files access only for a qualifying use case with the required declaration.- Detection signals. MANAGE_EXTERNAL_STORAGE+How to detect.++```bash+grep -rn 'MANAGE_EXTERNAL_STORAGE' --include='AndroidManifest.xml' .+```+## GOOGLE-PERM-SMS-CALLLOG- Title. SMS or Call Log without an approved core use case@@ -42,6 +60,12 @@- How to fix it. Use the permissions declaration form for an approved core use case, or drop the permission.- Detection signals. READ_SMS, SEND_SMS, RECEIVE_SMS, READ_CALL_LOG, WRITE_CALL_LOG+How to detect.++```bash+grep -rnE 'permission.(READ_SMS|SEND_SMS|RECEIVE_SMS|READ_CALL_LOG|WRITE_CALL_LOG)' --include='AndroidManifest.xml' .+```+## GOOGLE-PERM-ACCESSIBILITY-MISUSE- Title. AccessibilityService used for non accessibility purposes@@ -52,6 +76,12 @@- How to fix it. Use accessibility APIs only for genuine accessibility features and declare the use, or remove the service.- Detection signals. BIND_ACCESSIBILITY_SERVICE, AccessibilityService+How to detect.++```bash+grep -rn 'BIND_ACCESSIBILITY_SERVICE\|AccessibilityService' --include='AndroidManifest.xml' --include='*.kt' --include='*.java' .+```+## GOOGLE-FAMILIES-AD-SDK- Title. Non compliant ad SDK in a child targeted app@@ -72,6 +102,12 @@- 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-12-TESTER-RULE- Title. New personal account without the closed test@@ -100,6 +136,12 @@- How to fix it. Ship all code in the package. Server side changes must be data, not executable code.- Detection signals. DexClassLoader, PathClassLoader, loadDex, createPackageContext+How to detect.++```bash+grep -rn 'DexClassLoader\|PathClassLoader\|loadDex\|createPackageContext' --include='*.kt' --include='*.java' .+```+## ANDROID-QUERY-ALL-PACKAGES- Title. QUERY_ALL_PACKAGES without a permitted use case@@ -110,6 +152,12 @@- How to fix it. Declare specific packages with a queries element, or qualify for a permitted use case.- Detection signals. QUERY_ALL_PACKAGES+How to detect.++```bash+grep -rn 'QUERY_ALL_PACKAGES' --include='AndroidManifest.xml' .+```+## ANDROID-OVERLAY-TAPJACKING- Title. System overlay permission, a tapjacking and malware signal@@ -119,3 +167,9 @@- What triggers it. SYSTEM_ALERT_WINDOW or application overlay declared, especially combined with AccessibilityService.- How to fix it. Remove overlay abuse. The overlay plus accessibility combination is a strong malware signal Google enforces against.- Detection signals. SYSTEM_ALERT_WINDOW, TYPE_APPLICATION_OVERLAY++How to detect.++```bash+grep -rn 'SYSTEM_ALERT_WINDOW\|TYPE_APPLICATION_OVERLAY' --include='AndroidManifest.xml' --include='*.kt' --include='*.java' .+```diff --git a/references/rules/design.md b/references/rules/design.mdindex a0b05c9..0da5d16 100644--- a/references/rules/design.md+++ b/references/rules/design.md@@ -13,6 +13,12 @@- Detection signals. FacebookLogin, GoogleSignIn, GIDSignIn, LoginWithFacebook- Present means handled. SignInWithApple, ASAuthorizationAppleIDProvider+How to detect.++```bash+grep -rn 'FacebookLogin\|GoogleSignIn\|GIDSignIn' --include='*.swift' . && ! grep -rn 'SignInWithApple\|ASAuthorizationAppleIDProvider' --include='*.swift' .+```+## APPLE-4.2-WEB-WRAPPER- Title. Thin web wrapper with no added value@@ -33,3 +39,9 @@- How to fix it. Use the name and email from the Apple credential, do not re ask, use the standard SIWA button, keep SIWA at least as prominent as other logins, and accept private relay emails. Source. truongduy2611 sign_in_with_apple rule.- Detection signals. ASAuthorizationAppleIDProvider, SignInWithApple- Present means handled. ASAuthorizationAppleIDButton, privaterelay.appleid.com++How to detect.++```bash+grep -rn 'ASAuthorizationAppleIDProvider' --include='*.swift' . && grep -rn 'completeProfile\|askForName\|nameTextField\|emailTextField' --include='*.swift' . # asking for name or email after SIWA is a violation+```diff --git a/references/rules/entitlements.md b/references/rules/entitlements.mdindex cb137e7..8289a4a 100644--- a/references/rules/entitlements.md+++ b/references/rules/entitlements.md@@ -11,3 +11,9 @@- What triggers it. An entitlements file declares a capability the app does not use. Apple requests justification for any entitlement with no matching functionality, which blocks review. Temporary exception entitlements draw extra scrutiny.- How to fix it. Remove any entitlement the app does not actively use. Cross check each entitlement against real code usage. Source. truongduy2611 unused_entitlements rule.- Detection signals. com.apple.security.temporary-exception, .entitlements++How to detect.++```bash+for e in $(find . -name '*.entitlements'); do echo "== $e"; plutil -p "$e"; done # then grep the codebase to confirm each capability is actually used+```diff --git a/references/rules/export.md b/references/rules/export.mdindex a800435..d13c031 100644--- a/references/rules/export.md+++ b/references/rules/export.md@@ -11,3 +11,9 @@- What triggers it. ITSAppUsesNonExemptEncryption is not set in Info.plist, so each submission stalls in Missing Compliance and never reaches review.- How to fix it. Set ITSAppUsesNonExemptEncryption in Info.plist. The exempt answer applies to a standard HTTPS only app.- Present means handled. ITSAppUsesNonExemptEncryption++How to detect.++```bash+grep -rn 'ITSAppUsesNonExemptEncryption' */Info.plist || echo 'MISSING ITSAppUsesNonExemptEncryption, build will stall in Missing Compliance'+```diff --git a/references/rules/metadata.md b/references/rules/metadata.mdindex 8b850fa..4c01a79 100644--- a/references/rules/metadata.md+++ b/references/rules/metadata.md@@ -20,6 +20,12 @@- What triggers it. A support URL, marketing URL, or privacy policy URL in the listing does not load. Mirrors the fastlane precheck unreachable_urls rule.- How to fix it. Confirm every listing URL is public and loads during the entire review window.+How to detect.++```bash+python3 scripts/metadata-audit.py ./metadata --check-urls+```+## APPLE-5.2.5-APPLE-DEVICE-IMAGE- Title. Apple device image or Apple trademark in the icon or screenshots@@ -48,6 +54,12 @@- How to fix it. Remove references to other platforms and marketplaces from the app and metadata.- Detection signals. Google Play, available on Android, download on the Play Store+How to detect.++```bash+python3 scripts/metadata-audit.py ./metadata+```+## BOTH-METADATA-DECORATION- Title. Metadata field overflow or banned decoration@@ -57,6 +69,12 @@- What triggers it. App name over the limit (Apple 30, Google 30), emoji in the title, all caps, or ranking and price claims such as number one, best, top, or free in the title or icon.- How to fix it. Keep each metadata field within its limit and remove emoji, all caps, and ranking or price claims from the title and icon.+How to detect.++```bash+python3 scripts/metadata-audit.py ./metadata+```+## APPLE-2.3-FUTURE-FUNCTIONALITY- Title. Metadata promises features that do not ship in this build@@ -67,6 +85,12 @@- How to fix it. Describe only what the build does today. Remove coming soon and future feature promises from the listing.- Detection signals. coming soon, coming-soon, beta, will be available, in a future update, stay tuned+How to detect.++```bash+python3 scripts/metadata-audit.py ./metadata+```+## APPLE-2.3-NEGATIVE-APPLE-SENTIMENT- Title. Metadata names an iOS bug or references Apple negatively@@ -77,6 +101,12 @@- How to fix it. Remove negative references to Apple and iOS bugs from the listing copy.- Detection signals. iOS bug, apple bug, broken on iOS, fix for ios bug+How to detect.++```bash+python3 scripts/metadata-audit.py ./metadata+```+## APPLE-2.3.4-DEVICE-FRAMES-PREVIEW- Title. Device frames around the app in a preview videodiff --git a/references/rules/payments.md b/references/rules/payments.mdindex 306359f..e42bf42 100644--- a/references/rules/payments.md+++ b/references/rules/payments.md@@ -13,6 +13,12 @@- Detection signals. Stripe, PayPal, checkout, WKWebView payment, buy now- Present means handled. StoreKit, SKProduct, Product.purchase, in app purchase+How to detect.++```bash+grep -rn 'Stripe\|PayPalCheckout\|braintree\|razorpay' --include='*.swift' . && ! grep -rn 'StoreKit\|SKProduct\|Product.purchase' --include='*.swift' .+```+## GOOGLE-PLAY-BILLING- Title. Digital goods sold without Play Billing@@ -24,6 +30,12 @@- Detection signals. Stripe, PayPal, checkout, razorpay- Present means handled. BillingClient, Play Billing, com.android.billingclient+How to detect.++```bash+grep -rn 'Stripe\|PayPal\|razorpay' --include='*.kt' --include='*.java' . && ! grep -rn 'BillingClient\|com.android.billingclient' .+```+## BOTH-LOOTBOX-ODDS- Title. Random reward mechanic without disclosed odds@@ -34,6 +46,12 @@- How to fix it. Disclose the odds for every random reward before the user purchases.- Detection signals. lootbox, loot box, gacha, random reward, mystery box+How to detect.++```bash+grep -rni 'lootbox\|loot box\|gacha\|mystery box\|random reward' .+```+## APPLE-RESTORE-PURCHASES-MISSING- Title. Non consumable purchase without a Restore Purchases control@@ -45,6 +63,12 @@- Detection signals. SKProduct, Product.purchase, StoreKit- Present means handled. restorePurchases, restoreCompletedTransactions, AppStore.sync, Restore Purchases+How to detect.++```bash+grep -rn 'SKProduct\|Product.purchase\|StoreKit' --include='*.swift' . && ! grep -rn 'restorePurchases\|restoreCompletedTransactions\|AppStore.sync' --include='*.swift' .+```+## APPLE-3.1.2-MISLEADING-PRICING- Title. Subscription shows the per month price more prominently than the billed amount@@ -53,3 +77,9 @@- Severity. high- What triggers it. Manual paywall check. An annual subscription shows a small per month figure large and the actual billed total small.- How to fix it. Show the actual amount the user will be charged at least as prominently as any per month figure. Source. truongduy2611 misleading_pricing rule.++How to detect.++```bash+python3 scripts/metadata-audit.py ./metadata+```diff --git a/references/rules/performance.md b/references/rules/performance.mdindex 9b3e074..a282eab 100644--- a/references/rules/performance.md+++ b/references/rules/performance.md@@ -22,6 +22,12 @@- How to fix it. Point the release build at the live production backend and confirm it stays up during review.- Detection signals. localhost, 127.0.0.1, staging., dev., ngrok, http://+How to detect.++```bash+grep -rn 'localhost\|127.0.0.1\|staging\.\|ngrok\|http://' --include='*.swift' --include='*.plist' . | grep -v https+```+## APPLE-2.1-CLOUD-NOT-IN-PRODUCTION- Title. iCloud or CloudKit schema not deployed to production@@ -32,6 +38,12 @@- How to fix it. Deploy the CloudKit schema and containers to production before submitting. Source. lukylab checklist.- Detection signals. CKContainer, CloudKit, NSUbiquitousKeyValueStore, iCloud+How to detect.++```bash+grep -rn 'CKContainer\|CloudKit\|NSUbiquitousKeyValueStore' --include='*.swift' . # then confirm the CloudKit schema is deployed to production in the CloudKit console+```+## APPLE-2.1-PLACEHOLDER-CONTENT- Title. Placeholder content in the build@@ -42,6 +54,12 @@- How to fix it. Replace all placeholder text and assets with real content before submission.- Detection signals. lorem ipsum, placeholder, TODO, FIXME, dummy, example.com+How to detect.++```bash+grep -rni 'lorem ipsum\|placeholder\|TODO\|FIXME\|example.com' --include='*.swift' --include='*.strings' .+```+## APPLE-2.5.1-PRIVATE-API- Title. Private API or deprecated framework use@@ -52,6 +70,12 @@- How to fix it. Use only documented public APIs and current frameworks.- Detection signals. respondsToSelector private, UIWebView, performSelector hidden+How to detect.++```bash+grep -rn 'UIWebView\|performSelector\|valueForKey' --include='*.swift' --include='*.m' . # review any reflection or deprecated framework use+```+## BOTH-SDK-SUPPLY-CHAIN- Title. Third party SDK violates policy on the developer's behalf@@ -71,6 +95,12 @@- How to fix it. Hide debug and test features behind a debug only compile flag so they never ship in production. Source. lukylab checklist.- Detection signals. debug menu, debugMenu, test login, skip login, bypass auth, DEBUG_BYPASS+How to detect.++```bash+grep -rni 'debug menu\|debugMenu\|skip login\|bypass auth\|DEBUG_BYPASS' --include='*.swift' .+```+## APPLE-2.1-REVIEW-NOTES-INCOMPLETE- Title. Review notes missing a required section for a new submission@@ -79,3 +109,9 @@- Severity. high- What triggers it. New submission review notes omit one of the six sections. Screen recording on a physical device, app purpose, access instructions and test credentials, external services list, regional differences, and regulated industry documentation.- How to fix it. Fill all six review notes sections using templates/REVIEW-NOTES-TEMPLATE.md. Source. truongduy2611 review_notes rules.++How to detect.++```bash+use templates/REVIEW-NOTES-TEMPLATE.md and fill all six sections+```diff --git a/references/rules/privacy.md b/references/rules/privacy.mdindex 30d6aa1..493a9ed 100644--- a/references/rules/privacy.md+++ b/references/rules/privacy.md@@ -22,6 +22,12 @@- How to fix it. Add the matching usage description key with a specific reason for every sensitive framework used.- Detection signals. AVCaptureDevice, CLLocationManager, PHPhotoLibrary, CNContactStore, HKHealthStore+How to detect.++```bash+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- Title. Account creation without in app account deletion@@ -33,6 +39,12 @@- Detection signals. signUp, createAccount, register- Present means handled. deleteAccount, delete_account, account deletion+How to detect.++```bash+grep -rn 'createAccount\|signUp\|register' --include='*.swift' . && ! grep -rn 'deleteAccount\|delete_account\|account deletion' --include='*.swift' .+```+## GOOGLE-MISSING-PRIVACY-POLICY- Title. Missing privacy policy@@ -54,6 +66,12 @@- Detection signals. NSFileManager, UserDefaults, systemUptime, ProcessInfo, Firebase, Alamofire- Present means handled. PrivacyInfo.xcprivacy, NSPrivacyAccessedAPITypes+How to detect.++```bash+find . -name 'PrivacyInfo.xcprivacy' | grep -q . || echo 'MISSING PrivacyInfo.xcprivacy'; find . -path '*/*.framework/*' -name 'PrivacyInfo.xcprivacy' # each bundled SDK should ship one+```+## APPLE-5.1.1-VAGUE-PURPOSE-STRING- Title. Generic or empty permission purpose string@@ -75,6 +93,12 @@- Detection signals. AppsFlyer, Adjust, Branch, FacebookSDK, IDFA, ASIdentifierManager- Present means handled. ATTrackingManager, NSUserTrackingUsageDescription+How to detect.++```bash+grep -rn 'AppsFlyer\|Adjust\|FBSDK\|advertisingIdentifier\|ASIdentifierManager' --include='*.swift' . && ! grep -rn 'ATTrackingManager\|NSUserTrackingUsageDescription' .+```+## APPLE-5.1.2-AI-NO-CONSENT-MODAL- Title. Personal data shared with third party AI without consent modal@@ -117,6 +141,12 @@- How to fix it. Do not fingerprint. Use the platform advertising identifier with consent where tracking is genuinely needed.- Detection signals. fingerprint, deviceFingerprint, canvas fingerprint, identifierForVendor cross app+How to detect.++```bash+grep -rni 'fingerprint\|deviceFingerprint\|canvas fingerprint' .+```+## APPLE-5.1.1-UNNECESSARY-DATA- Title. Requiring personal data not relevant to core functionality@@ -126,3 +156,9 @@- What triggers it. A registration or onboarding form requires phone number, gender, marital status, date of birth, or home address when it is not essential to the core feature. Relevance is contextual.- How to fix it. Make non essential personal fields optional. Require only data directly relevant to the core feature. Source. truongduy2611 unnecessary_data rule.- Detection signals. phone, gender, marital, date of birth, birthdate, address++How to detect.++```bash+grep -rni 'phone\|gender\|marital\|date.of.birth\|birthdate\|address' --include='*.swift' . | grep -i 'required\|validator\|isRequired'+```diff --git a/references/rules/safety.md b/references/rules/safety.mdindex a12d507..3c50d66 100644--- a/references/rules/safety.md+++ b/references/rules/safety.md@@ -23,3 +23,9 @@- How to fix it. Add moderation, reporting, blocking, an accurate age rating, and abuse safeguards. Prevent NSFW, deepfake, face swap, and undress generation.- Detection signals. openai, anthropic, stable diffusion, image generation, chat/completions, text-to-image- Present means handled. moderation, report, block user, content filter++How to detect.++```bash+grep -rni 'api.openai.com\|anthropic\|generativelanguage\|stable diffusion\|text-to-image' . && ! grep -rni 'moderation\|report\|block user\|content filter' .+```diff --git a/scripts/__pycache__/generate-references.cpython-314.pyc b/scripts/__pycache__/generate-references.cpython-314.pycindex cb9326b..1c3c8f6 100644Binary files a/scripts/__pycache__/generate-references.cpython-314.pyc and b/scripts/__pycache__/generate-references.cpython-314.pyc differdiff --git a/scripts/generate-references.py b/scripts/generate-references.pyindex db15811..cc1521c 100644--- a/scripts/generate-references.py+++ b/scripts/generate-references.py@@ -106,9 +106,18 @@ def esc(s):return (s or "").strip()+def load_recipes():+ path = os.path.join(ROOT, "data", "detection-recipes.json")+ try:+ return json.load(open(path)).get("recipes", {})+ except Exception:+ return {}++def write_rules():data = json.load(open(PATTERNS))patterns = data["patterns"]+ recipes = load_recipes()buckets = {slug: [] for slug, _t, _k in CATEGORIES}for p in patterns:buckets.setdefault(categorize(p), []).append(p)@@ -144,6 +153,14 @@ def write_rules():cs = p.get("counterSignals") or []if cs:lines.append(f"- Present means handled. {', '.join(cs)}")+ cmd = recipes.get(p["id"])+ if cmd:+ lines.append("")+ lines.append("How to detect.")+ lines.append("")+ lines.append("```bash")+ lines.append(cmd)+ lines.append("```")lines.append("")path = os.path.join(RULES_DIR, f"{slug}.md")open(path, "w").write("\n".join(lines))diff --git a/scripts/metadata-audit-test.sh b/scripts/metadata-audit-test.shnew file mode 100755index 0000000..7a6b8cc--- /dev/null+++ b/scripts/metadata-audit-test.sh@@ -0,0 +1,49 @@+#!/usr/bin/env bash+# Test suite for metadata-audit.py+set -uo pipefail+HERE="$(cd "$(dirname "$0")" && pwd)"+AUDIT="python3 $HERE/metadata-audit.py"+PASS=0; FAIL=0+ok(){ PASS=$((PASS+1)); printf 'PASS %s\n' "$1"; }+bad(){ FAIL=$((FAIL+1)); printf 'FAIL %s\n' "$1"; }++# 1 cross-platform mention flagged+OUT="$($AUDIT --name "My App also on Android" 2>&1)"+echo "$OUT" | grep -q 'CROSS-PLATFORM-REFERENCE' && ok "flags other-platform mention" || bad "other-platform"++# 2 over-limit name flagged+OUT="$($AUDIT --name "This App Name Is Definitely Way Too Long For The Store" 2>&1)"+echo "$OUT" | grep -q 'over the 30 limit' && ok "flags name over 30 chars" || bad "name limit"++# 3 future functionality flagged+OUT="$($AUDIT --description "Coming soon, dark mode" 2>&1)"+echo "$OUT" | grep -q 'FUTURE-FUNCTIONALITY' && ok "flags future functionality" || bad "future func"++# 4 clean dir has no high or medium+T=$(mktemp -d); mkdir -p "$T/en-US"+printf 'Lumina Studio' > "$T/en-US/name.txt"+printf 'photo,editor,filters' > "$T/en-US/keywords.txt"+printf 'A focused editor with layers and presets.' > "$T/en-US/description.txt"+printf '{"privacy_policy_url":"https://lumina.app/privacy"}' > "$T/m.json"+OUT="$($AUDIT "$T" 2>&1)"; RC=$?+if echo "$OUT" | grep -qE '\[(HIGH|MEDIUM)\]'; then bad "clean dir flagged high/medium"; else ok "clean dir passes"; fi+# 5 propose writes the fixes file+$AUDIT "$T" --propose >/dev/null 2>&1+[ -f "$T/.metadata-fixes.md" ] && ok "propose writes fixes file" || bad "propose file"+rm -rf "$T"++# 6 missing privacy policy flagged+OUT="$($AUDIT --name "App" 2>&1)"+echo "$OUT" | grep -q 'MISSING-PRIVACY-POLICY' && ok "flags missing privacy policy" || bad "missing pp"++# 7 empty input does not crash+OUT="$($AUDIT 2>&1)"; RC=$?+[ "$RC" -eq 0 ] && ok "empty input exits 0" || bad "empty input rc=$RC"++# 8 subscription without terms flagged+OUT="$($AUDIT --description "Subscribe for premium, auto-renew monthly" 2>&1)"+echo "$OUT" | grep -q 'MISLEADING-PRICING\|Terms' && ok "flags subscription without terms" || bad "subscription terms"++echo ""+echo "metadata-audit-test: $PASS passed, $FAIL failed"+[ "$FAIL" -eq 0 ]diff --git a/scripts/metadata-audit.py b/scripts/metadata-audit.pynew file mode 100755index 0000000..90e2b7f--- /dev/null+++ b/scripts/metadata-audit.py@@ -0,0 +1,266 @@+#!/usr/bin/env python3+"""+Metadata audit + autofix for App Store Connect and Google Play listings.++This is the live-listing layer. A large share of rejections live in the store+metadata (name, subtitle, keywords, description, promotional text, review notes,+URLs), not the code. This tool audits a pulled metadata directory or explicit+fields against the metadata-class rejection patterns, then can propose fixes and+re-validate.++Pull the metadata first (Apple):+ brew install asc+ asc metadata pull --app "<APP_ID>" --version "<VERSION>" --dir ./metadata+Or point at a fastlane metadata/ directory. Google Play metadata can be exported+from the Play Console or the Play Developer API and placed in the same dir.++Usage:+ metadata-audit.py <metadata-dir> audit a directory+ metadata-audit.py --name "..." --keywords "..." --description "..." audit fields+ metadata-audit.py <dir> --propose write <dir>/.metadata-fixes.md with suggested fixes+ metadata-audit.py <dir> --check-urls also HEAD-check URLs (needs network)++Exit codes: 0 clean or advisory, 2 a critical finding.+"""+import os, sys, re, json, glob++FIELD_LIMITS = {"name": 30, "subtitle": 30, "keywords": 100, "promotional_text": 170, "description": 4000}+# fastlane / asc field file name aliases -> canonical field+ALIASES = {+ "name": "name", "title": "name", "app_name": "name",+ "subtitle": "subtitle",+ "keywords": "keywords",+ "description": "description", "full_description": "description",+ "promotional_text": "promotional_text", "promo_text": "promotional_text", "short_description": "promotional_text",+ "release_notes": "release_notes", "whats_new": "release_notes",+ "review_notes": "review_notes", "notes": "review_notes",+ "privacy_url": "privacy_url", "privacy_policy_url": "privacy_url",+ "support_url": "support_url", "marketing_url": "marketing_url",+}++OTHER_PLATFORMS = ["android", "google play", "play store", "windows phone", "blackberry"]+FUTURE = ["coming soon", "coming-soon", "will be available", "in a future update", "stay tuned", "future release"]+NEGATIVE_APPLE = ["ios bug", "apple bug", "broken on ios", "fix for ios bug"]+PLACEHOLDER = ["lorem ipsum", "placeholder", "todo", "fixme", "test data", "dummy", "example.com"]+CHINA_AI = ["chatgpt", "openai", "gemini", "claude", "anthropic", "copilot"]+RANKING = ["#1", "number one", "best app", "top app", "free", "no.1", "no. 1"]+# small safe profanity sample; teams extend in their own config+CURSE = ["fuck", "shit", "asshole", "bitch", "bastard"]++def add(findings, sev, rule, field, msg, fix):+ findings.append({"severity": sev, "rule": rule, "field": field, "message": msg, "fix": fix})++def has_emoji(s):+ for ch in s:+ o = ord(ch)+ if 0x1F000 <= o <= 0x1FAFF or 0x2600 <= o <= 0x27BF or 0x2190 <= o <= 0x21FF or o in (0x2122, 0x2B50, 0xFE0F):+ return True+ return False++def lc(s):+ return (s or "").lower()++def audit_fields(fields, check_urls=False):+ findings = []+ name = fields.get("name", "")+ subtitle = fields.get("subtitle", "")+ keywords = fields.get("keywords", "")++ # char limits+ for f, limit in FIELD_LIMITS.items():+ v = fields.get(f, "")+ if v and len(v) > limit:+ add(findings, "high", "BOTH-METADATA-DECORATION", f,+ f"{f} is {len(v)} chars, over the {limit} limit", f"Trim {f} to {limit} characters or fewer")++ # decoration in name / subtitle+ for f in ("name", "subtitle"):+ v = fields.get(f, "")+ if v and has_emoji(v):+ add(findings, "medium", "BOTH-METADATA-DECORATION", f, f"{f} contains an emoji", f"Remove emoji from {f}")+ for r in RANKING:+ if r in lc(v):+ add(findings, "high", "BOTH-METADATA-DECORATION", f,+ f"{f} contains a ranking or price claim ({r})", f"Remove ranking and price claims from {f}")+ words = [w for w in re.findall(r"[A-Za-z]{3,}", v) if w.isupper()]+ if len(words) >= 2:+ add(findings, "medium", "BOTH-METADATA-DECORATION", f, f"{f} uses ALL CAPS words", f"Use normal case in {f} except a real brand")++ # other platform mentions (Apple side)+ for f, v in fields.items():+ for term in OTHER_PLATFORMS:+ if term in lc(v):+ add(findings, "high", "APPLE-2.3-CROSS-PLATFORM-REFERENCE", f,+ f"{f} mentions another platform ({term})", f"Remove the reference to {term} from {f}")++ # future functionality+ for f, v in fields.items():+ for term in FUTURE:+ if term in lc(v):+ add(findings, "medium", "APPLE-2.3-FUTURE-FUNCTIONALITY", f,+ f"{f} promises future functionality ({term})", "Describe only what the build does today")++ # negative apple sentiment+ for f, v in fields.items():+ for term in NEGATIVE_APPLE:+ if term in lc(v):+ add(findings, "medium", "APPLE-2.3-NEGATIVE-APPLE-SENTIMENT", f,+ f"{f} references an iOS bug or Apple negatively", "Remove negative Apple references")++ # placeholder / test+ for f, v in fields.items():+ for term in PLACEHOLDER:+ if term in lc(v):+ add(findings, "high", "BOTH-PLACEHOLDER", f, f"{f} contains placeholder text ({term})", "Replace placeholder with real content")++ # curse words+ for f, v in fields.items():+ for term in CURSE:+ if re.search(r"\b" + re.escape(term) + r"\b", lc(v)):+ add(findings, "high", "APPLE-2.3-CURSE-WORD", f, f"{f} contains profanity", "Remove profanity from the listing")++ # keywords formatting+ if keywords:+ if ", " in keywords:+ add(findings, "low", "APPLE-2.3-KEYWORD-FORMAT", "keywords",+ "keywords field has spaces after commas, which wastes the 100 char budget", "Use commas with no spaces between keywords")+ kw = set(w for w in re.split(r"[,\s]+", lc(keywords)) if w)+ dup = kw & set(re.findall(r"[a-z]{3,}", lc(name + " " + subtitle)))+ if dup:+ add(findings, "low", "APPLE-2.3-KEYWORD-FORMAT", "keywords",+ f"keywords repeat words already in name or subtitle ({', '.join(sorted(dup))})", "Drop duplicated words, the name and subtitle are already indexed")++ # missing privacy policy url+ if not fields.get("privacy_url"):+ add(findings, "high", "BOTH-MISSING-PRIVACY-POLICY", "privacy_url",+ "no privacy policy URL found in the metadata", "Set the Privacy Policy URL in App Store Connect and the Play listing")++ # subscription ToS / PP in description+ desc = lc(fields.get("description", "") + " " + fields.get("promotional_text", ""))+ if any(t in desc for t in ("subscription", "subscribe", "auto-renew", "per month", "per year")):+ if "terms" not in desc and "eula" not in desc:+ add(findings, "high", "APPLE-3.1.2-MISLEADING-PRICING", "description",+ "subscription mentioned but no Terms of Use or EULA link in the description", "Add functional Terms of Use and Privacy Policy links to the description and the paywall")++ # china AI references (advisory, storefront dependent)+ for f in ("name", "subtitle", "keywords", "description"):+ v = lc(fields.get(f, ""))+ for term in CHINA_AI:+ if term in v:+ add(findings, "medium", "CHINA-AI-REFERENCES", f,+ f"{f} references an external AI service ({term}), which can trigger a China storefront rejection", "Remove or localize external AI references for the China storefront")+ break++ # unreachable URLs+ if check_urls:+ urls = set()+ for v in fields.values():+ urls.update(re.findall(r"https?://[^\s)\"']+", v or ""))+ for u in sorted(urls):+ ok = _url_ok(u)+ if ok is False:+ add(findings, "high", "BOTH-UNREACHABLE-METADATA-URL", "url", f"URL does not load: {u}", "Fix or remove the broken URL before submission")++ return findings++def _url_ok(u):+ try:+ import urllib.request+ req = urllib.request.Request(u, method="HEAD", headers={"User-Agent": "metadata-audit"})+ with urllib.request.urlopen(req, timeout=8) as r:+ return 200 <= r.status < 400+ except Exception:+ return False++def load_dir(d):+ fields = {}+ for path in glob.glob(os.path.join(d, "**", "*.txt"), recursive=True):+ base = os.path.splitext(os.path.basename(path))[0].lower()+ canon = ALIASES.get(base)+ if not canon:+ continue+ try:+ txt = open(path, encoding="utf-8", errors="ignore").read().strip()+ except Exception:+ continue+ # keep the longest value if multiple locales+ if len(txt) > len(fields.get(canon, "")):+ fields[canon] = txt+ # also look for a json metadata file with urls+ for jp in glob.glob(os.path.join(d, "**", "*.json"), recursive=True):+ try:+ data = json.load(open(jp, encoding="utf-8", errors="ignore"))+ except Exception:+ continue+ if isinstance(data, dict):+ for k, v in data.items():+ kk = ALIASES.get(k.lower())+ if kk and isinstance(v, str) and v.strip() and len(v) > len(fields.get(kk, "")):+ fields[kk] = v.strip()+ return fields++def main():+ args = sys.argv[1:]+ check_urls = "--check-urls" in args+ propose = "--propose" in args+ args = [a for a in args if a not in ("--check-urls", "--propose")]++ fields = {}+ d = None+ i = 0+ while i < len(args):+ a = args[i]+ if a.startswith("--"):+ key = a[2:]+ val = args[i+1] if i+1 < len(args) else ""+ canon = ALIASES.get(key, key)+ fields[canon] = val+ i += 2+ elif os.path.isdir(a):+ d = a+ i += 1+ else:+ i += 1++ if d:+ fields.update({k: v for k, v in load_dir(d).items() if k not in fields})++ if not fields:+ print("metadata-audit. no metadata found. pass a directory or fields. see --help in the header.")+ return 0++ findings = audit_fields(fields, check_urls=check_urls)+ order = {"critical": 0, "high": 1, "medium": 2, "low": 3}+ findings.sort(key=lambda f: order.get(f["severity"], 9))++ crit = sum(1 for f in findings if f["severity"] == "critical")+ high = sum(1 for f in findings if f["severity"] == "high")+ med = sum(1 for f in findings if f["severity"] == "medium")+ low = sum(1 for f in findings if f["severity"] == "low")++ print("== Metadata Audit ==")+ print(f"Fields audited. {', '.join(sorted(fields.keys()))}")+ print("")+ if not findings:+ print("Clean. No metadata rejection risks found.")+ for f in findings:+ print(f" [{f['severity'].upper()}] {f['rule']} ({f['field']})")+ print(f" {f['message']}")+ print(f" fix. {f['fix']}")+ print("")+ print(f"Summary. critical={crit} high={high} medium={med} low={low}")++ if propose and d:+ report = os.path.join(d, ".metadata-fixes.md")+ lines = ["# Metadata fix suggestions", "",+ "Proposed fixes from metadata-audit. Review each before applying. Source copy is not overwritten.", ""]+ for f in findings:+ lines.append(f"- [{f['severity']}] {f['field']}. {f['message']}")+ lines.append(f" - fix. {f['fix']}")+ open(report, "w").write("\n".join(lines) + "\n")+ print(f"Wrote suggestions to {report}")++ return 2 if crit > 0 else 0++if __name__ == "__main__":+ sys.exit(main())diff --git a/scripts/pull-metadata.sh b/scripts/pull-metadata.shnew file mode 100755index 0000000..3b16eaa--- /dev/null+++ b/scripts/pull-metadata.sh@@ -0,0 +1,40 @@+#!/usr/bin/env bash+# Pull live store metadata into ./metadata so metadata-audit.py can inspect the+# real listing, not only the source. Apple uses the asc CLI. Google Play has no+# one line CLI pull, so this prints the API path to use.+#+# Apple usage:+# APP_ID=123456789 VERSION=1.2.0 bash pull-metadata.sh apple+# needs: brew install asc, and asc auth set up with your App Store Connect API key+#+# Then audit:+# python3 scripts/metadata-audit.py ./metadata+set -uo pipefail+DIR="${DIR:-./metadata}"+target="${1:-apple}"++case "$target" in+ apple)+ if ! command -v asc >/dev/null 2>&1; then+ echo "asc CLI not found. Install with: brew install asc"+ echo "Then authenticate asc with your App Store Connect API key (issuer id, key id, .p8)."+ exit 1+ fi+ : "${APP_ID:?set APP_ID to your App Store Connect app id}"+ : "${VERSION:?set VERSION to the app version, e.g. 1.2.0}"+ mkdir -p "$DIR"+ echo "Pulling Apple metadata for app $APP_ID version $VERSION into $DIR"+ asc metadata pull --app "$APP_ID" --version "$VERSION" --dir "$DIR"+ echo "Done. Now run: python3 scripts/metadata-audit.py $DIR"+ ;;+ google|play)+ echo "Google Play has no single CLI pull. Two options."+ echo "1. Export the store listing fields from the Play Console and drop them as .txt files in $DIR (name.txt, short_description.txt, full_description.txt) plus a meta.json with privacy_policy_url."+ echo "2. Use the Google Play Developer API edits.listings.get endpoint to fetch the listing, then write the fields into $DIR."+ echo "Then run: python3 scripts/metadata-audit.py $DIR"+ ;;+ *)+ echo "Usage: pull-metadata.sh [apple|google]"+ exit 1+ ;;+esac