storebound scan: offline rejection-risk scan of the project itself

Detects the stack (native iOS / Android, React Native, Expo, Capacitor, Cordova,
Flutter, Unity, Godot) and the SDKs from a maintained table with versions,
file:line and each vendor's disclosure page, then reports App Store and Google
Play rejection risks with guideline, evidence, fix, severity and skill: 2.1(a)
demo account and placeholder text, 5.1.1(v) account deletion, 4.8 login
services, 3.1.1 restore and outside payments, 3.1.2 subscription info, 5.1.2(i)
ATT, purpose strings, privacy link, privacy manifest, 2.3.10, 2.3.7, 2.3.8, 4.2
web wrappers, 2.5.1, 2.5.5, ATS, export compliance, 1.3 kids ads, review
prompts, privacy labels vs SDKs; Play target SDK 36, delete-account URL, App
access, foreground services, exact alarms, QUERY_ALL_PACKAGES, SMS / call log,
com.example package name.

Proposes Data safety / App Privacy / ATT / privacy manifest answers (detected
file:line or ask owner) as a diff against the config; --write adds only the
detected ones. scan.ignore records owner-accepted findings. MCP tool scan
(read-only), validate includes open findings, desktop Checks tab shows them.
Fixtures for iOS, Android, Capacitor, Unity, Flutter, clean and teaser.
This commit is contained in:
CRTkafa 2026-10-11 15:20:55 +00:00
parent 02d90de77a
commit 00a38cd305
109 changed files with 3103 additions and 31 deletions

5
tests/fixtures/scan/android/README.md vendored Normal file
View file

@ -0,0 +1,5 @@
# android fixture
A made-up Kotlin budget app with planted Google Play problems for `storebound scan` tests: targetSdk 34, the
reserved com.example package name, QUERY_ALL_PACKAGES, READ_SMS, USE_EXACT_ALARM, a foreground service without a
type, sign-up without a delete-account URL, and AdMob not in the Data safety answers. Not a buildable project.

View file

@ -0,0 +1,23 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
}
android {
namespace = "com.example.budget"
compileSdk = 34
defaultConfig {
applicationId = "com.example.budget"
minSdk = 24
targetSdk = 34
versionCode = 12
versionName = "1.4.0"
}
}
dependencies {
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.auth)
implementation(libs.play.services.ads)
implementation("androidx.work:work-runtime-ktx:2.9.1")
}

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application android:label="Budget" android:icon="@mipmap/ic_launcher">
<activity android:name=".MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".SyncService" android:exported="false" />
</application>
</manifest>

View file

@ -0,0 +1,9 @@
package com.example.budget
import com.google.firebase.auth.FirebaseAuth
class AuthRepository(private val auth: FirebaseAuth = FirebaseAuth.getInstance()) {
fun signUp(email: String, password: String) = auth.createUserWithEmailAndPassword(email, password)
fun signIn(email: String, password: String) = auth.signInWithEmailAndPassword(email, password)
fun deleteAccount() = auth.currentUser?.delete()
}

View file

@ -0,0 +1,8 @@
[versions]
ads = "23.3.0"
firebaseBom = "33.4.0"
[libraries]
play-services-ads = { module = "com.google.android.gms:play-services-ads", version.ref = "ads" }
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebaseBom" }
firebase-auth = { group = "com.google.firebase", name = "firebase-auth" }

View file

@ -0,0 +1,24 @@
// Fixture config (made up, example.com placeholders only).
export default {
app: {
name: 'Budget',
profile: 'app',
privacyPolicyUrl: 'https://example.com/privacy',
supportUrl: 'https://example.com/support',
website: 'https://example.com',
contactEmail: 'support@example.com',
},
accounts: { enabled: true, inApp: 'Settings > Account > Delete account' },
reviewAccess: { signInRequired: false },
languages: [{ id: 'en', play: 'en-US' }],
play: { packageName: 'com.example.budget' },
dataSafety: {
collectsData: true,
encryptedInTransit: true,
deletionRequest: true,
accountCreation: ['PSL_ACM_USER_ID_PASSWORD'],
data: {
PSL_EMAIL: { shared: false, collect: ['account'] },
},
},
};

View file

@ -0,0 +1,5 @@
# capacitor fixture
A made-up Capacitor app that loads a remote website as its start page (4.2), uses the camera plugin without
NSCameraUsageDescription, AdMob without App Tracking Transparency, and targets API 35. No storebound config: the scan
works from the project files only. Not a buildable project.

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<application android:label="Shopfront" />
</manifest>

View file

@ -0,0 +1,5 @@
ext {
minSdkVersion = 23
compileSdkVersion = 35
targetSdkVersion = 35
}

View file

@ -0,0 +1,9 @@
{
"appId": "com.example.shopfront",
"appName": "Shopfront",
"webDir": "dist",
"server": {
"url": "https://shop.example.com",
"cleartext": false
}
}

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>Shopfront</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
</dict>
</plist>

View file

@ -0,0 +1,11 @@
{
"name": "shopfront-app",
"private": true,
"dependencies": {
"@capacitor/android": "7.0.0",
"@capacitor/camera": "7.0.0",
"@capacitor/core": "7.0.0",
"@capacitor/ios": "7.0.0",
"@capacitor-community/admob": "7.0.0"
}
}

View file

@ -0,0 +1,5 @@
import { Camera } from '@capacitor/camera';
export async function scanBarcode() {
return Camera.getPhoto({ quality: 80 });
}

View file

@ -0,0 +1,15 @@
// !$*UTF8*$!
{
archiveVersion = 1;
objects = {
B1B2C3D4E5F6000000000002 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = Clean/Clean.entitlements;
INFOPLIST_FILE = Clean/Info.plist;
INFOPLIST_KEY_NSCameraUsageDescription = "Scan a paper note with the camera to turn it into text.";
PRODUCT_BUNDLE_IDENTIFIER = org.example.cleannotes;
};
};
};
}

View file

@ -0,0 +1,11 @@
import SwiftUI
struct AccountView: View {
let api: AccountApi
var body: some View {
List {
Link("Privacy policy", destination: URL(string: "https://example.com/privacy")!)
Button("Delete account", role: .destructive) { Task { try await api.deleteAccount() } }
}
}
}

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
</dict>
</plist>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>Clean Notes</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>NSUserTrackingUsageDescription</key>
<string>Your data is used to show ads that fit your interests, only if you allow it.</string>
</dict>
</plist>

View file

@ -0,0 +1,16 @@
import AuthenticationServices
import GoogleSignIn
import SwiftUI
struct LoginView: View {
var body: some View {
VStack {
SignInWithAppleButton(.signIn) { request in
request.requestedScopes = [.fullName, .email]
} onCompletion: { _ in }
Button("Continue with Google") {
GIDSignIn.sharedInstance.signIn(withPresenting: rootViewController()) { _, _ in }
}
}
}
}

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTracking</key>
<true/>
<key>NSPrivacyTrackingDomains</key>
<array>
<string>ads.example.com</string>
</array>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict>
</array>
</dict>
</plist>

View file

@ -0,0 +1,14 @@
import StoreKit
import SwiftUI
struct StoreView: View {
@State private var manage = false
var body: some View {
VStack {
Button("Restore Purchases") { Task { try? await AppStore.sync() } }
Button("Manage subscription") { manage = true }
Link("Terms of Use", destination: URL(string: "https://example.com/terms")!)
}
.manageSubscriptionsSheet(isPresented: $manage)
}
}

View file

@ -0,0 +1,8 @@
import AppTrackingTransparency
import AVFoundation
enum Tracking {
static func ask() { ATTrackingManager.requestTrackingAuthorization { _ in } }
static func camera() -> AVCaptureDevice? { AVCaptureDevice.default(for: .video) }
static var lastOpen: Date? { UserDefaults.standard.object(forKey: "lastOpen") as? Date }
}

View file

@ -0,0 +1,9 @@
PODS:
- Google-Mobile-Ads-SDK (11.10.0)
- GoogleSignIn (7.1.0)
DEPENDENCIES:
- Google-Mobile-Ads-SDK
- GoogleSignIn
COCOAPODS: 1.15.2

7
tests/fixtures/scan/clean/README.md vendored Normal file
View file

@ -0,0 +1,7 @@
# clean fixture
A made-up iOS + Android notes app that does everything right, so `storebound scan` must report no open finding:
Sign in with Apple next to Google, in-app account deletion, Restore Purchases and subscription management, the ATT
string and prompt, specific purpose strings, a privacy manifest, export compliance answered, targetSdk 36, and Data
safety answers that cover every detected SDK. Tests set the App Review demo account through REVIEW_DEMO_USER /
REVIEW_DEMO_PASSWORD. Not a buildable project.

View file

@ -0,0 +1,15 @@
android {
namespace = "org.example.cleannotes"
compileSdk = 36
defaultConfig {
applicationId = "org.example.cleannotes"
minSdk = 24
targetSdk = 36
}
}
dependencies {
implementation("com.google.android.gms:play-services-ads:23.3.0")
implementation("com.android.billingclient:billing-ktx:7.1.1")
implementation("com.android.billingclient:billing:7.1.1")
}

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<application android:label="Clean Notes" />
</manifest>

View file

@ -0,0 +1,28 @@
# Clean Notes · App Store listing copy
## en-US · English (U.S.)
### subtitle
```
Notes that stay tidy
```
### promotionalText
```
Scan paper notes into text.
```
### keywords
```
notes,scan,ocr,journal,memo
```
### description
```
Clean Notes keeps your notes tidy and turns paper notes into text.
Clean Notes Plus unlocks unlimited scans for 2.99 USD per month. The subscription renews automatically unless cancelled at least 24 hours before the end of the period; manage or cancel it in your account settings.
Terms of Use: https://example.com/terms
Privacy policy: https://example.com/privacy
```

View file

@ -0,0 +1,14 @@
# Clean Notes · Google Play listing copy
## English
<!-- play: en-US -->
### short
```
Notes that stay tidy, and paper notes turned into text.
```
### full
```
Clean Notes keeps your notes tidy and turns paper notes into text.
```

View file

@ -0,0 +1,45 @@
// Fixture config (made up, example.com placeholders only).
export default {
app: {
name: 'Clean Notes',
profile: 'subscription-app',
privacyPolicyUrl: 'https://example.com/privacy',
termsUrl: 'https://example.com/terms',
supportUrl: 'https://example.com/support',
website: 'https://example.com',
contactEmail: 'support@example.com',
},
accounts: { enabled: true, deletionUrl: 'https://example.com/delete-account', inApp: 'Settings > Account > Delete account' },
reviewAccess: { signInRequired: true, instructions: 'Sign in with the demo account.' },
languages: [{ id: 'en', play: 'en-US', apple: 'en-US' }],
play: { packageName: 'org.example.cleannotes' },
apple: { bundleId: 'org.example.cleannotes', usesNonExemptEncryption: false },
appPrivacy: { tracking: true, trackingDomains: ['ads.example.com'] },
products: [
{ id: 'org.example.cleannotes.themes', type: 'non_consumable', usd: 1.99, listings: { en: { title: 'Themes', description: 'Every color theme' } } },
],
subscriptions: [{
name: 'Plus',
listings: { en: { name: 'Clean Notes Plus' } },
subscriptions: [
{ id: 'org.example.cleannotes.plus_monthly', period: 'P1M', level: 1, usd: 2.99, listings: { en: { title: 'Plus', description: 'Unlimited scans' } } },
],
}],
dataSafety: {
collectsData: true,
encryptedInTransit: true,
deletionRequest: true,
accountCreation: ['PSL_ACM_OAUTH'],
data: {
PSL_NAME: { shared: false, collect: ['account'] },
PSL_EMAIL: { shared: false, collect: ['account', 'functionality'] },
PSL_USER_ACCOUNT: { shared: false, collect: ['account', 'functionality'] },
PSL_DEVICE_ID: { shared: true, collect: ['advertising', 'analytics', 'fraud'], share: ['advertising'] },
PSL_APPROX_LOCATION: { shared: true, collect: ['advertising', 'analytics', 'fraud'], share: ['advertising'] },
PSL_USER_INTERACTION: { shared: true, collect: ['advertising', 'analytics'], share: ['advertising'] },
PSL_PERFORMANCE_DIAGNOSTICS: { shared: false, collect: ['analytics'] },
PSL_PURCHASE_HISTORY: { shared: false, collect: ['functionality'] },
},
},
scan: { ignore: [] },
};

6
tests/fixtures/scan/flutter/README.md vendored Normal file
View file

@ -0,0 +1,6 @@
# flutter fixture
A made-up Flutter subscription app: Google Sign-In without Sign in with Apple, sign-up without deletion, a
subscription without Terms of Use (config and listing) or renewal wording, app_tracking_transparency without
NSUserTrackingUsageDescription, a location foreground service without FOREGROUND_SERVICE_LOCATION, and a targetSdk
that comes from the Flutter SDK. Not a buildable project.

View file

@ -0,0 +1,9 @@
android {
namespace "com.example.habitcoach"
compileSdk flutter.compileSdkVersion
defaultConfig {
applicationId "com.example.habitcoach"
minSdk flutter.minSdkVersion
targetSdk flutter.targetSdkVersion
}
}

View file

@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application android:label="Habit Coach">
<service android:name=".WalkTracker" android:foregroundServiceType="location" android:exported="false" />
</application>
</manifest>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>Habit Coach</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
</dict>
</plist>

View file

@ -0,0 +1,14 @@
import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:app_tracking_transparency/app_tracking_transparency.dart';
Future<void> signInWithGoogle() async {
final account = await GoogleSignIn().signIn();
final auth = await account!.authentication;
await FirebaseAuth.instance.signInWithCredential(GoogleAuthProvider.credential(idToken: auth.idToken));
}
Future<void> signUp(String email, String password) =>
FirebaseAuth.instance.createUserWithEmailAndPassword(email: email, password: password);
Future<void> askTracking() => AppTrackingTransparency.requestTrackingAuthorization();

View file

@ -0,0 +1,19 @@
packages:
firebase_auth:
dependency: "direct main"
description:
name: firebase_auth
source: hosted
version: "5.3.1"
google_mobile_ads:
dependency: "direct main"
description:
name: google_mobile_ads
source: hosted
version: "5.1.0"
google_sign_in:
dependency: "direct main"
description:
name: google_sign_in
source: hosted
version: "6.2.1"

View file

@ -0,0 +1,19 @@
name: habit_coach
description: A made-up habit app for storebound tests.
version: 2.1.0+21
environment:
sdk: ">=3.5.0 <4.0.0"
dependencies:
flutter:
sdk: flutter
firebase_auth: ^5.3.0
google_sign_in: ^6.2.1
purchases_flutter: ^8.1.0
google_mobile_ads: ^5.1.0
app_tracking_transparency: ^2.0.6
dev_dependencies:
flutter_test:
sdk: flutter

View file

@ -0,0 +1,23 @@
# Habit Coach · App Store listing copy
## en-US · English (U.S.)
### subtitle
```
Small habits, every day
```
### promotionalText
```
Build a streak that sticks.
```
### keywords
```
habit,streak,routine,goals,tracker
```
### description
```
Habit Coach helps you build small daily habits with reminders and streaks. Coach Plus adds unlimited habits.
```

View file

@ -0,0 +1,22 @@
// Fixture config (made up, example.com placeholders only).
export default {
app: {
name: 'Habit Coach',
profile: 'subscription-app',
privacyPolicyUrl: 'https://example.com/privacy',
supportUrl: 'https://example.com/support',
website: 'https://example.com',
contactEmail: 'support@example.com',
},
reviewAccess: { signInRequired: false },
languages: [{ id: 'en', play: 'en-US', apple: 'en-US' }],
play: { packageName: 'com.example.habitcoach' },
apple: { bundleId: 'com.example.habitcoach', usesNonExemptEncryption: false },
subscriptions: [{
name: 'Coach Plus',
listings: { en: { name: 'Coach Plus' } },
subscriptions: [
{ id: 'com.example.habitcoach.plus_monthly', period: 'P1M', level: 1, usd: 4.99, listings: { en: { title: 'Coach Plus', description: 'Unlimited habits' } } },
],
}],
};

View file

@ -0,0 +1,17 @@
// !$*UTF8*$!
{
archiveVersion = 1;
objects = {
A1B2C3D4E5F6000000000001 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/google/GoogleSignIn-iOS";
};
A1B2C3D4E5F6000000000002 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = Notes/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = com.example.notes;
};
};
};
}

View file

@ -0,0 +1,8 @@
import Foundation
import AdSupport
enum Api {
static let base = URL(string: "http://192.0.2.10:8080/v1")!
static var adId: String { ASIdentifierManager.shared().advertisingIdentifier.uuidString }
static func lastSync() -> Date? { UserDefaults.standard.object(forKey: "lastSync") as? Date }
}

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>Notes</string>
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-0000000000000000~0000000000</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSPhotoLibraryUsageDescription</key>
<string></string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location</string>
</dict>
</plist>

View file

@ -0,0 +1,8 @@
import UIKit
final class LegacyHelp: UIViewController {
let web = UIWebView()
func openSystemSettings() {
UIApplication.shared.open(URL(string: "App-Prefs:root=Privacy")!)
}
}

View file

@ -0,0 +1,20 @@
import SwiftUI
import GoogleSignIn
import FirebaseAuth
struct LoginView: View {
var body: some View {
VStack {
Button("Continue with Google") { signInWithGoogle() }
Button("Create account") { createAccount() }
}
}
func signInWithGoogle() {
GIDSignIn.sharedInstance.signIn(withPresenting: rootViewController()) { _, _ in }
}
func createAccount() {
Auth.auth().createUserWithEmailAndPassword(withEmail: "demo@example.com", password: "example") { _, _ in }
}
}

View file

@ -0,0 +1,13 @@
import AVFoundation
import CoreLocation
final class ScannerView {
let session = AVCaptureSession()
let location = CLLocationManager()
func start() {
guard let device = AVCaptureDevice.default(for: .video) else { return }
_ = device
location.requestWhenInUseAuthorization()
}
}

View file

@ -0,0 +1,7 @@
import StoreKit
final class Store: NSObject {
func buyPro(_ product: SKProduct) {
SKPaymentQueue.default().add(SKPayment(product: product))
}
}

View file

@ -0,0 +1,13 @@
PODS:
- FirebaseAuth (10.18.0):
- FirebaseCore (~> 10.0)
- FirebaseCore (10.18.0)
- Google-Mobile-Ads-SDK (10.14.0)
- GoogleSignIn (7.0.0)
DEPENDENCIES:
- FirebaseAuth
- Google-Mobile-Ads-SDK
- GoogleSignIn
COCOAPODS: 1.15.2

View file

@ -0,0 +1,7 @@
# ios-native fixture
A made-up SwiftUI notes app with planted App Review problems for `storebound scan` tests: Google Sign-In without Sign
in with Apple, sign-up without in-app deletion, a non-consumable without Restore Purchases, AdMob and the IDFA without
App Tracking Transparency, the camera without a purpose string, an empty and a vague purpose string, UIWebView, a
private settings URL scheme, an IPv4 server URL, NSAllowsArbitraryLoads, no export compliance answer, no privacy
manifest, old SDKs, and an App Store listing that names Android, a competitor and lorem ipsum. Not a buildable project.

View file

@ -0,0 +1,25 @@
# Notes · App Store listing copy
## en-US · English (U.S.)
### subtitle
```
Quick notes, synced
```
### promotionalText
```
Write it down before you forget.
```
### keywords
```
notes,todo,instagram,free,journal
```
### description
```
Lorem ipsum dolor sit amet, notes for everyone.
Also available on Android and Google Play.
```

View file

@ -0,0 +1,18 @@
// Fixture config (made up, example.com placeholders only).
export default {
app: {
name: 'Notes',
profile: 'app',
privacyPolicyUrl: 'https://example.com/privacy',
supportUrl: 'https://example.com/support',
website: 'https://example.com',
contactEmail: 'support@example.com',
},
accounts: { enabled: true },
reviewAccess: { signInRequired: true },
languages: [{ id: 'en', apple: 'en-US' }],
apple: { bundleId: 'com.example.notes' },
products: [
{ id: 'com.example.notes.pro', type: 'non_consumable', usd: 4.99, listings: { en: { title: 'Notes Pro', description: 'Unlimited notes and themes' } } },
],
};

View file

@ -0,0 +1,13 @@
// !$*UTF8*$!
{
archiveVersion = 1;
objects = {
C1B2C3D4E5F6000000000002 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = Planner/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = com.example.planner;
};
};
};
}

View file

@ -0,0 +1,9 @@
import AdSupport
import GoogleMobileAds
enum Ads {
static func start() {
GADMobileAds.sharedInstance().start(completionHandler: nil)
print(ASIdentifierManager.shared().advertisingIdentifier)
}
}

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>Planner</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
</dict>
</plist>

View file

@ -0,0 +1,20 @@
import FirebaseAuth
import GoogleSignIn
import SwiftUI
struct LoginView: View {
var body: some View {
VStack {
Button("Continue with Google") {
GIDSignIn.sharedInstance.signIn(withPresenting: rootViewController()) { _, _ in }
}
Button("Create account") { Task { try await AccountApi.signUp() } }
}
}
}
enum AccountApi {
static func signUp() async throws {
_ = try await Auth.auth().createUser(withEmail: "planner@example.com", password: "example")
}
}

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict>
</array>
</dict>
</plist>

View file

@ -0,0 +1,7 @@
import StoreKit
enum ProStore {
static func buy(_ product: Product) async throws {
_ = try await product.purchase()
}
}

View file

@ -0,0 +1,10 @@
import SwiftUI
struct SettingsView: View {
var body: some View {
List {
Link("Privacy policy", destination: URL(string: "https://example.com/privacy")!)
Text("Last opened: \(UserDefaults.standard.string(forKey: "lastOpen") ?? "-")")
}
}
}

View file

@ -0,0 +1,9 @@
PODS:
- Google-Mobile-Ads-SDK (11.10.0)
- GoogleSignIn (7.1.0)
DEPENDENCIES:
- Google-Mobile-Ads-SDK
- GoogleSignIn
COCOAPODS: 1.15.2

6
tests/fixtures/scan/teaser/README.md vendored Normal file
View file

@ -0,0 +1,6 @@
# teaser fixture
A made-up iOS planner app with the five classic App Review rejections and nothing else: sign-in without a demo
account (2.1), sign-up without in-app account deletion (5.1.1(v)), Google Sign-In without Sign in with Apple (4.8), a
non-consumable without Restore Purchases (3.1.1), and AdMob plus the IDFA without App Tracking Transparency (5.1.2).
Its `storebound scan` output is the one the teaser video shows. Not a buildable project.

View file

@ -0,0 +1,23 @@
# Planner · App Store listing copy
## en-US · English (U.S.)
### subtitle
```
Plan your week in a minute
```
### promotionalText
```
Weekly planning without the clutter.
```
### keywords
```
planner,week,calendar,tasks,agenda
```
### description
```
Planner lays out your week in one screen. Planner Pro adds themes and widgets.
```

View file

@ -0,0 +1,18 @@
// Fixture config (made up, example.com placeholders only).
export default {
app: {
name: 'Planner',
profile: 'app',
privacyPolicyUrl: 'https://example.com/privacy',
supportUrl: 'https://example.com/support',
website: 'https://example.com',
contactEmail: 'support@example.com',
},
accounts: { enabled: true },
reviewAccess: { signInRequired: true, instructions: 'Sign in with the demo account.' },
languages: [{ id: 'en', apple: 'en-US' }],
apple: { bundleId: 'com.example.planner', usesNonExemptEncryption: false },
products: [
{ id: 'com.example.planner.pro', type: 'non_consumable', usd: 4.99, listings: { en: { title: 'Planner Pro', description: 'Themes and widgets' } } },
],
};

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.google.android.gms:play-services-ads:23.3.0" />
</androidPackages>
<iosPods>
<iosPod name="Google-Mobile-Ads-SDK" version="~> 11.10.0" />
</iosPods>
</dependencies>

View file

@ -0,0 +1,12 @@
using UnityEngine;
public class PhotoBooth : MonoBehaviour
{
WebCamTexture cam;
void Start()
{
cam = new WebCamTexture();
cam.Play();
}
}

View file

@ -0,0 +1,12 @@
using UnityEngine;
using UnityEngine.UI;
public class RatePopup : MonoBehaviour
{
public Text message;
void Show()
{
message.text = "Rate us 5 stars and get 50 free coins!";
}
}

View file

@ -0,0 +1,9 @@
using UnityEngine.Purchasing;
public class Shop : IDetailedStoreListener
{
public void BuyNoAds(IStoreController controller)
{
controller.InitiatePurchase("com.example.bubblezoo.noads");
}
}

View file

@ -0,0 +1,8 @@
{
"dependencies": {
"com.unity.ads": "4.12.0",
"com.unity.purchasing": "4.12.2",
"com.unity.services.levelplay": "8.4.0",
"com.unity.ugui": "2.0.0"
}
}

View file

@ -0,0 +1,11 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!129 &1
PlayerSettings:
productName: Bubble Zoo
companyName: Example Studio
AndroidMinSdkVersion: 23
AndroidTargetSdkVersion: 35
cameraUsageDescription:
locationUsageDescription:
microphoneUsageDescription:

5
tests/fixtures/scan/unity/README.md vendored Normal file
View file

@ -0,0 +1,5 @@
# unity fixture
A made-up Unity kids game: Kids Category age band with Unity Ads and LevelPlay (1.3, Play Families), "for kids" in the
listing, an empty camera usage description with WebCamTexture, a reward for rating the game, a non-consumable without
Restore, and targetSdk 35. Not a buildable project.

View file

@ -0,0 +1,23 @@
# Bubble Zoo · App Store listing copy
## en-US · English (U.S.)
### subtitle
```
Pop bubbles with zoo friends
```
### promotionalText
```
New: the penguin pool.
```
### keywords
```
bubble,zoo,animals,pop,toddler,learning
```
### description
```
The cutest bubble game for kids! Pop bubbles, free the animals and learn their names.
```

View file

@ -0,0 +1,17 @@
// Fixture config (made up, example.com placeholders only).
export default {
app: {
name: 'Bubble Zoo',
profile: 'game',
privacyPolicyUrl: 'https://example.com/privacy',
supportUrl: 'https://example.com/support',
website: 'https://example.com',
contactEmail: 'support@example.com',
},
languages: [{ id: 'en', play: 'en-US', apple: 'en-US' }],
play: { packageName: 'com.example.bubblezoo' },
apple: { bundleId: 'com.example.bubblezoo', usesNonExemptEncryption: false, info: { ageRating: { kidsAgeBand: 'FIVE_AND_UNDER' } } },
products: [
{ id: 'com.example.bubblezoo.noads', type: 'non_consumable', usd: 2.99, listings: { en: { title: 'No ads', description: 'Remove all ads' } } },
],
};

245
tests/scan.test.ts Normal file
View file

@ -0,0 +1,245 @@
// storebound scan: project detection, every rejection-risk rule on the fixtures (true positives) and the clean
// fixture (no false positives), the declarations proposal and --write, validate / MCP integration, the demo projects.
import { afterAll, beforeEach, describe, expect, test } from 'bun:test';
import { cpSync, mkdtempSync, readFileSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { FORBIDDEN_ARGS, TOOLS, toArgv } from '../cli/mcp-tools';
import { JSON_TOOLS } from '../cli/serve';
import { scanAsFindings } from '../cli/validate';
import { matchBrace, toTs, upsertBlock } from '../cli/lib/scan/config-edit';
import { runScan } from '../cli/lib/scan';
import { vaguePurpose } from '../cli/lib/scan/permissions';
import { detectProject, parsePlist } from '../cli/lib/scan/project';
import type { ScanFinding } from '../cli/lib/scan/rules';
import { matchesSdk, SDKS, versionAtLeast } from '../cli/lib/scan/sdks';
const ROOT = join(import.meta.dir, '..');
const FX = join(import.meta.dir, 'fixtures', 'scan');
const CLI = join(ROOT, 'cli', 'index.ts');
const saved = { u: process.env.REVIEW_DEMO_USER, p: process.env.REVIEW_DEMO_PASSWORD };
beforeEach(() => { delete process.env.REVIEW_DEMO_USER; delete process.env.REVIEW_DEMO_PASSWORD; });
afterAll(() => { if (saved.u !== undefined) process.env.REVIEW_DEMO_USER = saved.u; if (saved.p !== undefined) process.env.REVIEW_DEMO_PASSWORD = saved.p; });
const scan = async (name: string) => (await runScan(join(FX, name))).report;
const rules = (f: ScanFinding[], store?: 'apple' | 'play') => new Set(f.filter(x => !x.accepted && (!store || x.store === store)).map(x => x.rule));
const find = (f: ScanFinding[], rule: string, store?: 'apple' | 'play') => f.find(x => x.rule === rule && (!store || x.store === store));
describe('project detection', () => {
test('plist reader: values, nested dicts, top-level key lines', () => {
const { value, lines } = parsePlist(readFileSync(join(FX, 'ios-native/Notes/Info.plist'), 'utf8'));
expect(value.NSPhotoLibraryUsageDescription).toBe('');
expect((value.NSAppTransportSecurity as Record<string, unknown>).NSAllowsArbitraryLoads).toBe(true);
expect(lines.get('NSAppTransportSecurity')).toBe(9);
expect(parsePlist('not a plist').value).toEqual({});
});
test('stacks, SDKs with versions and file:line from every ecosystem', () => {
const ios = detectProject(join(FX, 'ios-native'));
expect(ios.stacks).toEqual(['ios-native']);
const admob = ios.sdks.find(s => s.sdk.id === 'admob')!.deps[0]!;
expect([admob.file, admob.line, admob.version]).toEqual(['Podfile.lock', 5, '10.14.0']);
expect(ios.sdks.find(s => s.sdk.id === 'google-signin')!.deps.map(d => d.eco).sort()).toEqual(['cocoapods', 'spm']);
const android = detectProject(join(FX, 'android'));
expect(android.androidInfo.targetSdk).toEqual({ value: 34, at: { file: 'app/build.gradle.kts', line: 12 } });
expect(android.sdks.map(s => s.sdk.id).sort()).toEqual(['admob', 'firebase-auth']);
expect(detectProject(join(FX, 'capacitor')).stacks).toEqual(['capacitor']);
expect(detectProject(join(FX, 'capacitor')).remoteStart?.url).toBe('https://shop.example.com');
expect(detectProject(join(FX, 'capacitor')).androidInfo.targetSdk?.value).toBe(35);
const unity = detectProject(join(FX, 'unity'));
expect(unity.stacks).toEqual(['unity']);
expect(unity.sdks.map(s => s.sdk.id).sort()).toEqual(['admob', 'iap-wrapper', 'levelplay', 'unity-ads']);
expect(unity.plist.get('NSCameraUsageDescription')?.at.file).toBe('ProjectSettings/ProjectSettings.asset');
const flutter = detectProject(join(FX, 'flutter'));
expect(flutter.stacks).toEqual(['flutter']);
expect(flutter.deps.find(d => d.name === 'firebase_auth')?.version).toBe('5.3.1');
expect(flutter.androidInfo.targetSdkFrom).toContain('Flutter');
});
test('SDK table: matchers and version compare', () => {
const admob = SDKS.find(s => s.id === 'admob')!;
expect(matchesSdk({ eco: 'cocoapods', name: 'Google-Mobile-Ads-SDK', version: null, file: '', line: 1 }, admob)).toBe(true);
expect(matchesSdk({ eco: 'gradle', name: 'com.google.android.gms:play-services-ads-lite', version: null, file: '', line: 1 }, admob)).toBe(false);
expect(matchesSdk({ eco: 'gradle', name: 'com.amplitude:analytics-android', version: null, file: '', line: 1 }, SDKS.find(s => s.id === 'amplitude')!)).toBe(true);
expect(matchesSdk({ eco: 'spm', name: 'FirebaseAnalytics', version: null, file: '', line: 1 }, SDKS.find(s => s.id === 'firebase-analytics')!)).toBe(true);
expect(versionAtLeast('10.14.0', '11.2.0')).toBe(false);
expect(versionAtLeast('~> 11.10.0', '11.2.0')).toBe(true);
expect(versionAtLeast('latest', '1.0')).toBeNull();
for (const s of SDKS) expect(s.docs).toMatch(/^https:\/\//);
});
test('purpose strings: empty, vague, fine', () => {
expect(vaguePurpose('')).toBe('empty');
expect(vaguePurpose('TODO')).toBe('empty');
expect(vaguePurpose('Location')).toBe('vague');
expect(vaguePurpose('Allow $(PRODUCT_NAME) to access your camera')).toBe('vague');
expect(vaguePurpose('Scan a paper note with the camera to turn it into text.')).toBeNull();
});
});
describe('rules: planted issues are found', () => {
test('ios-native', async () => {
const r = await scan('ios-native');
for (const id of ['demo-account', 'account-deletion', 'login-services', 'restore-purchases', 'att', 'purpose-strings', 'privacy-manifest', 'other-platforms',
'metadata-keywords', 'placeholder-text', 'deprecated-api', 'private-api', 'ats', 'ipv6', 'export-compliance']) expect(rules(r.findings)).toContain(id);
expect(find(r.findings, 'demo-account')!.severity).toBe('blocker');
expect(find(r.findings, 'login-services')!.guideline).toBe('4.8');
const cam = r.findings.find(f => f.rule === 'purpose-strings' && f.title.includes('NSCameraUsageDescription'))!;
expect(cam.severity).toBe('blocker');
expect(cam.evidence[0]).toMatchObject({ file: 'Notes/ScannerView.swift', line: 9 });
expect(r.findings.some(f => f.rule === 'purpose-strings' && f.title.includes('too vague'))).toBe(true);
expect(find(r.findings, 'other-platforms')!.evidence[0]).toMatchObject({ file: 'store/appstore.md', line: 24 });
expect(find(r.findings, 'deprecated-api')!.evidence[0]!.file).toBe('Notes/LegacyHelp.swift');
expect(r.findings.filter(f => f.title.includes('older than')).length).toBe(3);
for (const f of r.findings) { expect(f.fix.length).toBeGreaterThan(10); expect(f.skill).toBeTruthy(); expect(f.ref).toMatch(/^https:\/\//); expect(f.evidence.length).toBeGreaterThan(0); }
});
test('android', async () => {
const r = await scan('android');
for (const id of ['play-deletion-url', 'play-target-sdk', 'play-package-name', 'play-fgs', 'play-exact-alarm', 'play-query-all-packages', 'play-sms-call-log', 'privacy-labels'])
expect(rules(r.findings, 'play')).toContain(id);
expect(find(r.findings, 'play-target-sdk')!.evidence[0]).toMatchObject({ file: 'app/build.gradle.kts', line: 12 });
expect(find(r.findings, 'play-sms-call-log')!.evidence[0]).toMatchObject({ file: 'app/src/main/AndroidManifest.xml', line: 5 });
expect(rules(r.findings, 'apple').size).toBe(0);
expect(rules(r.findings)).not.toContain('play-app-access');
expect(rules(r.findings)).not.toContain('account-deletion');
});
test('capacitor (no config: project files only)', async () => {
const r = await scan('capacitor');
expect(r.config).toBeNull();
for (const id of ['min-functionality', 'purpose-strings', 'play-target-sdk', 'privacy-manifest', 'att']) expect(rules(r.findings)).toContain(id);
expect(find(r.findings, 'min-functionality')!.evidence[0]).toMatchObject({ file: 'capacitor.config.json', line: 6 });
expect(rules(r.findings)).not.toContain('export-compliance');
});
test('unity', async () => {
const r = await scan('unity');
for (const id of ['purpose-strings', 'play-target-sdk', 'restore-purchases', 'kids-ads', 'review-prompt', 'privacy-manifest']) expect(rules(r.findings)).toContain(id);
expect(find(r.findings, 'kids-ads', 'apple')!.guideline).toBe('1.3');
expect(find(r.findings, 'kids-ads', 'play')).toBeTruthy();
expect(r.findings.find(f => f.rule === 'review-prompt' && f.severity === 'high')).toBeTruthy();
expect(rules(r.findings)).not.toContain('kids-terms');
});
test('flutter', async () => {
const r = await scan('flutter');
for (const id of ['account-deletion', 'play-deletion-url', 'login-services', 'restore-purchases', 'subscription-info', 'att', 'play-fgs', 'play-target-sdk']) expect(rules(r.findings)).toContain(id);
expect(find(r.findings, 'att')!.severity).toBe('blocker');
expect(r.findings.find(f => f.rule === 'subscription-info' && f.severity === 'blocker')!.title).toContain('Terms of Use');
expect(r.findings.find(f => f.rule === 'play-fgs' && f.title.includes('FOREGROUND_SERVICE_LOCATION'))).toBeTruthy();
expect(find(r.findings, 'play-target-sdk')!.severity).toBe('low');
});
test('teaser: exactly the five classic rejections', async () => {
const r = await scan('teaser');
expect([...rules(r.findings)].sort()).toEqual(['account-deletion', 'att', 'demo-account', 'login-services', 'restore-purchases']);
expect(r.findings.map(f => f.guideline)).toEqual(['2.1(a)', '5.1.1(v)', '4.8', '3.1.1', '5.1.2(i)']);
});
});
describe('rules: no false positives', () => {
test('clean fixture has no finding at all', async () => {
process.env.REVIEW_DEMO_USER = 'demo@example.com'; process.env.REVIEW_DEMO_PASSWORD = 'example';
const r = await scan('clean');
expect(r.findings.map(f => `${f.rule}: ${f.title}`)).toEqual([]);
expect(r.declarations.changed).toBe(false);
expect(r.declarations.labelGaps).toEqual([]);
expect(r.stacks.sort()).toEqual(['android-native', 'ios-native']);
});
test('the demo account comes from the environment or .storebound/', async () => {
expect(rules((await scan('clean')).findings)).toContain('demo-account');
});
test('the example projects have no open finding (the fictional ones are accepted in scan.ignore)', async () => {
for (const d of ['demo-app', 'demo-game']) {
const r = (await runScan(join(ROOT, 'examples', d))).report;
expect(r.findings.filter(f => !f.accepted).map(f => f.title)).toEqual([]);
for (const f of r.findings) expect(f.accepted!.length).toBeGreaterThan(10);
}
});
});
describe('declarations proposal', () => {
test('detected SDK data types become additions, owner answers are kept, never removed', async () => {
const d = (await scan('android')).declarations;
expect(d.diff.find(x => x.type === 'PSL_DEVICE_ID')).toMatchObject({ change: 'add', after: { shared: true, collect: ['advertising', 'analytics', 'fraud'], share: ['advertising'] } });
expect(d.diff.find(x => x.type === 'PSL_EMAIL')!.change).toBe('merge');
expect(d.dataSafety!.data.PSL_EMAIL!.collect).toEqual(['account', 'functionality']);
expect(d.items.find(x => x.what === 'encryptedInTransit')!.status).toBe('ask');
expect(d.items.find(x => x.what === 'PSL_DEVICE_ID')!.evidence[0]!.file).toBe('gradle/libs.versions.toml');
expect(d.changed).toBe(true);
});
test('ATT and the privacy manifest', async () => {
const d = (await scan('clean')).declarations;
expect(d.items.find(x => x.area === 'appPrivacy' && x.what === 'tracking')).toMatchObject({ status: 'detected', value: expect.stringContaining('true') });
expect(d.items.find(x => x.area === 'privacyManifest' && x.what === 'NSPrivacyAccessedAPICategoryUserDefaults')).toMatchObject({ status: 'detected', value: 'declared: CA92.1' });
const t = (await scan('teaser')).declarations;
expect(t.items.find(x => x.area === 'att')!.status).toBe('ask');
});
});
describe('config writing', () => {
test('matchBrace skips strings and comments', () => {
const s = "{ a: '}', b: { c: \"{\" }, // }\n d: `}` }";
expect(matchBrace(s, 0)).toBe(s.length - 1);
});
test('toTs writes plain TypeScript', () => {
expect(toTs({ shared: false, collect: ['a', 'b'] })).toBe("{ shared: false, collect: ['a', 'b'] }");
expect(toTs({ PSL_X: { shared: true, collect: ['x'] } }, ' ')).toBe("{\n PSL_X: { shared: true, collect: ['x'] },\n }");
});
test('upsertBlock replaces an existing block and inserts after app', () => {
const src = "export default {\n app: { name: 'X' },\n dataSafety: { collectsData: false, data: {} },\n languages: [],\n};\n";
const a = upsertBlock(src, 'c.ts', 'dataSafety', { collectsData: true, data: {} });
expect(a).toBe("export default {\n app: { name: 'X' },\n dataSafety: {\n collectsData: true,\n data: {},\n },\n languages: [],\n};\n");
const b = upsertBlock(src, 'c.ts', 'appPrivacy', { tracking: true }, 'note');
expect(b).toContain(" app: { name: 'X' },\n // note\n appPrivacy: { tracking: true },\n dataSafety");
expect(JSON.parse(upsertBlock('{"app":{}}', 'c.json', 'appPrivacy', { tracking: false }))).toEqual({ app: {}, appPrivacy: { tracking: false } });
});
test('scan is read-only without --write; --write adds the detected answers and the config still loads', async () => {
const dir = mkdtempSync(join(tmpdir(), 'sb-scan-'));
try {
cpSync(join(FX, 'android'), dir, { recursive: true });
const before = readFileSync(join(dir, 'storebound.config.ts'), 'utf8');
const run = (...a: string[]) => Bun.spawnSync(['bun', CLI, 'scan', '--dir', dir, ...a], { env: { ...process.env, REVIEW_DEMO_USER: '', REVIEW_DEMO_PASSWORD: '' } });
const r1 = run();
expect(r1.exitCode).toBe(1);
expect(r1.stdout.toString()).toContain('+ dataSafety.data.PSL_DEVICE_ID');
expect(readFileSync(join(dir, 'storebound.config.ts'), 'utf8')).toBe(before);
run('--write', '--dry');
expect(readFileSync(join(dir, 'storebound.config.ts'), 'utf8')).toBe(before);
run('--write');
const after = readFileSync(join(dir, 'storebound.config.ts'), 'utf8');
expect(after).toContain("PSL_DEVICE_ID: { shared: true, collect: ['advertising', 'analytics', 'fraud'], share: ['advertising'] }");
expect(after).toContain("PSL_EMAIL: { shared: false, collect: ['account', 'functionality'] }");
expect(after).toContain("accountCreation: ['PSL_ACM_USER_ID_PASSWORD']");
const again = await runScan(dir);
expect(again.report.configError).toBeNull();
expect(again.report.declarations.changed).toBe(false);
expect(rules(again.report.findings)).not.toContain('privacy-labels');
} finally { rmSync(dir, { recursive: true, force: true }); }
});
});
describe('integration', () => {
test('JSON output, --store filter, exit code', () => {
const r = Bun.spawnSync(['bun', CLI, 'scan', '--dir', join(FX, 'teaser'), '--json', '--store', 'apple'], { env: { ...process.env, REVIEW_DEMO_USER: '', REVIEW_DEMO_PASSWORD: '' } });
expect(r.exitCode).toBe(1);
const j = JSON.parse(r.stdout.toString()) as { counts: { blocker: number }; findings: ScanFinding[] };
expect(j.counts.blocker).toBe(2);
expect(j.findings.every(f => f.store === 'apple')).toBe(true);
});
test('scan.ignore marks findings as accepted and they stop blocking', async () => {
const r = (await runScan(join(ROOT, 'examples', 'demo-app'))).report;
expect(r.findings.find(f => f.rule === 'demo-account')!.accepted).toContain('fictional');
expect(r.counts.blocker).toBe(0);
});
test('validate gets the open blockers and risks, not low or accepted ones', async () => {
const r = (await scan('flutter')).findings;
const v = scanAsFindings(r, { apple: true, play: false });
expect(v.every(f => f.store === 'apple' && f.code.startsWith('scan-'))).toBe(true);
expect(v.filter(f => f.level === 'blocker').length).toBe(r.filter(f => f.store === 'apple' && f.severity === 'blocker').length);
expect(v.some(f => f.code === 'scan-subscription-info' && f.msg.startsWith('3.1.2'))).toBe(true);
expect(scanAsFindings([{ ...r[0]!, accepted: 'fine' }], { apple: true, play: true })).toEqual([]);
});
test('MCP tool and desktop method are read-only and cannot write', () => {
const t = TOOLS.find(x => x.name === 'scan')!;
expect(t.write).toBe(false);
expect(t.network).toBe(false);
expect(toArgv(t, { store: 'play' }).argv).toEqual(['scan', '--store', 'play']);
expect(FORBIDDEN_ARGS).toContain('--write');
for (const x of TOOLS) expect(toArgv(x, {}).argv).not.toContain('--write');
expect(JSON_TOOLS.has('scan')).toBe(true);
});
});