appstore-precheck 1.21.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,46 @@ All notable changes to this project are documented here. Versioning follows
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.23.0] — 2026-11-26
9
+
10
+ ### Artifact tier, baseline diff, positioning
11
+
12
+ - **`--artifact <path>` (alias `--ipa`)**: the read-only `artifact-review.py` inspector (`.app`, `.ipa`, `.xcarchive`; plists, signed entitlements, Mach-O linkage, embedded frameworks, nothing launched) is now part of `scan.sh`. Its nine checks are catalogued rules §78–§86 (`artifact-entitlements`, `artifact-reason-api`, `artifact-private-api`, `artifact-url-schemes`, `artifact-ats`, `artifact-sdk`, `artifact-embedded-sdk`, `artifact-executable-loading`, `artifact-debug`) with the new `artifact` evidence class; `FINDING` / `NEEDS_REVIEW` map to WARN, never FAIL, and a missing tool or artifact is an honest SKIP. Counted as "artifact checks" in the coverage inventory, apart from the static vectors. `npx appstore-precheck --artifact build/App.ipa` passes it through.
13
+ - **`--save-baseline <file>` / `--baseline <file>`**: accept today's FAIL/WARN findings and fail only on what is new. A match on rule + file + message is treated like a `.precheck-ignore` suppression (out of text and verdict, kept in JSON as `suppressed: true`), counted in the new `summary.baseline` and in the text footer. PASS and SKIP are never baselined; an unreadable baseline is reported on stderr and ignored.
14
+ - README states the scope plainly: iOS only, by design, with a pointer to greenlight for Google Play. New `tests/test-baseline.sh` and `tests/test-scan-artifact.sh`.
15
+
16
+ Coverage inventory: 94/104 leaf sections (90%); 94 touched, 2 positive-only; 77 static vectors, 9 artifact checks, 56 deep-review checks, 20 dynamic checks, 5 vision checks, 10 human-only sections.
17
+
18
+
19
+ ## [1.22.0] — 2026-11-26
20
+
21
+ ### App Store Connect changes of November 2026 encoded (guideline text unchanged)
22
+
23
+ Apple did not change the App Review Guidelines after October 16, 2026 (`guideline-drift.sh`: no drift), but App Store Connect and the new App Review Help hub added submission rules the scanner did not know. Five advisory static vectors (§73–§77) in the modular table, all WARN-only, all `judgment-call`:
24
+
25
+ - **§73 `shared-location-descriptor` (2.3.6)**: a location API together with copy about sharing location with other people. The "Shared Location" age-rating content descriptor is mandatory for every app by **2027-01-12**; the WARN says to answer it, not that the rating is wrong.
26
+ - **§74 `dating-age-descriptor` (2.3.6)**: dating / matchmaking / AI-companion wording in store metadata. The "Dating and Relationships" descriptor sets the minimum rating to 18+ (Brazil A18). "Updating", puzzle "match" and CRM "relationship" stay clean.
27
+ - **§75 `on-demand-resources` (2.1)**: `NSBundleResourceRequest` / ODR build settings. New apps using On-Demand Resources are not accepted from early 2027; Background Assets is the replacement.
28
+ - **§76 `required-device-capabilities` (2.4.1)**: `UIRequiredDeviceCapabilities` entries beyond architecture / baseline (telephony, gps, cameras, sensors, nfc) narrow the device set; App Review Help says to declare only what core functionality needs.
29
+ - **§77 `review-notes-completeness` (2.1)**: against `fastlane/metadata/review_information/`, a third-party AI provider in code must be named in the notes, auto-renewable subscriptions need a demo account in an expired state, and more than one account type needs credentials for each. Missing metadata is a SKIP gap.
30
+ - Deep-review check 4 lists the same three review-notes expectations; check 8 and vision S4 count the "more than half of each device set shows the app in use" rule (2 of 3, 3 of 56). The methodology checklist gains the ASC age questions, the App Compliance page, the screenshot ratio, the review-notes items and the Siri AI App Intents limits (under-13 and EU users excluded; submissions from spring 2027).
31
+ - Modular-table evidence classes now include `manifest`; the coverage derivation accepts it.
32
+
33
+ Coverage inventory: 94/104 leaf sections (90%); 94 touched, 2 positive-only; 77 static vectors, 56 deep-review checks, 20 dynamic checks, 5 vision checks, 10 human-only sections.
34
+
35
+
36
+ ## [1.21.1] — 2026-11-25
37
+
38
+ ### Fixed
39
+ - **§54 `saturated-category` (4.3(b))** now matches "simple timers", the one category in Apple's own 4.3(b) list that the regex had left out while the comment above it named it. A bare `timer` keyword still does not fire: Apple's words are "simple timers", and "timer" alone is an ordinary feature word.
40
+ - **§51 `xcode-sdk-requirement` (2.1)** reads every checked-in `project.pbxproj` instead of the first five `find` returned, and transports paths NUL-delimited (`-print0` / `xargs -0`), so a project under a directory with a space in its name, or a hand-maintained project listed after several generated Tuist / XcodeGen / SwiftPM wrapper projects, no longer escapes the pre-26 `LastUpgradeCheck` warning. New `tests/test-xcode-sdk-paths.sh` pins both cases.
41
+ - **§26 `misleading-claims`, §27 `kids-wording`, §40 `realmoney-gambling`** quote their metadata hits sorted by path then line (`LC_ALL=C`), so the finding's `file`/`line` and detail text are the same on APFS and ext4. The only cross-platform difference the full-suite Linux diagnostic found was §40 on `risky-app-2` naming `keywords.txt` on macOS and `description.txt` on Linux. New `tests/test-detail-order.sh` pins the path order.
42
+ - **§55 `ipv4-literal` (2.5.5)** lists its evidence sorted by path then line. `grep -r` walks directories in filesystem order, which differs between APFS and ext4, and the GitHub runner image of November 2026 changed that order on Linux: the additions-only golden test (`tests/test-default-golden.sh`) failed on `main` without any code change. The golden entry for `ipv4-literal-app` is re-pinned to the sorted order; `tests/test-ipv4-literal.sh` asserts it.
43
+ - SKILL.md no longer claims age rating, review notes and the demo account have "no scanner rule": §20 checks for reviewer credentials behind a login and the opt-in `--metadata` tier reports their presence; what remains a deep-review judgment is their substance. README's 2.3.3 row says the screenshot check is presence-only and names Apple's "more than half show the app in use" rule as the vision / human part.
44
+
45
+ ### Changed
46
+ - README visuals redrawn: the social preview carries the current numbers (72 static vectors, 56 deep checks, 20 dynamic, 94/104 sections) and all five hosts; a new "How it works" pipeline graphic sits above the phase table. Sources live in `assets/src/` and render with `bash assets/src/render.sh` (headless Chrome); the demo GIFs were re-recorded from the current CLI with the existing vhs tapes.
47
+
8
48
  ## [1.21.0] — 2026-10-17
9
49
 
10
50
  ### Apple App Review Guidelines update of October 16, 2026 reconciled
package/README.md CHANGED
@@ -13,10 +13,10 @@
13
13
  <p align="center"><strong>Catch App Store rejections before a reviewer does.</strong></p>
14
14
 
15
15
  <p align="center">
16
- <img src="assets/demo-fix-loop.gif" width="900" alt="appstore-precheck scanning an app: RED with four FAILs, then GREEN after the paywall is fixed">
16
+ <img src="assets/demo-fix-loop.gif" width="900" alt="appstore-precheck scanning an app: RED with five FAILs, then GREEN after the paywall and metadata are fixed">
17
17
  </p>
18
18
 
19
- <p align="center"><em>Four blockers found before Apple saw them, then a clean GREEN after the fix.</em></p>
19
+ <p align="center"><em>Five blockers found before Apple saw them, then a clean GREEN after the fix.</em></p>
20
20
 
21
21
  ---
22
22
 
@@ -48,11 +48,11 @@ each, divided by horizontal rules), not one compressed sentence. The breakdown b
48
48
 
49
49
  ## What it checks
50
50
 
51
- Coverage inventory: 94/104 leaf sections (90%); 94 touched, 2 positive-only; 72 static vectors, 56 deep-review checks, 20 dynamic checks, 5 vision checks, 10 human-only sections.
51
+ Coverage inventory: 94/104 leaf sections (90%); 94 touched, 2 positive-only; 77 static vectors, 9 artifact checks, 56 deep-review checks, 20 dynamic checks, 5 vision checks, 10 human-only sections.
52
52
 
53
53
  The percentage counts sections touched, not automatic verification of every requirement; see [the coverage inventory](docs/guideline-coverage.md).
54
54
 
55
- 72 rejection vectors across code, fastlane metadata, screenshots, `PrivacyInfo.xcprivacy`, and the paywall:
55
+ 77 rejection vectors across code, fastlane metadata, screenshots, `PrivacyInfo.xcprivacy`, and the paywall:
56
56
 
57
57
  | Guideline | Check |
58
58
  |-----------|-------|
@@ -65,7 +65,7 @@ The percentage counts sections touched, not automatic verification of every requ
65
65
  | **2.3.7 / ASC** | Metadata length limits (name, subtitle, keywords, promo, description) |
66
66
  | **2.3.1** | Misleading marketing claims (iOS virus / malware scanners, fake speed boosters) in metadata |
67
67
  | **2.3.7** | Pricing / promo language ("Free", "% off", a currency amount) in the app name or subtitle |
68
- | **2.3.3** | At least one screenshot per locale |
68
+ | **2.3.3** | At least one screenshot per locale *(presence only; Apple's "more than half show the app in use" rule per device set is a vision / human check)* |
69
69
  | **2.3.3** | Screenshot format + PNG dimensions match a known App Store screenshot size *(advisory, WARN-only)* |
70
70
  | **2.3** | Localized metadata parity across every locale |
71
71
  | **2.3.8** | "For Kids" / "For Children" wording outside the Kids Category |
@@ -127,6 +127,10 @@ The percentage counts sections touched, not automatic verification of every requ
127
127
  | **4.7.2** | All four signals must coexist in one file: handler, remote JS URL, evaluation and native-sensitive API. Does not resolve bridge access control. |
128
128
  | **5.2.4** | Narrow English endorsement/official-product patterns; authorized claims still require human confirmation. Ordinary iPhone compatibility text stays clean. |
129
129
  | **2.5.19** | Review-detection / hide-for-review keys, App Store build-flag branches, date-gated unlocks and obfuscation tooling; store-review prompts and product-review vocabulary stay clean. A hit asks "show the reviewer what ships", it is not proof of a hidden feature. |
130
+ | **2.3.6** | Location API plus location-sharing copy → answer the new "Shared Location" age-rating descriptor; dating / AI-companion wording in metadata → "Dating and Relationships" descriptor means 18+ (both mandatory in App Store Connect by 2027-01-12) *(advisory)* |
131
+ | **2.1** | On-Demand Resources (`NSBundleResourceRequest`, ODR build settings): not accepted in new apps from early 2027, migrate to Background Assets *(advisory)* |
132
+ | **2.4.1** | `UIRequiredDeviceCapabilities` entries beyond architecture / baseline (telephony, gps, cameras, sensors) narrow the device set; declare only what core functionality needs *(advisory)* |
133
+ | **2.1** | Review notes name the third-party AI provider the code calls, give an expired-subscription demo account when subscriptions auto-renew, and cover every account type the app has *(advisory)* |
130
134
 
131
135
  Paywall checks are skipped automatically when no in-app-purchase signals are present, and the
132
136
  advisory warnings require their documented trigger. Missing inputs are recorded in the JSON coverage gaps.
@@ -233,6 +237,10 @@ how the app is built:
233
237
  | 🟢 **Native Swift / SwiftUI** | Source checks are supported; applicability and missing-input gates still apply. |
234
238
  | 🟡 **React Native / Flutter** | Metadata, privacy manifest, screenshots, and export compliance apply in full. The native-source checks (ATT, paywall links, private API, SDK detection, navigation) **under-detect rather than misfire**: that logic lives in JS/Dart, so they stay quiet instead of blocking. |
235
239
 
240
+ **iOS only, on purpose.** The scanner encodes Apple's App Store Review Guidelines and App Store
241
+ Connect rules; it does not read Android projects or Play Console policy, and it will not. For a
242
+ Google Play pre-check use a tool built for it, such as [greenlight](https://github.com/RevylAI/greenlight).
243
+
236
244
  ## Quick start
237
245
 
238
246
  One `SKILL.md`, every host. **Claude Code, Cursor, Codex, and Grok Build** install as native
@@ -375,6 +383,32 @@ bash skills/appstore-precheck/scripts/scan.sh --format json # structured findi
375
383
  default text lines, for scripts and measurement tooling to consume. It's read-only and additive;
376
384
  the default text output is unchanged.
377
385
 
386
+ **Built artifact (`--artifact`, alias `--ipa`)** — hand the scan a built `.app`, `.ipa` or
387
+ `.xcarchive` and nine read-only artifact checks join the output as rules `artifact-*`: signed
388
+ entitlements vs `Info.plist`, Required Reason API symbols vs `PrivacyInfo.xcprivacy`, private
389
+ framework linkage (`otool -L`), `LSApplicationQueriesSchemes`, ATS exceptions as shipped,
390
+ `MinimumOSVersion` vs the build SDK, embedded frameworks' manifests and signatures, downloaded
391
+ executable code strings, and debug leftovers (`get-task-allow`, stray `.mobileprovision`, dSYMs).
392
+ Nothing is launched. They carry `evidence: artifact`, never FAIL on their own, and report SKIP when a
393
+ tool (`codesign`, `otool`, `nm`) is missing.
394
+
395
+ ```bash
396
+ npx appstore-precheck --artifact build/MyApp.ipa
397
+ bash skills/appstore-precheck/scripts/scan.sh --ipa build/MyApp.ipa --format json
398
+ ```
399
+
400
+ **Baseline (`--save-baseline` / `--baseline`)** — accept today's findings and see only what is
401
+ new. `--save-baseline .precheck-baseline.json` records the live FAIL/WARN findings (rule, file,
402
+ message); on later runs `--baseline .precheck-baseline.json` treats a matching finding like a
403
+ `.precheck-ignore` suppression: it leaves the text output and the verdict, stays in `--format json`
404
+ as `suppressed: true`, and is counted in `summary.baseline` and in the footer. A baseline that
405
+ cannot be read is reported on stderr and ignored, so it can never hide anything by accident.
406
+
407
+ ```bash
408
+ npx appstore-precheck --save-baseline .precheck-baseline.json # once, after triage
409
+ npx appstore-precheck --baseline .precheck-baseline.json # in CI: fail only on new findings
410
+ ```
411
+
378
412
  ### CI
379
413
 
380
414
  Drop the static scan into a workflow with the bundled composite action. It fails the
@@ -415,10 +449,14 @@ nothing is auto-fixed.
415
449
 
416
450
  ## How it works
417
451
 
452
+ <p align="center">
453
+ <img src="assets/how-it-works.png" width="900" alt="The appstore-precheck pipeline: guideline drift, static scan, fastlane precheck, Pierre commentary, Pierre deep review, then a GREEN / YELLOW / RED verdict; an opt-in dynamic simulator tier runs beside it">
454
+ </p>
455
+
418
456
  | Phase | Step |
419
457
  |-------|------|
420
458
  | **0** | **Guideline drift**: diff the live App Store Review Guidelines against a tracked baseline. Never blocks. |
421
- | **1** | **Static scan**: `scan.sh` over the 72 vectors above. Every finding is labelled with the artifact it was read from and who enforces it — see [Evidence strength](#evidence-strength). |
459
+ | **1** | **Static scan**: `scan.sh` over the 77 vectors above. Every finding is labelled with the artifact it was read from and who enforces it — see [Evidence strength](#evidence-strength). |
422
460
  | **2** | **`fastlane precheck`**: Apple's own metadata rule engine. |
423
461
  | **3** | **Pierre commentary**: explains **every** FAIL and WARN from Phases 0–2 in 2–3 sentences each, quoting Apple's pinned guideline text rather than his memory — see [Guideline citations](#guideline-citations). |
424
462
  | **4** | **Pierre deep review**: 56 semantic checks (Tier A, heuristic Tier B and host vision Tier C), plus 5 screenshot-vision checks when screenshots are present. Advisory only. |
package/bin/cli.js CHANGED
@@ -39,6 +39,9 @@ function printHelp() {
39
39
  ` --dir <path> Directory to scan (default: current directory)\n` +
40
40
  ` --fail-on <level> Exit non-zero at RED (default) or YELLOW\n` +
41
41
  ` --format <fmt> Output format: text (default), json, or sarif\n` +
42
+ ` --artifact <path> Also inspect a built .app / .ipa / .xcarchive (read-only)\n` +
43
+ ` --baseline <file> Hide findings recorded earlier with --save-baseline\n` +
44
+ ` --save-baseline <f> Write the live FAIL/WARN findings of this run to <f>\n` +
42
45
  ` -v, --version Print the version and exit\n` +
43
46
  ` -h, --help Show this help and exit\n` +
44
47
  `\n` +
@@ -56,7 +59,7 @@ function fail(message, code) {
56
59
  }
57
60
 
58
61
  function parseArgs(argv) {
59
- const opts = { dir: process.cwd(), failOn: 'RED', format: 'text' };
62
+ const opts = { dir: process.cwd(), failOn: 'RED', format: 'text', passthrough: [] };
60
63
  for (let i = 0; i < argv.length; i++) {
61
64
  const a = argv[i];
62
65
  if (a === '-h' || a === '--help') { printHelp(); process.exit(0); }
@@ -78,6 +81,12 @@ function parseArgs(argv) {
78
81
  opts.format = v;
79
82
  continue;
80
83
  }
84
+ if (a === '--artifact' || a === '--ipa' || a === '--baseline' || a === '--save-baseline') {
85
+ const v = argv[++i];
86
+ if (!v) fail(`${a} requires a path`, 64);
87
+ opts.passthrough.push(a === '--ipa' ? '--artifact' : a, v);
88
+ continue;
89
+ }
81
90
  fail(`unknown option: ${a} (try --help)`, 64);
82
91
  }
83
92
  return opts;
@@ -104,6 +113,7 @@ function main() {
104
113
  // the enclosing git toplevel.
105
114
  const scanArgs = [SCAN, '--dir', opts.dir];
106
115
  if (opts.format !== 'text') scanArgs.push('--format', opts.format);
116
+ scanArgs.push(...opts.passthrough);
107
117
  const scan = spawnSync('bash', scanArgs, {
108
118
  cwd: opts.dir,
109
119
  encoding: 'utf8',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appstore-precheck",
3
- "version": "1.21.0",
3
+ "version": "1.23.0",
4
4
  "description": "Read-only iOS App Store pre-submission check, packaged as a portable Agent Skill with native Claude Code, Cursor, Codex, and Grok Build plugins, plus an npx CLI.",
5
5
  "license": "MIT",
6
6
  "author": "Berkay Turk (https://github.com/berkayturk)",
@@ -25,7 +25,7 @@
25
25
  "scripts": {
26
26
  "test": "bash tests/all.sh",
27
27
  "check-versions": "bash scripts/check-versions.sh",
28
- "lint": "node --check bin/cli.js && bash -n skills/appstore-precheck/scripts/scan.sh && bash -n skills/appstore-precheck/scripts/verdict.sh && bash -n skills/appstore-precheck/scripts/phase2-precheck.sh && bash -n skills/appstore-precheck/scripts/findings.sh && bash -n skills/appstore-precheck/scripts/evidence.sh && bash -n skills/appstore-precheck/scripts/dynamic.sh && bash -n skills/appstore-precheck/scripts/guideline-cite.sh && bash -n skills/appstore-precheck/scripts/suppress.sh && bash -n hooks/fastlane-guard.sh && bash -n install.sh && bash -n tests/run.sh && bash -n tests/all.sh && bash -n tests/test-verdict.sh && bash -n tests/test-guard.sh && bash -n tests/test-config.sh && bash -n tests/test-install.sh && bash -n tests/test-phase2.sh && bash -n tests/test-cli.sh && bash -n tests/test-findings.sh && bash -n tests/test-format-json.sh && bash -n tests/test-suppress.sh && bash -n tests/test-scorecard.sh && bash -n tests/test-sdk-signals.sh && bash -n scripts/scorecard.sh && bash -n scripts/scorecard-real.sh && bash -n scripts/update-brew-formula.sh && bash -n tests/test-pack.sh && bash -n eval/run.sh && bash -n eval/validate.sh && bash -n eval/rag/ingest.sh && bash -n tests/test-rag-ingest.sh && bash -n tests/test-rag-embed.sh && bash -n tests/test-rag-gemini-client.sh && bash -n tests/test-rag-retrieve.sh && bash -n tests/test-eval-parse.sh && bash -n tests/test-rag-build-request.sh && bash -n tests/test-rag-run-guard.sh && bash -n tests/test-eval-score.sh && bash -n tests/test-evidence.sh && bash -n tests/test-guideline-cite.sh && bash -n tests/test-skip.sh && bash -n tests/test-saturated.sh && bash -n tests/test-ipv4-literal.sh && bash -n tests/test-design-40.sh && bash -n tests/test-phase6-doc.sh && bash -n tests/test-dynamic-reconcile.sh && bash -n skills/appstore-precheck/scripts/framework-detect.sh && bash -n skills/appstore-precheck/scripts/app-discover.sh && bash -n skills/appstore-precheck/scripts/dynamic-run.sh && bash -n skills/appstore-precheck/scripts/lib/dyn-quorum.sh && bash -n skills/appstore-precheck/scripts/lib/dyn-device.sh && bash -n skills/appstore-precheck/scripts/lib/dyn-signals.sh && bash -n skills/appstore-precheck/scripts/lib/dyn-geometry.sh && bash -n skills/appstore-precheck/scripts/lib/dyn-hosts.sh && bash -n skills/appstore-precheck/scripts/lib/dyn-bundle.sh && python3 -m py_compile skills/appstore-precheck/scripts/lib/png-uniform.py && bash -n tests/test-framework-detect.sh && bash -n tests/test-app-discover.sh && bash -n tests/test-dynamic-libs.sh && bash -n tests/test-dynamic-run.sh && bash -n tests/local/run-dynamic.sh && bash -n scripts/guideline-drift.sh && bash -n skills/appstore-precheck/scripts/lib/guideline-text.sh && bash -n skills/appstore-precheck/scripts/coverage-sections.sh && bash -n skills/appstore-precheck/scripts/lib/coverage-run.sh && python3 -B scripts/lint-coverage.py"
28
+ "lint": "node --check bin/cli.js && bash -n skills/appstore-precheck/scripts/scan.sh && bash -n skills/appstore-precheck/scripts/verdict.sh && bash -n skills/appstore-precheck/scripts/phase2-precheck.sh && bash -n skills/appstore-precheck/scripts/findings.sh && bash -n skills/appstore-precheck/scripts/evidence.sh && bash -n skills/appstore-precheck/scripts/dynamic.sh && bash -n skills/appstore-precheck/scripts/guideline-cite.sh && bash -n skills/appstore-precheck/scripts/suppress.sh && bash -n hooks/fastlane-guard.sh && bash -n install.sh && bash -n tests/run.sh && bash -n tests/all.sh && bash -n tests/test-verdict.sh && bash -n tests/test-guard.sh && bash -n tests/test-config.sh && bash -n tests/test-install.sh && bash -n tests/test-phase2.sh && bash -n tests/test-cli.sh && bash -n tests/test-findings.sh && bash -n tests/test-format-json.sh && bash -n tests/test-suppress.sh && bash -n tests/test-scorecard.sh && bash -n tests/test-sdk-signals.sh && bash -n scripts/scorecard.sh && bash -n scripts/scorecard-real.sh && bash -n scripts/update-brew-formula.sh && bash -n tests/test-pack.sh && bash -n eval/run.sh && bash -n eval/validate.sh && bash -n eval/rag/ingest.sh && bash -n tests/test-rag-ingest.sh && bash -n tests/test-rag-embed.sh && bash -n tests/test-rag-gemini-client.sh && bash -n tests/test-rag-retrieve.sh && bash -n tests/test-eval-parse.sh && bash -n tests/test-rag-build-request.sh && bash -n tests/test-rag-run-guard.sh && bash -n tests/test-eval-score.sh && bash -n tests/test-evidence.sh && bash -n tests/test-guideline-cite.sh && bash -n tests/test-skip.sh && bash -n tests/test-saturated.sh && bash -n tests/test-ipv4-literal.sh && bash -n tests/test-xcode-sdk-paths.sh && bash -n tests/test-detail-order.sh && bash -n tests/test-baseline.sh && bash -n tests/test-scan-artifact.sh && bash -n skills/appstore-precheck/scripts/lib/scan-artifact.sh && bash -n tests/test-design-40.sh && bash -n tests/test-phase6-doc.sh && bash -n tests/test-dynamic-reconcile.sh && bash -n skills/appstore-precheck/scripts/framework-detect.sh && bash -n skills/appstore-precheck/scripts/app-discover.sh && bash -n skills/appstore-precheck/scripts/dynamic-run.sh && bash -n skills/appstore-precheck/scripts/lib/dyn-quorum.sh && bash -n skills/appstore-precheck/scripts/lib/dyn-device.sh && bash -n skills/appstore-precheck/scripts/lib/dyn-signals.sh && bash -n skills/appstore-precheck/scripts/lib/dyn-geometry.sh && bash -n skills/appstore-precheck/scripts/lib/dyn-hosts.sh && bash -n skills/appstore-precheck/scripts/lib/dyn-bundle.sh && python3 -m py_compile skills/appstore-precheck/scripts/lib/png-uniform.py && bash -n tests/test-framework-detect.sh && bash -n tests/test-app-discover.sh && bash -n tests/test-dynamic-libs.sh && bash -n tests/test-dynamic-run.sh && bash -n tests/local/run-dynamic.sh && bash -n scripts/guideline-drift.sh && bash -n skills/appstore-precheck/scripts/lib/guideline-text.sh && bash -n skills/appstore-precheck/scripts/coverage-sections.sh && bash -n skills/appstore-precheck/scripts/lib/coverage-run.sh && python3 -B scripts/lint-coverage.py"
29
29
  },
30
30
  "keywords": [
31
31
  "ios",
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: appstore-precheck
3
- description: Read-only pre-submission check for an iOS app before App Store review. Scans Swift and Objective-C code, fastlane metadata, screenshots, PrivacyInfo.xcprivacy, and the paywall for 72 rejection vectors, wraps Apple's official `fastlane precheck`, watches for live App Store Review Guideline drift, has Pierre explain every FAIL and WARN, then runs 56 semantic deep-review checks across Tier A, heuristic Tier B and host vision Tier C. Emits a GREEN/YELLOW/RED verdict and a `.precheck-pass` token an upload guard can gate on. Use when preparing an iOS App Store submission (before Archive, before "Submit for Review", before TestFlight, or before any `fastlane deliver/pilot/release`), or when the user mentions App Store rejection, app review, or fastlane upload.
3
+ description: Read-only pre-submission check for an iOS app before App Store review. Scans Swift and Objective-C code, fastlane metadata, screenshots, PrivacyInfo.xcprivacy, and the paywall for 77 rejection vectors, wraps Apple's official `fastlane precheck`, watches for live App Store Review Guideline drift, has Pierre explain every FAIL and WARN, then runs 56 semantic deep-review checks across Tier A, heuristic Tier B and host vision Tier C. Emits a GREEN/YELLOW/RED verdict and a `.precheck-pass` token an upload guard can gate on. Use when preparing an iOS App Store submission (before Archive, before "Submit for Review", before TestFlight, or before any `fastlane deliver/pilot/release`), or when the user mentions App Store rejection, app review, or fastlane upload.
4
4
  license: MIT
5
5
  metadata:
6
6
  author: Berkay Turk
7
- version: 1.21.0
7
+ version: 1.23.0
8
8
  allowed-tools: Bash Read Grep Glob WebFetch mcp__maestro__list_devices mcp__maestro__run mcp__maestro__inspect_screen mcp__maestro__take_screenshot mcp__maestro__cheat_sheet
9
9
  ---
10
10
 
@@ -12,7 +12,7 @@ allowed-tools: Bash Read Grep Glob WebFetch mcp__maestro__list_devices mcp__maes
12
12
 
13
13
  Optional CLI tiers and build/credential boundaries: [optional-review.md](references/optional-review.md).
14
14
 
15
- Coverage inventory: 94/104 leaf sections (90%); 94 touched, 2 positive-only; 72 static vectors, 56 deep-review checks, 20 dynamic checks, 5 vision checks, 10 human-only sections.
15
+ Coverage inventory: 94/104 leaf sections (90%); 94 touched, 2 positive-only; 77 static vectors, 9 artifact checks, 56 deep-review checks, 20 dynamic checks, 5 vision checks, 10 human-only sections.
16
16
 
17
17
  This percentage counts sections touched, not automatic verification of every requirement.
18
18
 
@@ -152,7 +152,7 @@ bash <skill-dir>/scripts/scan.sh
152
152
  bash skills/appstore-precheck/scripts/scan.sh
153
153
  ```
154
154
 
155
- Emits `FAIL:` / `WARN:` / `PASS:` / `SKIP:` lines covering 72 rejection vectors: Privacy Manifest /
155
+ Emits `FAIL:` / `WARN:` / `PASS:` / `SKIP:` lines covering 77 rejection vectors: Privacy Manifest /
156
156
  Required Reason API parity (5.1.1), purpose strings (5.1.1), ATT (5.1.2), other-platform mentions
157
157
  (2.3.10), metadata limits (2.3.7), localized parity (2.3), screenshots (2.3.3), trial &
158
158
  auto-renew disclosures (3.1.2), Restore/Terms/Privacy links (3.1.2), private API (2.5.1), minimum
@@ -177,14 +177,16 @@ strings (5.1.1(ii)), a third-party AI endpoint without a provider-naming consent
177
177
  urgency/scarcity dark patterns on the paywall (3.1.2), sentiment-gated rating prompts (5.6.1),
178
178
  forced login without a guest path (5.1.1(v)), a marketing-push SDK without an opt-out signal
179
179
  (4.5.4), and a pre-26 Xcode `LastUpgradeCheck` against the April 2026 iOS 26 SDK upload minimum
180
- (2.1), and exposure to a category Apple names as saturated in 4.3(b) (4.3). The IAP checks (8–10 and 53) are skipped automatically
180
+ (2.1), exposure to a category Apple names as saturated in 4.3(b) (4.3), and the November 2026 App Store Connect rules:
181
+ Shared Location / Dating age descriptors (2.3.6), On-Demand Resources sunset (2.1), speculative `UIRequiredDeviceCapabilities` (2.4.1) and review-notes completeness (2.1). The IAP checks (8–10 and 53) are skipped automatically
181
182
  when no in-app-purchase signals are present, and the signal-gated advisory checks (16–52) stay
182
183
  silent unless their triggering signal is found. The
183
184
  full check table is in
184
185
  [`references/methodology.md`](references/methodology.md#phase-1-rejection-vectors).
185
186
 
186
187
  The scanner is portable Bash, so you can also run it directly, outside any agent, for a quick CI
187
- or pre-commit check.
188
+ or pre-commit check. `--artifact <.app|.ipa|.xcarchive>` adds nine read-only checks on the built bundle (`artifact-*`, `evidence: artifact`, never executed);
189
+ `--save-baseline` / `--baseline <file>` accept today's FAIL/WARN findings and fail only on what is new (see methodology.md).
188
190
 
189
191
  A fourth line class, `SKIP:`, marks a check that **could not run** — a missing artifact, not a
190
192
  clean result. It is counted separately (`skip=` in `verdict.sh`, `summary.not_audited` in JSON) and
@@ -223,8 +225,10 @@ The scanner accepts an absolute `metadataDir`, so the repo is untouched (read-on
223
225
  them like any other, saying they came from the pasted listing rather than the repo. Use the second
224
226
  run's output as the Phase 1 result.
225
227
 
226
- Age rating, review notes and the demo account have no scanner rule; judge those in Phase 4 (deep
227
- review check 4) as advisory `REVIEW-FINDING` lines. If the user declines, or there is no user to ask
228
+ Age rating, review notes and the demo account are only checked for *presence* (§20 looks for
229
+ `review_information/` credentials behind a login; the opt-in `--metadata` tier in
230
+ [optional-review.md](references/optional-review.md) reports whether the listing has them, unverified);
231
+ judge their substance in Phase 4 (deep review check 4) as advisory `REVIEW-FINDING` lines. If the user declines, or there is no user to ask
228
232
  (a CI or non-interactive run), leave the listing as `SKIP` and list it under "Not audited" in
229
233
  Phase 5. **Never invent metadata to audit.**
230
234
 
@@ -2,7 +2,7 @@
2
2
  "_doc": "Baseline of Apple App Store Review Guidelines section numbers, for drift detection. Phase 0 fetches the live guidelines page and diffs its section numbers against `all_sections`; any NEW/REMOVED number => WARN: guideline-drift. This file is updated ONLY by deliberate human reconciliation (see SKILL.md Phase 0), NEVER auto-edited by the skill, otherwise the warning would be silently swallowed.",
3
3
  "source_url": "https://developer.apple.com/app-store/review/guidelines/",
4
4
  "reconciled_on": "2026-10-17",
5
- "apple_last_updated_seen": "Last Updated: October 16, 2026 (now exposed at the page footer); drift signal remains the set of section numbers. 2026-07-02: confirmed 5.6 now ends at 5.6.4 (5.6.1 App Store Reviews, 5.6.2 Developer Identity, 5.6.3 Discovery Fraud, 5.6.4 App Quality) — 5.6.5/5.6.6/5.6.7 (rating/review manipulation) were removed/consolidated; that content now lives under 5.6.1 and 5.6.3. 2026-09-01: category intro sections added as 1.0-5.0 — the live page anchors each category intro only as the bare id=\"N\" (there is no id=\"4.0\"); scripts/lib/guideline-text.sh gd_section_ids surfaces those as N.0 so Apple's \"Guideline 4.0 - Design\" (its #1 removal reason in the 2024 transparency report) is baselined, fingerprinted and citable. 4.0 is covered by deep-review check 31; 2.5.5 by scan §55. 2026-10-17: October 16, 2026 update reconciled — NEW 2.3.14 Creative Assets (human_only) and NEW 2.5.19 hidden/dormant/undocumented features (moved out of 2.3.1; obfuscation to hide features => removal + account termination; scan §72 review-mode-gate). 1.2 now names AI content creation apps and nonconsensual intimate imagery (scan §22). 3.1.1(a) links go to a \"permitted destination\" (scan §15). Section 5 intro: violators are also blocked from alternative distribution. Remaining text drift was e.g. -> such as wording.",
5
+ "apple_last_updated_seen": "Last Updated: October 16, 2026 (now exposed at the page footer); drift signal remains the set of section numbers. 2026-07-02: confirmed 5.6 now ends at 5.6.4 (5.6.1 App Store Reviews, 5.6.2 Developer Identity, 5.6.3 Discovery Fraud, 5.6.4 App Quality) — 5.6.5/5.6.6/5.6.7 (rating/review manipulation) were removed/consolidated; that content now lives under 5.6.1 and 5.6.3. 2026-09-01: category intro sections added as 1.0-5.0 — the live page anchors each category intro only as the bare id=\"N\" (there is no id=\"4.0\"); scripts/lib/guideline-text.sh gd_section_ids surfaces those as N.0 so Apple's \"Guideline 4.0 - Design\" (its #1 removal reason in the 2024 transparency report) is baselined, fingerprinted and citable. 4.0 is covered by deep-review check 31; 2.5.5 by scan §55. 2026-10-17: October 16, 2026 update reconciled — NEW 2.3.14 Creative Assets (human_only) and NEW 2.5.19 hidden/dormant/undocumented features (moved out of 2.3.1; obfuscation to hide features => removal + account termination; scan §72 review-mode-gate). 1.2 now names AI content creation apps and nonconsensual intimate imagery (scan §22). 3.1.1(a) links go to a \"permitted destination\" (scan §15). Section 5 intro: violators are also blocked from alternative distribution. Remaining text drift was e.g. -> such as wording. 2026-11-26: guideline text unchanged since October 16, 2026; App Store Connect changes of November 2026 (Shared Location + Dating and Relationships age descriptors due 2027-01-12, ODR sunset for new apps early 2027, App Review Help review-notes rules) encoded as scan §73-§77 under 2.3.6 / 2.1 / 2.4.1.",
6
6
  "drift_check_coverage": "Reliable for Sections 1-4 + 5.1-5.4 (high-churn regions: 2.5.x, 3.1.x, 4.7, 5.1.x). The 5.5-5.6.x tail can't be fetched (the page truncates ~5.4) and is structurally stable; review it by hand at reconciliation.",
7
7
  "covered_by_scan": [
8
8
  "1.2",
@@ -54,7 +54,9 @@
54
54
  "4.7.2",
55
55
  "5.2.4",
56
56
  "2.5.19",
57
- "4.5.3"
57
+ "4.5.3",
58
+ "2.3.6",
59
+ "2.4.1"
58
60
  ],
59
61
  "covered_by_pierre_deep_review": [
60
62
  "1.2",
@@ -1,6 +1,6 @@
1
1
  # Methodology: App Store Precheck
2
2
 
3
- Coverage inventory: 94/104 leaf sections (90%); 94 touched, 2 positive-only; 72 static vectors, 56 deep-review checks, 20 dynamic checks, 5 vision checks, 10 human-only sections.
3
+ Coverage inventory: 94/104 leaf sections (90%); 94 touched, 2 positive-only; 77 static vectors, 9 artifact checks, 56 deep-review checks, 20 dynamic checks, 5 vision checks, 10 human-only sections.
4
4
  Coverage means sections touched, not automatic verification.
5
5
 
6
6
  The detailed reference behind the skill. Read the section you need; you do not need to read this
@@ -154,6 +154,11 @@ citable like any sub-section; every link and citation resolves `N.0` back to `#N
154
154
  | 70 | **4.7.2 miniapp-native-bridge** *(advisory)* | All four signals must coexist in one file: handler, remote JS URL, evaluation and native-sensitive API. Does not resolve bridge access control. |
155
155
  | 71 | **5.2.4 apple-endorsement-claims** *(advisory)* | Narrow English endorsement/official-product patterns; authorized claims still require human confirmation. Ordinary iPhone compatibility text stays clean. |
156
156
  | 72 | **2.5.19 review-mode-gate** *(advisory)* | Review-detection / hide-for-review identifiers and remote-config keys, App Store build-flag branches, date-gated unlocks, and obfuscation tooling in dependencies or source. Store-review prompts (`SKStoreReviewController`, `requestReview`) and product-review vocabulary stay clean; a hit means "show the reviewer what ships", not proof of a hidden feature. |
157
+ | 73 | **2.3.6 shared-location-descriptor** *(advisory)* | A location API (`CLLocationManager`, location usage keys) together with copy about sharing location with other people (live location, friends on a map, people nearby). App Store Connect added the "Shared Location" age-rating content descriptor in November 2026; every app must answer the new questions by 2027-01-12 or updates are blocked. The WARN says "answer it", not "you are rated wrong". |
158
+ | 74 | **2.3.6 dating-age-descriptor** *(advisory)* | Dating / matchmaking / AI-companion wording in store metadata (name, subtitle, description, keywords, promo). The "Dating and Relationships" descriptor sets the minimum rating to 18+ (Brazil A18), so the listing and the ASC rating must agree. "Updating", puzzle "match" and CRM "relationship" wording stay clean. |
159
+ | 75 | **2.1 on-demand-resources** *(advisory)* | `NSBundleResourceRequest` / `beginAccessingResources` in source or ODR build settings (`ENABLE_ON_DEMAND_RESOURCES = YES`, initial-install / prefetch tags, asset-pack manifest URL). App Store Connect stops accepting new apps that use On-Demand Resources in early 2027; Apple's replacement is Background Assets. Existing apps keep updating for now. |
160
+ | 76 | **2.4.1 required-device-capabilities** *(advisory)* | `UIRequiredDeviceCapabilities` in the main Info.plist lists something beyond architecture / baseline entries (`arm64`, `metal`, `wifi`, …): telephony, gps, cameras, sensors, nfc. App Review Help says to declare only what the core functionality cannot work without; each extra entry shrinks the eligible device set and reviewers test on a device that has it. |
161
+ | 77 | **2.1 review-notes-completeness** *(advisory)* | Three App Review Help expectations checked against `fastlane/metadata/review_information/`: a third-party AI provider in code (§47 list) is named in the notes; auto-renewable subscription code comes with a demo account in an expired state; when the app has more than one account type (teacher/student, driver/rider, …) the notes cover every type. Missing metadata is a SKIP gap, not a WARN. |
157
162
 
158
163
  New source checks skip compiled bundles and pruned dependencies. Unreadable or incomplete
159
164
  inputs produce additive coverage gaps: source/manifest reads are bounded to 2 MiB and
@@ -289,6 +294,7 @@ actually ships:
289
294
 
290
295
  | Class | Read from | Why it sits here |
291
296
  |---|---|---|
297
+ | `artifact` | a built `.app` / `.ipa` / `.xcarchive` (`--artifact`), read without executing it | The bundle that ships, or a sibling build of it: stronger than any repository read, but not an observation of behaviour, and a simulator `.app` is still not the archive. |
292
298
  | `metadata` | `fastlane/metadata/**` | Uploaded to App Store Connect verbatim. |
293
299
  | `manifest` | `Info.plist`, `*.entitlements`, `PrivacyInfo.xcprivacy` | Ship as authored. |
294
300
  | `resource` | String Catalogs, screenshot assets | Shipped / uploaded files. |
@@ -481,6 +487,20 @@ completeness test (`is_gap_record`, convention: ids ending in `-not-audited`).
481
487
  | 70 | `miniapp-native-bridge` | source | judgment-call | — |
482
488
  | 71 | `apple-endorsement-claims` | metadata | judgment-call | — |
483
489
  | 72 | `review-mode-gate` | source | judgment-call | — |
490
+ | 73 | `shared-location-descriptor` | source | judgment-call | — |
491
+ | 74 | `dating-age-descriptor` | metadata | judgment-call | — |
492
+ | 75 | `on-demand-resources` | source | judgment-call | — |
493
+ | 76 | `required-device-capabilities` | manifest | judgment-call | — |
494
+ | 77 | `review-notes-completeness` | metadata | judgment-call | — |
495
+ | 78 | `artifact-entitlements` | artifact | judgment-call | — |
496
+ | 79 | `artifact-reason-api` | artifact | judgment-call | — |
497
+ | 80 | `artifact-private-api` | artifact | review-risk | — |
498
+ | 81 | `artifact-url-schemes` | artifact | judgment-call | — |
499
+ | 82 | `artifact-ats` | artifact | judgment-call | — |
500
+ | 83 | `artifact-sdk` | artifact | judgment-call | — |
501
+ | 84 | `artifact-embedded-sdk` | artifact | judgment-call | — |
502
+ | 85 | `artifact-executable-loading` | artifact | judgment-call | — |
503
+ | 86 | `artifact-debug` | artifact | judgment-call | — |
484
504
 
485
505
  *Generated from `scripts/evidence.sh`; `tests/test-evidence.sh` keeps it honest.*
486
506
 
@@ -582,6 +602,45 @@ which rules fire. Contribute an outcome via the "App Store outcome" issue templa
582
602
 
583
603
  ---
584
604
 
605
+ ### Artifact tier (`--artifact <path>`, alias `--ipa`)
606
+
607
+ Between the repository read and the dynamic tier sits a third kind of evidence: a **built bundle
608
+ read without being executed**. `scan.sh --artifact build/MyApp.ipa` (also a `.app` directory or an
609
+ `.xcarchive`) runs `scripts/lib/artifact-review.py` and files its nine checks as catalogued rules
610
+ §78–§86 with `evidence: artifact`:
611
+
612
+ | Rule | Guideline | What is read |
613
+ |---|---|---|
614
+ | `artifact-entitlements` | 2.1 | signed entitlements (`codesign -d --entitlements`) vs `Info.plist` and binary symbols (HealthKit, push) |
615
+ | `artifact-reason-api` | 5.1.1 | Required Reason API symbols in the Mach-O vs `PrivacyInfo.xcprivacy` declarations and approved reason codes |
616
+ | `artifact-private-api` | 2.5.1 | `otool -L` linkage against `/System/Library/PrivateFrameworks`, `nm -u` restricted symbols |
617
+ | `artifact-url-schemes` | 2.5.1 | `LSApplicationQueriesSchemes`: jailbreak-store schemes, malformed entries |
618
+ | `artifact-ats` | 1.6 | `NSAppTransportSecurity` exceptions as shipped |
619
+ | `artifact-sdk` | 2.1 | `MinimumOSVersion` vs `DTSDKName` |
620
+ | `artifact-embedded-sdk` | 5.1.1 | embedded frameworks: readable `PrivacyInfo.xcprivacy`, verified signatures |
621
+ | `artifact-executable-loading` | 2.5.2 | download + executable string pairs in the binary |
622
+ | `artifact-debug` | 2.1 | `get-task-allow`, stray `.mobileprovision`, dSYMs, test bundles, `.DS_Store` |
623
+
624
+ Status mapping: `PASS` stays PASS, `FINDING` and `NEEDS_REVIEW` become WARN (the tier says "this
625
+ bundle needs a look"; it never FAILs on its own), `SKIP` / `NOT_RUN` become SKIP with the reason
626
+ (no artifact, no `codesign` / `otool` / `nm`, unsigned simulator build). An IPA is unpacked into a
627
+ temporary directory with path-traversal and size guards; nothing is launched. The nine rules are
628
+ counted as *artifact checks*, apart from the static vectors, in the coverage inventory. Without
629
+ `--artifact` the scan output is byte-for-byte what it was.
630
+
631
+ ### Baseline (`--save-baseline <file>` / `--baseline <file>`)
632
+
633
+ A baseline is the list of FAIL/WARN findings a team has looked at and accepted for now. `scan.sh
634
+ --save-baseline .precheck-baseline.json` writes the live FAIL/WARN findings of the run as
635
+ `{rule_id, severity, file, message}`; `scan.sh --baseline .precheck-baseline.json` then treats a
636
+ finding that matches on all three of rule, file and message exactly like a `.precheck-ignore`
637
+ suppression: dropped from the text output and the verdict, kept in `--format json` with
638
+ `suppressed: true`, counted in `summary.baseline` and in the text footer `(N finding(s) matched the
639
+ baseline)`. PASS and SKIP are never baselined, so a baseline cannot hide a coverage gap. A baseline
640
+ that is missing, unreadable or not a findings file is reported on stderr and ignored. Matching is
641
+ exact on the message text on purpose: when a rule's wording changes, the finding resurfaces and is
642
+ triaged again.
643
+
585
644
  ### Optional local dynamic simulator tier
586
645
 
587
646
  Beyond the static scan and the agent-mode deep reviews, an **opt-in** local dynamic tier
@@ -618,6 +677,11 @@ Things the scanner cannot verify; confirm by hand before you submit:
618
677
  [ ] Paywall price matches App Store Connect EXACTLY (amount + currency formatting)
619
678
  [ ] Free trial is configured as an Introductory Offer in App Store Connect (not app-side only)
620
679
  [ ] Updated age-rating questionnaire (13+/16+/18+ tiers) completed in App Store Connect
680
+ [ ] November 2026 age-rating questions answered in App Store Connect: "Shared Location" and "Dating and Relationships" (Dating ⇒ 18+, Brazil A16/A18); mandatory for every app by 2027-01-12 (§73/§74 only flag the signal)
681
+ [ ] App Compliance page in App Store Connect answered where it applies (China ICP / AIGC declaration, game licence, medical device, security assessment) — no fastlane slot, human-only
682
+ [ ] Screenshots: more than half of each device set show the app in use (2 of 3, 3 of 56); vision check S4 counts, you decide
683
+ [ ] Review notes list every external service the app depends on, AI services included, and give a demo account per account type plus one with an expired subscription (§77 flags the gap)
684
+ [ ] Siri AI App Intents (developer preview, submissions from spring 2027): under-13 and EU users cannot use them — the app must still work without
621
685
  [ ] EU DSA trader status declared (required for EU distribution)
622
686
  [ ] If user data goes to a third-party AI provider: consent screen names the provider
623
687
  [ ] IPv6-only run: Internet Sharing > "Create NAT64 Network" on a Mac, every network feature works (2.5.5 — GUI-only, not automatable; §55 only greps the IPv4-literal subset)
@@ -174,7 +174,11 @@ A host with image access must directly inspect the supplied images and cite its
174
174
  `.appstore-precheck.json` → `reviewPrepNotes` if set.
175
175
  2. Flag empty notes, placeholder credentials (`test`, `demo`, `changeme`, `TBD`), or notes that
176
176
  do not explain how to reach core features (subscription paywall, Screen Time blocking, etc.).
177
- 3. If the app is not login-gated and has no account wall, mark not applicable.
177
+ 3. App Review Help (November 2026) adds three concrete expectations; scan §77 flags their absence,
178
+ you judge the substance: one working demo account per account type (teacher and student, driver
179
+ and rider); when subscriptions auto-renew, a second account whose subscription has expired; and
180
+ every external service the app depends on, AI services included, named in the notes.
181
+ 4. If the app is not login-gated and has no account wall, mark not applicable.
178
182
 
179
183
  ### 5 — 2.2 Beta / test language *(Tier B v1)*
180
184
 
@@ -202,6 +206,8 @@ A host with image access must directly inspect the supplied images and cite its
202
206
  1. Open ≥1 screenshot per primary locale.
203
207
  2. List visible features (tabs, paywall, login, maps, etc.).
204
208
  3. Flag screenshots showing features absent from the build or metadata.
209
+ 3b. Per device set, count the shots that show the app in use versus title / splash / marketing art:
210
+ App Review Help requires more than half in use (2 of 3, 3 of 4). Below that is a finding.
205
211
  4. For the full structured screenshot vision review (placeholder/empty-state, text overflow,
206
212
  wrong device frame, misleading marketing, metadata mismatch), follow
207
213
  `screenshot-vision-review.md` (sibling file in this same `references/` directory).
@@ -52,6 +52,7 @@ deep-review.
52
52
  ### S4 — Misleading marketing
53
53
  1. Determine whether each screenshot shows the app actually in use (real UI) vs pure title/splash/logo art.
54
54
  2. Flag shots that are marketing art rather than the app in use (2.3.3), or that depict a feature absent from the build (2.3.1(a)).
55
+ 3. Count per device set (iPhone, iPad): App Review Help requires more than half of the set to show the app in use (2 of 3, 3 of 4). A set below that ratio is a finding even when every single shot is defensible.
55
56
 
56
57
  ### S5 — Metadata ↔ screenshot mismatch
57
58
  1. Read the visible UI text/features and compare to the description, keywords, and promo text.
@@ -39,6 +39,10 @@
39
39
  # usually in configuration (Debug from DerivedData). So a
40
40
  # runtime observation only clears needs_build_verification
41
41
  # when it came from a release build_config; see below.
42
+ # artifact a built .app / .ipa / .xcarchive read WITHOUT executing it (--artifact).
43
+ # Stronger than any repo read (it is the bundle that ships, or a sibling
44
+ # of it) but not an observation of behaviour, and a simulator .app is
45
+ # still not the archive: see runtime (b).
42
46
  # metadata fastlane/metadata/** — uploaded to App Store Connect verbatim.
43
47
  # manifest Info.plist, *.entitlements, PrivacyInfo.xcprivacy — ship as authored.
44
48
  # resource String Catalogs, screenshot assets — shipped/uploaded files.
@@ -46,7 +50,7 @@
46
50
  # so a repo-level read is a proxy for what the archive was built with.
47
51
  # source .swift/.m/.mm/.h greps — the weakest: presence in a file is not
48
52
  # proof of presence in the shipping binary.
49
- EVIDENCE_CLASSES="runtime metadata manifest resource build-setting source"
53
+ EVIDENCE_CLASSES="runtime artifact metadata manifest resource build-setting source"
50
54
 
51
55
  # Confidence levels — who acts on the finding, and how deterministically:
52
56
  # validator-blocking Apple's automated validation (upload or App Store Connect)
@@ -68,9 +72,11 @@ GUIDELINES_BASE_URL="https://developer.apple.com/app-store/review/guidelines/"
68
72
  # plist read was. A rule may refine this for one finding with set_evidence.
69
73
  rule_evidence() {
70
74
  case "$1" in
71
- release-notes-specificity|apple-endorsement-claims ) echo metadata ;;
72
- device-restart-instructions|browser-engine|intent-handler-parity|call-filter-controls|face-authentication|document-browser-access|extension-bundle-parity|matter-extension|extension-advertising|ar-integration-depth|companion-app-required|game-center-id-sharing|miniapp-native-bridge|review-mode-gate ) echo source ;;
75
+ release-notes-specificity|apple-endorsement-claims|dating-age-descriptor|review-notes-completeness ) echo metadata ;;
76
+ device-restart-instructions|browser-engine|intent-handler-parity|call-filter-controls|face-authentication|document-browser-access|extension-bundle-parity|matter-extension|extension-advertising|ar-integration-depth|companion-app-required|game-center-id-sharing|miniapp-native-bridge|review-mode-gate|shared-location-descriptor|on-demand-resources ) echo source ;;
73
77
  metadata-emoji ) echo resource ;;
78
+ required-device-capabilities ) echo manifest ;;
79
+ artifact-* ) echo artifact ;;
74
80
  # --- metadata: read from fastlane/metadata/**, uploaded to ASC verbatim ---
75
81
  competitor-mentions|metadata-char-limits|locale-metadata-parity) echo metadata ;;
76
82
  subscription-eula-metadata|support-privacy-url|placeholder-metadata) echo metadata ;;
@@ -113,7 +119,10 @@ rule_evidence() {
113
119
  # a heuristic must never be graded above judgment-call.
114
120
  rule_confidence() {
115
121
  case "$1" in
116
- release-notes-specificity|device-restart-instructions|browser-engine|intent-handler-parity|call-filter-controls|face-authentication|document-browser-access|extension-bundle-parity|matter-extension|extension-advertising|ar-integration-depth|companion-app-required|game-center-id-sharing|metadata-emoji|miniapp-native-bridge|apple-endorsement-claims|review-mode-gate ) echo judgment-call ;;
122
+ release-notes-specificity|device-restart-instructions|browser-engine|intent-handler-parity|call-filter-controls|face-authentication|document-browser-access|extension-bundle-parity|matter-extension|extension-advertising|ar-integration-depth|companion-app-required|game-center-id-sharing|metadata-emoji|miniapp-native-bridge|apple-endorsement-claims|review-mode-gate|shared-location-descriptor|dating-age-descriptor|on-demand-resources|required-device-capabilities|review-notes-completeness ) echo judgment-call ;;
123
+ # artifact tier: a linked private framework is what 2.5.1 rejects; the rest asks for a look.
124
+ artifact-private-api ) echo review-risk ;;
125
+ artifact-* ) echo judgment-call ;;
117
126
  # --- validator-blocking: Apple's machinery refuses the build or the submission ---
118
127
  # Missing purpose string / required-reason declaration / private API -> upload
119
128
  # validation. Metadata limits, missing localized metadata, missing screenshots,
@@ -43,6 +43,15 @@ rule_slug() {
43
43
  68) echo game-center-id-sharing ;; 69) echo metadata-emoji ;;
44
44
  70) echo miniapp-native-bridge ;; 71) echo apple-endorsement-claims ;;
45
45
  72) echo review-mode-gate ;;
46
+ 73) echo shared-location-descriptor ;; 74) echo dating-age-descriptor ;;
47
+ 75) echo on-demand-resources ;; 76) echo required-device-capabilities ;;
48
+ 77) echo review-notes-completeness ;;
49
+ # 78–86: artifact tier (--artifact / --ipa), read from a built bundle, never executed.
50
+ 78) echo artifact-entitlements ;; 79) echo artifact-reason-api ;;
51
+ 80) echo artifact-private-api ;; 81) echo artifact-url-schemes ;;
52
+ 82) echo artifact-ats ;; 83) echo artifact-sdk ;;
53
+ 84) echo artifact-embedded-sdk ;; 85) echo artifact-executable-loading ;;
54
+ 86) echo artifact-debug ;;
46
55
  *) echo "" ;;
47
56
  esac
48
57
  }
@@ -175,7 +184,11 @@ _record() {
175
184
 
176
185
  # _record_suppressed <severity> <message> [<file>] [<line>]
177
186
  # Same JSONL record as _record but suppressed:true, and bumps the counter.
187
+ : "${_BASELINE_COUNT:=0}"
178
188
  _record_suppressed() {
189
+ # A --baseline match is a suppression with a different signer: count it on its own
190
+ # as well, so the footer and summary.baseline can say "accepted earlier", not "ignored".
191
+ [[ "${_SUPP_REASON:-}" == baseline ]] && _BASELINE_COUNT=$((_BASELINE_COUNT + 1))
179
192
  [[ -z "$FINDINGS_TMP" ]] && { _SUPPRESSED_COUNT=$((_SUPPRESSED_COUNT + 1)); return 0; }
180
193
  _emit "$1" "$2" "${3:-}" "${4:-}" true
181
194
  _SUPPRESSED_COUNT=$((_SUPPRESSED_COUNT + 1))
@@ -192,11 +205,11 @@ render_json() {
192
205
  . "$(dirname "${BASH_SOURCE[0]}")/thresholds.sh"
193
206
  [[ -s "$buf" ]] || { printf '%s\n' '{"findings":[]}' | jq \
194
207
  --arg v "$PRECHECK_VERSION" '{tool:"appstore-precheck",version:$v,verdict:"GREEN",
195
- summary:{fail:0,warn:0,pass:0,suppressed:0,
208
+ summary:{fail:0,warn:0,pass:0,suppressed:0,baseline:0,
196
209
  by_confidence:{"validator-blocking":0,"review-risk":0,"judgment-call":0,unclassified:0},
197
210
  needs_build_verification:0, not_audited:0},
198
211
  findings:[]}'; return 0; }
199
- jq -s --arg v "$PRECHECK_VERSION" \
212
+ jq -s --arg v "$PRECHECK_VERSION" --argjson b "${_BASELINE_COUNT:-0}" \
200
213
  --argjson fmin "$RED_FAIL_MIN" --argjson wmin "$YELLOW_WARN_MIN" '
201
214
  (map(select(.suppressed==false))) as $live
202
215
  | ($live|map(select(.severity=="FAIL"))|length) as $f
@@ -215,7 +228,7 @@ render_json() {
215
228
  | ($live|map(select(.severity=="FAIL" or .severity=="WARN"))) as $issues
216
229
  | ($issues|map(select(.needs_build_verification==true))|length) as $nb
217
230
  | {tool:"appstore-precheck", version:$v, verdict:$verdict,
218
- summary:{fail:$f, warn:$w, pass:$p, suppressed:$s,
231
+ summary:{fail:$f, warn:$w, pass:$p, suppressed:$s, baseline:$b,
219
232
  by_confidence:{
220
233
  "validator-blocking":($issues|map(select(.confidence=="validator-blocking"))|length),
221
234
  "review-risk":($issues|map(select(.confidence=="review-risk"))|length),
@@ -34,7 +34,7 @@ def scan_sources(skill):
34
34
  table = re.search(r"done <<'STATIC_GUIDELINE_TABLE'\n(.*?)\nSTATIC_GUIDELINE_TABLE", text, re.S)
35
35
  if table:
36
36
  for slug, guideline, evidence in re.findall(
37
- r'^([\w-]+)\|([1-5](?:\.\d+)+)\|(source|metadata|resource)$', table[1], re.M):
37
+ r'^([\w-]+)\|([1-5](?:\.\d+)+)\|(source|metadata|resource|manifest)$', table[1], re.M):
38
38
  if slug in slugs:
39
39
  add(result, guideline, '§%d' % slugs[slug])
40
40
  chunks = re.split(r'set_rule "([\w-]*)"', text)
@@ -44,7 +44,10 @@ def scan_sources(skill):
44
44
  continue
45
45
  for message in re.findall(r'\b(?:fail|warn|pass)\s+"((?:[^"\\]|\\.)*)"', chunks[index + 1]):
46
46
  add(result, message, '§%d' % slugs[slug])
47
- return result, len(slugs)
47
+ # The artifact tier (--artifact) is read from a built bundle, not the repository: its
48
+ # checks are catalogued rules but not static vectors, and are counted on their own.
49
+ artifact = [slug for slug in slugs if slug.startswith('artifact-')]
50
+ return result, len(slugs) - len(artifact), len(artifact)
48
51
 
49
52
 
50
53
  def table_sources(path, dynamic=False):
@@ -118,7 +121,7 @@ def deep_sources(skill, catalog):
118
121
 
119
122
 
120
123
  def sources(skill):
121
- scan, vectors = scan_sources(skill)
124
+ scan, vectors, artifact = scan_sources(skill)
122
125
  refs = skill / 'references'
123
126
  catalog = json.loads((refs / 'review-catalog.json').read_text())
124
127
  deep, deep_errors = deep_sources(skill, catalog)
@@ -133,7 +136,7 @@ def sources(skill):
133
136
  if len(numbers) != len(set(numbers)) or len(keys) != len(set(keys)):
134
137
  errors.append('duplicate deep-review number/key')
135
138
  return {'scan': scan, 'deep': deep, 'dynamic': dynamic, 'vision': vision}, {
136
- 'static_vectors': vectors, 'deep_checks': len(numbers),
139
+ 'static_vectors': vectors, 'artifact_checks': artifact, 'deep_checks': len(numbers),
137
140
  'dynamic_checks': len(registered), 'vision_checks': len(vision_ids),
138
141
  'catalog_version': catalog['version']}, errors
139
142
 
@@ -202,7 +205,7 @@ def source_details(pointers):
202
205
  def summary_line(report):
203
206
  return ('Coverage inventory: {covered}/{denominator} leaf sections ({percentage}%); '
204
207
  '{touched} touched, {positive_only} positive-only; '
205
- '{static_vectors} static vectors, {deep_checks} deep-review checks, '
208
+ '{static_vectors} static vectors, {artifact_checks} artifact checks, {deep_checks} deep-review checks, '
206
209
  '{dynamic_checks} dynamic checks, {vision_checks} vision checks, '
207
210
  '{human_only} human-only sections.').format(**report)
208
211
 
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env bash
2
+ # lib/scan-artifact.sh — the artifact tier of scan.sh (`--artifact <path>` / `--ipa <path>`).
3
+ # Runs lib/artifact-review.py (read-only: plists, entitlements, Mach-O linkage, embedded
4
+ # frameworks; nothing is launched) on a built .app, .ipa or .xcarchive and files its nine
5
+ # checks as catalogued rules §78–§86 with `artifact` evidence. Statuses map as:
6
+ # PASS -> PASS; FINDING / NEEDS_REVIEW -> WARN; SKIP / NOT_RUN -> SKIP.
7
+ # Nothing here FAILs on its own: the tier says "this bundle needs a look", the human decides.
8
+ # Sourced by scan.sh only when OPT_ARTIFACT is set. Bash 3.2; python3 + jq required.
9
+
10
+ ARTIFACT_JSON=""
11
+ if command -v python3 >/dev/null 2>&1 && command -v jq >/dev/null 2>&1; then
12
+ ARTIFACT_JSON="$(python3 -B "$SCRIPT_DIR/lib/artifact-review.py" --app "$OPT_ARTIFACT" --format json 2>/dev/null)" || ARTIFACT_JSON=""
13
+ fi
14
+
15
+ # artifact_row <check-id> -> sets ART_STATUS / ART_REASON / ART_EVIDENCE for that check.
16
+ artifact_row() {
17
+ ART_STATUS=SKIP ART_REASON="python3 or jq unavailable, or artifact-review failed" ART_EVIDENCE=""
18
+ [[ -n "$ARTIFACT_JSON" ]] || return 0
19
+ local row
20
+ row="$(printf '%s' "$ARTIFACT_JSON" | jq -c --arg id "$1" '.checks[]? | select(.check_id == $id)' 2>/dev/null | head -1)"
21
+ [[ -n "$row" ]] || { ART_REASON="artifact-review returned no row for $1"; return 0; }
22
+ ART_STATUS="$(printf '%s' "$row" | jq -r '.status')"
23
+ ART_REASON="$(printf '%s' "$row" | jq -jr '.reason' | tr '\n\r\t' ' ')"
24
+ ART_EVIDENCE="$(printf '%s' "$row" | jq -r '.evidence[]?' 2>/dev/null | head -5)"
25
+ }
26
+
27
+ # The guideline each check is filed under is literal here on purpose: the coverage
28
+ # derivation and the catalogue walk read these strings.
29
+ set_rule "artifact-entitlements"; artifact_row artifact-entitlements
30
+ case "$ART_STATUS" in PASS) pass "2.1 artifact-entitlements — $ART_REASON" ;; FINDING|NEEDS_REVIEW) warn "2.1 artifact-entitlements — $ART_REASON (read from $(basename "$OPT_ARTIFACT"), not executed)" "$OPT_ARTIFACT"; [[ -n "$ART_EVIDENCE" ]] && detail "$ART_EVIDENCE" ;; *) skip "2.1 artifact-entitlements — $ART_REASON" ;; esac
31
+ set_rule "artifact-reason-api"; artifact_row artifact-reason-api
32
+ case "$ART_STATUS" in PASS) pass "5.1.1 artifact-reason-api — $ART_REASON" ;; FINDING|NEEDS_REVIEW) warn "5.1.1 artifact-reason-api — $ART_REASON (read from $(basename "$OPT_ARTIFACT"), not executed)" "$OPT_ARTIFACT"; [[ -n "$ART_EVIDENCE" ]] && detail "$ART_EVIDENCE" ;; *) skip "5.1.1 artifact-reason-api — $ART_REASON" ;; esac
33
+ set_rule "artifact-private-api"; artifact_row artifact-private-api
34
+ case "$ART_STATUS" in PASS) pass "2.5.1 artifact-private-api — $ART_REASON" ;; FINDING|NEEDS_REVIEW) warn "2.5.1 artifact-private-api — $ART_REASON (read from $(basename "$OPT_ARTIFACT"), not executed)" "$OPT_ARTIFACT"; [[ -n "$ART_EVIDENCE" ]] && detail "$ART_EVIDENCE" ;; *) skip "2.5.1 artifact-private-api — $ART_REASON" ;; esac
35
+ set_rule "artifact-url-schemes"; artifact_row artifact-url-schemes
36
+ case "$ART_STATUS" in PASS) pass "2.5.1 artifact-url-schemes — $ART_REASON" ;; FINDING|NEEDS_REVIEW) warn "2.5.1 artifact-url-schemes — $ART_REASON (read from $(basename "$OPT_ARTIFACT"), not executed)" "$OPT_ARTIFACT"; [[ -n "$ART_EVIDENCE" ]] && detail "$ART_EVIDENCE" ;; *) skip "2.5.1 artifact-url-schemes — $ART_REASON" ;; esac
37
+ set_rule "artifact-ats"; artifact_row artifact-ats
38
+ case "$ART_STATUS" in PASS) pass "1.6 artifact-ats — $ART_REASON" ;; FINDING|NEEDS_REVIEW) warn "1.6 artifact-ats — $ART_REASON (read from $(basename "$OPT_ARTIFACT"), not executed)" "$OPT_ARTIFACT"; [[ -n "$ART_EVIDENCE" ]] && detail "$ART_EVIDENCE" ;; *) skip "1.6 artifact-ats — $ART_REASON" ;; esac
39
+ set_rule "artifact-sdk"; artifact_row artifact-sdk
40
+ case "$ART_STATUS" in PASS) pass "2.1 artifact-sdk — $ART_REASON" ;; FINDING|NEEDS_REVIEW) warn "2.1 artifact-sdk — $ART_REASON (read from $(basename "$OPT_ARTIFACT"), not executed)" "$OPT_ARTIFACT"; [[ -n "$ART_EVIDENCE" ]] && detail "$ART_EVIDENCE" ;; *) skip "2.1 artifact-sdk — $ART_REASON" ;; esac
41
+ set_rule "artifact-embedded-sdk"; artifact_row artifact-embedded-sdk
42
+ case "$ART_STATUS" in PASS) pass "5.1.1 artifact-embedded-sdk — $ART_REASON" ;; FINDING|NEEDS_REVIEW) warn "5.1.1 artifact-embedded-sdk — $ART_REASON (read from $(basename "$OPT_ARTIFACT"), not executed)" "$OPT_ARTIFACT"; [[ -n "$ART_EVIDENCE" ]] && detail "$ART_EVIDENCE" ;; *) skip "5.1.1 artifact-embedded-sdk — $ART_REASON" ;; esac
43
+ set_rule "artifact-executable-loading"; artifact_row artifact-executable-loading
44
+ case "$ART_STATUS" in PASS) pass "2.5.2 artifact-executable-loading — $ART_REASON" ;; FINDING|NEEDS_REVIEW) warn "2.5.2 artifact-executable-loading — $ART_REASON (read from $(basename "$OPT_ARTIFACT"), not executed)" "$OPT_ARTIFACT"; [[ -n "$ART_EVIDENCE" ]] && detail "$ART_EVIDENCE" ;; *) skip "2.5.2 artifact-executable-loading — $ART_REASON" ;; esac
45
+ set_rule "artifact-debug"; artifact_row artifact-debug
46
+ case "$ART_STATUS" in PASS) pass "2.1 artifact-debug — $ART_REASON" ;; FINDING|NEEDS_REVIEW) warn "2.1 artifact-debug — $ART_REASON (read from $(basename "$OPT_ARTIFACT"), not executed)" "$OPT_ARTIFACT"; [[ -n "$ART_EVIDENCE" ]] && detail "$ART_EVIDENCE" ;; *) skip "2.1 artifact-debug — $ART_REASON" ;; esac
@@ -48,7 +48,7 @@ static_guideline_gap() {
48
48
  fi
49
49
  }
50
50
 
51
- # §56–§72: slug | guideline | evidence class. Keep coverage-sections.py in sync.
51
+ # §56–§77: slug | guideline | evidence class. Keep coverage-sections.py in sync.
52
52
  while IFS='|' read -r _static_slug _static_guideline _static_evidence; do
53
53
  set_rule "$_static_slug"
54
54
  set_evidence "$_static_evidence"
@@ -77,6 +77,11 @@ metadata-emoji|4.5.6|resource
77
77
  miniapp-native-bridge|4.7.2|source
78
78
  apple-endorsement-claims|5.2.4|metadata
79
79
  review-mode-gate|2.5.19|source
80
+ shared-location-descriptor|2.3.6|source
81
+ dating-age-descriptor|2.3.6|metadata
82
+ on-demand-resources|2.1|source
83
+ required-device-capabilities|2.4.1|manifest
84
+ review-notes-completeness|2.1|metadata
80
85
  STATIC_GUIDELINE_TABLE
81
86
 
82
87
  if [[ "$STATIC_EMOJI_STATUS" != SKIP ]]; then
@@ -97,7 +97,7 @@ def context(root, metadata, main, excludes):
97
97
  except (OSError, UnicodeError, ValueError, plistlib.InvalidFileException, ExpatError) as exc:
98
98
  gaps.append(input_error(main, exc, root))
99
99
  extensions = {p: v for p, v in plists.items() if 'NSExtension' in v or 'NSAppClip' in v}
100
- return dict(root=root, metadata=metadata, main=main_data, files=files, gaps=gaps,
100
+ return dict(root=root, metadata=metadata, main=main_data, main_path=main if main_data else None, files=files, gaps=gaps,
101
101
  src=src, resources=resources, plists=plists, extensions=extensions)
102
102
 
103
103
 
@@ -347,6 +347,121 @@ def review_gate(c):
347
347
  return outcome(reason='No review-mode gate, App Store build-flag branch, date-gated unlock or obfuscation tooling signal.')
348
348
 
349
349
 
350
+ # §73–§77 — App Store Connect changes of November 2026. None of these is a guideline
351
+ # sentence; they are the submission-form and App Review Help rules Apple added around
352
+ # the October 16 guideline text: two new age-rating content descriptors (Shared
353
+ # Location, Dating and Relationships; every app must answer by 2027-01-12), the
354
+ # On-Demand Resources sunset for new apps in early 2027, and the App Review Help
355
+ # hub's review-notes expectations. All WARN, all judgment-call.
356
+ LOCATION_API = re.compile(r'\bCLLocationManager\b|\bimport\s+CoreLocation\b|request(?:WhenInUse|Always)Authorization|\bCLLocationUpdate\b')
357
+ LOCATION_KEYS = ('NSLocationWhenInUseUsageDescription', 'NSLocationAlwaysAndWhenInUseUsageDescription', 'NSLocationAlwaysUsageDescription')
358
+ LOCATION_SHARING = re.compile(
359
+ r'shar(?:e|ing)\s+(?:my\s+|your\s+|their\s+|live\s+|real-?time\s+|current\s+)*(?:location|whereabouts|position)|'
360
+ r'location\s+shar(?:e|ing)|live\s+location|(?:see|show|find|track)\s+(?:where\s+)?(?:your\s+|my\s+)?friends(?:\s+are)?(?:\s+on\s+the\s+map)?|'
361
+ r'friends?\s+(?:on\s+the\s+|nearby\s+)?map|nearby\s+(?:users|people|members|singles|friends)|people\s+(?:near|around)\s+you|'
362
+ r'share[A-Za-z]*Location|location[A-Za-z]*Shar', re.I)
363
+ DATING_TERMS = re.compile(
364
+ r'(?<![a-z])(?:dating|singles|matchmak\w*|soulmates?|hook-?ups?|flirt\w*|swipe\s+(?:right|left)|'
365
+ r'(?:ai|virtual)\s+(?:girlfriend|boyfriend|companion|partner|lover)|romantic\s+(?:partner|match(?:es)?|connections?)|'
366
+ r'find\s+(?:your\s+)?(?:love|a\s+partner|a\s+date)|meet\s+(?:local\s+)?singles)(?![a-z])', re.I)
367
+ ODR_SOURCE = re.compile(r'\bNSBundleResourceRequest\b|\b(?:conditionally)?[bB]eginAccessingResources\b|\bendAccessingResources\b')
368
+ ODR_BUILD = re.compile(r'ENABLE_ON_DEMAND_RESOURCES\s*=\s*YES|ON_DEMAND_RESOURCES_(?:INITIAL_INSTALL_TAGS|PREFETCH_ORDER)\s*=\s*"?[^;"\s]|'
369
+ r'ASSET_PACK_MANIFEST_URL_PREFIX|EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE\s*=\s*YES|\bKnownAssetTags\b')
370
+ # Capabilities every current device has, or that only state the binary's architecture.
371
+ BASELINE_CAPABILITIES = {'arm64', 'armv7', 'armv7s', 'metal', 'arkit', 'wifi', 'accelerometer', 'opengles-1', 'opengles-2', 'opengles-3'}
372
+ AI_PROVIDERS = (('OpenAI', r'api\.openai\.com|\bimport\s+OpenAI\b|\bOpenAIKit\b'),
373
+ ('Anthropic', r'api\.anthropic\.com|\bimport\s+Anthropic\b'),
374
+ ('Gemini', r'generativelanguage\.googleapis\.com|\bGoogleGenerativeAI\b|\bFirebaseVertexAI\b'),
375
+ ('Mistral', r'api\.mistral\.ai'), ('OpenRouter', r'openrouter\.ai'), ('Groq', r'api\.groq\.com'),
376
+ ('Perplexity', r'api\.perplexity\.ai'), ('Together', r'api\.together\.xyz'))
377
+ AI_IN_NOTES = re.compile(r'\bAI\b|\bLLM\b|language model|OpenAI|GPT|Anthropic|Claude|Gemini|Mistral|OpenRouter|Groq|Perplexity|Together|external service', re.I)
378
+ SUBSCRIPTION_API = re.compile(r'\.autoRenewable\b|SubscriptionInfo|\bRenewalInfo\b|subscriptionGroupIdentifier|SKProductSubscriptionPeriod|\bsubscriptionPeriod\b|Purchases\.shared\.|\bRevenueCat\b')
379
+ EXPIRED_IN_NOTES = re.compile(r'expired|lapsed|cancel+ed\s+subscription|non-?renewing|grace period|billing retry', re.I)
380
+ ROLE_WORDS = r'admin(?:istrator)?|teacher|student|parent|driver|rider|passenger|host|guest|coach|athlete|patient|doctor|clinician|therapist|provider|seller|buyer|merchant|vendor|employee|employer|manager|landlord|tenant|trainer|client|owner|moderator|organi[sz]er|attendee'
381
+ ROLE_SIGNAL = re.compile(r'(?:log\s*in|sign\s*in|log\s*on|continue|register|sign\s*up)\s+as\s+(?:an?\s+)?(' + ROLE_WORDS + r')\b|'
382
+ r'\b(' + ROLE_WORDS + r')\s+(?:account|login|log-?in|sign-?in|portal|mode|dashboard|role)\b', re.I)
383
+
384
+
385
+ def review_information(c):
386
+ folder = c['metadata'] / 'review_information'
387
+ texts = {}
388
+ if folder.is_dir() and not folder.is_symlink():
389
+ for name in ('notes', 'demo_user', 'demo_password'):
390
+ path = folder / (name + '.txt')
391
+ if path.is_file() and not path.is_symlink():
392
+ texts[name] = checked_text(path)
393
+ return folder, texts
394
+
395
+
396
+ def shared_location(c):
397
+ uses_location = hit_file(c['src'], LOCATION_API.pattern) or any(k in c['main'] for k in LOCATION_KEYS)
398
+ if not uses_location:
399
+ return outcome(reason='No location API or location usage key, so the Shared Location descriptor does not apply.')
400
+ copy = dict(c['src']); copy.update(c['resources'])
401
+ p = hit_file(copy, LOCATION_SHARING.pattern)
402
+ if not p:
403
+ for path in metadata_files(c, ['description', 'subtitle', 'promotional_text', 'keywords']):
404
+ if LOCATION_SHARING.search(checked_text(path)):
405
+ p = path
406
+ break
407
+ if p:
408
+ return outcome(True, 'Location API plus copy about sharing location with other people: App Store Connect added the "Shared Location" age-rating content descriptor in November 2026 and every app must answer the new questions by 2027-01-12 (updates are blocked until then); answer it honestly and check the resulting rating (2.3.6).', p)
409
+ return outcome(reason='Location API present but no location-sharing copy; still answer the Shared Location question in App Store Connect.')
410
+
411
+
412
+ def dating_descriptor(c):
413
+ files = metadata_files(c, ['name', 'subtitle', 'description', 'keywords', 'promotional_text'])
414
+ if not files:
415
+ return outcome(skip=True, reason='Store metadata unavailable.')
416
+ for p in files:
417
+ if DATING_TERMS.search(checked_text(p)):
418
+ return outcome(True, 'Dating / relationship / companion wording in store metadata: the "Dating and Relationships" age-rating content descriptor added in November 2026 sets the minimum rating to 18+ (Brazil A18) and every app must answer it by 2027-01-12; confirm the App Store Connect age rating and that the listing fits an 18+ app (2.3.6).', p)
419
+ return outcome(reason='No dating, matchmaking or AI-companion wording in store metadata.')
420
+
421
+
422
+ def on_demand_resources(c):
423
+ p = hit_file(c['src'], ODR_SOURCE.pattern)
424
+ if not p:
425
+ builds = {path: uncomment(text) for path, text in c['files'].items() if path.suffix == '.pbxproj'}
426
+ p = next((path for path, text in builds.items() if ODR_BUILD.search(text)), None)
427
+ if p:
428
+ return outcome(True, 'On-Demand Resources signal (NSBundleResourceRequest / asset-pack build settings): App Store Connect stops accepting new apps that use ODR in early 2027 and Apple directs developers to Background Assets; plan the migration before the first submission of a new app (2.1).', p)
429
+ return outcome(reason='No On-Demand Resources API or asset-pack build setting.')
430
+
431
+
432
+ def required_capabilities(c):
433
+ declared = c['main'].get('UIRequiredDeviceCapabilities')
434
+ if not declared:
435
+ return outcome(reason='No UIRequiredDeviceCapabilities entry; the app is offered to every compatible device.')
436
+ # Dictionary form: a false value means the capability must be ABSENT, which widens the set.
437
+ names = sorted(str(k) for k, v in declared.items() if v) if isinstance(declared, dict) else sorted(str(k) for k in declared) if isinstance(declared, list) else [str(declared)]
438
+ extra = [n for n in names if n not in BASELINE_CAPABILITIES]
439
+ if extra:
440
+ return outcome(True, 'UIRequiredDeviceCapabilities narrows the device set with ' + ', '.join(extra) + ': App Review Help says to list only capabilities the core functionality cannot work without, and reviewers test on devices that have them; drop any entry that is merely nice to have (2.4.1).', c['main_path'])
441
+ return outcome(reason='UIRequiredDeviceCapabilities lists only architecture / baseline entries.')
442
+
443
+
444
+ def review_notes(c):
445
+ if not c['metadata'].is_dir() or c['metadata'].is_symlink():
446
+ return outcome(skip=True, reason='Store metadata unavailable.')
447
+ folder, texts = review_information(c)
448
+ notes = texts.get('notes', '') # credentials files are values, not instructions
449
+ target = (folder / 'notes.txt') if 'notes' in texts else folder
450
+ provider = next((name for name, pattern in AI_PROVIDERS if hit_file(c['src'], pattern)), None)
451
+ if provider and not AI_IN_NOTES.search(notes):
452
+ return outcome(True, 'Code calls ' + provider + ' but the review notes (fastlane review_information/notes.txt) do not mention it: App Review Help asks for every external service the app depends on, AI services included, to be listed in the notes so the reviewer can exercise the feature (2.1).', target)
453
+ if hit_file(c['src'], SUBSCRIPTION_API.pattern) and not EXPIRED_IN_NOTES.search(notes):
454
+ return outcome(True, 'Auto-renewable subscription code without a demo account in an expired state: App Review Help asks for a second demo account whose subscription has expired so the reviewer can see the lapsed experience; add it to review_information/notes.txt (2.1).', target)
455
+ roles = set()
456
+ for text in list(c['src'].values()) + [checked_text(p) for p in metadata_files(c, ['description'])]:
457
+ for a, b in ROLE_SIGNAL.findall(text):
458
+ roles.add((a or b).lower())
459
+ missing = sorted(r for r in roles if not re.search(r'\b' + re.escape(r) + r'\b', notes, re.I))
460
+ if len(roles) >= 2 and missing:
461
+ return outcome(True, 'The app has more than one account type (' + ', '.join(sorted(roles)) + ') but the review notes cover only some of them; App Review Help asks for demo credentials for every account type, missing: ' + ', '.join(missing) + ' (2.1).', target)
462
+ return outcome(reason='Review notes cover the external services, subscription states and account types the code suggests.')
463
+
464
+
350
465
  CHECKS = {'release-notes-specificity': release_notes, 'device-restart-instructions': restart,
351
466
  'browser-engine': browser, 'intent-handler-parity': intents,
352
467
  'call-filter-controls': call_filter, 'face-authentication': face_auth,
@@ -355,20 +470,22 @@ CHECKS = {'release-notes-specificity': release_notes, 'device-restart-instructio
355
470
  'ar-integration-depth': ar_depth, 'companion-app-required': companion,
356
471
  'game-center-id-sharing': game_ids, 'metadata-emoji': emoji,
357
472
  'miniapp-native-bridge': miniapp, 'apple-endorsement-claims': endorsements,
358
- 'review-mode-gate': review_gate}
473
+ 'review-mode-gate': review_gate, 'shared-location-descriptor': shared_location,
474
+ 'dating-age-descriptor': dating_descriptor, 'on-demand-resources': on_demand_resources,
475
+ 'required-device-capabilities': required_capabilities, 'review-notes-completeness': review_notes}
359
476
 
360
477
 
361
478
  def evaluate(root, metadata, main, excludes):
362
479
  c = context(root, metadata, main, excludes)
363
480
  result = {}
364
- independent = {'release-notes-specificity', 'metadata-emoji', 'apple-endorsement-claims'}
481
+ independent = {'release-notes-specificity', 'metadata-emoji', 'apple-endorsement-claims', 'dating-age-descriptor'}
365
482
  if c['gaps']:
366
483
  result['_input_gaps'] = {'count': len(set(c['gaps'])), 'paths': sorted(set(c['gaps']))[:3]}
367
484
  for key, check in CHECKS.items():
368
485
  if key not in independent and not c['src']:
369
486
  result[key] = outcome(skip=True, reason='Source directory unavailable or no source files were read.')
370
487
  continue
371
- if key in {'intent-handler-parity', 'companion-app-required'} and not c['main']:
488
+ if key in {'intent-handler-parity', 'companion-app-required', 'required-device-capabilities'} and not c['main']:
372
489
  result[key] = outcome(skip=True, reason='Main Info.plist unavailable for manifest comparison.')
373
490
  continue
374
491
  try:
@@ -17,6 +17,7 @@ FORMAT="text"
17
17
  SCAN_DIR=""
18
18
  OPT_NO_RUNTIME=0 OPT_DEMO=0 OPT_ASC_VERSION="" OPT_ASC_INFO=""
19
19
  OPT_BUILD=0 OPT_APP="" OPT_METADATA=0 OPT_ASC="" OPT_URLS=0 OPT_DYN_BLOCK=0 OPT_DRY=0 OPT_OUT="" OPT_TEMP="" OPT_RAN_OK=0
20
+ OPT_BASELINE="" OPT_SAVE_BASELINE="" OPT_ARTIFACT=""
20
21
  while [[ $# -gt 0 ]]; do
21
22
  case "$1" in
22
23
  --format)
@@ -47,6 +48,18 @@ while [[ $# -gt 0 ]]; do
47
48
  --out)
48
49
  if [[ $# -lt 2 ]]; then echo "scan.sh: --out needs a path" >&2; exit 64; fi
49
50
  OPT_OUT="$2"; shift 2 ;;
51
+ --baseline)
52
+ if [[ $# -lt 2 ]]; then echo "scan.sh: --baseline needs a file" >&2; exit 64; fi
53
+ OPT_BASELINE="$2"; shift 2 ;;
54
+ --baseline=*) OPT_BASELINE="${1#*=}"; shift ;;
55
+ --save-baseline)
56
+ if [[ $# -lt 2 ]]; then echo "scan.sh: --save-baseline needs a file" >&2; exit 64; fi
57
+ OPT_SAVE_BASELINE="$2"; shift 2 ;;
58
+ --save-baseline=*) OPT_SAVE_BASELINE="${1#*=}"; shift ;;
59
+ --artifact|--ipa)
60
+ if [[ $# -lt 2 ]]; then echo "scan.sh: $1 needs a .app, .ipa or .xcarchive path" >&2; exit 64; fi
61
+ OPT_ARTIFACT="$2"; shift 2 ;;
62
+ --artifact=*|--ipa=*) OPT_ARTIFACT="${1#*=}"; shift ;;
50
63
  *) shift ;;
51
64
  esac
52
65
  done
@@ -59,6 +72,11 @@ if [[ -n "$SCAN_DIR" ]]; then
59
72
  else
60
73
  ROOT="$(git rev-parse --show-toplevel 2>/dev/null)" || ROOT="$(pwd)"
61
74
  fi
75
+ # Option paths are the caller's, not the scanned repo's: make them absolute before cd.
76
+ for _opt in OPT_BASELINE OPT_SAVE_BASELINE OPT_ARTIFACT; do
77
+ eval "_v=\${$_opt}"
78
+ if [[ -n "$_v" && "$_v" != /* ]]; then eval "$_opt=\"\$PWD/\$_v\""; fi
79
+ done
62
80
  cd "$ROOT" || { echo "FAIL: repo-root — could not enter repository root"; exit 0; }
63
81
 
64
82
  source "$SCRIPT_DIR/findings.sh"
@@ -116,8 +134,8 @@ _tag() {
116
134
  [[ -n "$lbl" ]] && printf ' %s\n' "$lbl"
117
135
  return 0
118
136
  }
119
- fail() { if is_suppressed "$_CURRENT_RULE" "${2:-}" "${3:-}"; then _record_suppressed FAIL "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=1; else echo "FAIL: $1"; _record FAIL "$1" "${2:-}" "${3:-}"; _tag; _LAST_SUPPRESSED=0; fi; }
120
- warn() { if is_suppressed "$_CURRENT_RULE" "${2:-}" "${3:-}"; then _record_suppressed WARN "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=1; else echo "WARN: $1"; _record WARN "$1" "${2:-}" "${3:-}"; _tag; _LAST_SUPPRESSED=0; fi; }
137
+ fail() { if is_suppressed "$_CURRENT_RULE" "${2:-}" "${3:-}" "$1"; then _record_suppressed FAIL "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=1; else echo "FAIL: $1"; _record FAIL "$1" "${2:-}" "${3:-}"; _tag; _LAST_SUPPRESSED=0; fi; }
138
+ warn() { if is_suppressed "$_CURRENT_RULE" "${2:-}" "${3:-}" "$1"; then _record_suppressed WARN "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=1; else echo "WARN: $1"; _record WARN "$1" "${2:-}" "${3:-}"; _tag; _LAST_SUPPRESSED=0; fi; }
121
139
  pass() { if is_suppressed "$_CURRENT_RULE" "${2:-}" "${3:-}"; then _record_suppressed PASS "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=1; else echo "PASS: $1"; _record PASS "$1" "${2:-}" "${3:-}"; _LAST_SUPPRESSED=0; fi; }
122
140
 
123
141
  # skip <message> — a check that could NOT run (a missing artifact, not a clean
@@ -161,6 +179,9 @@ SRC_INC=( --include='*.swift' --include='*.m' --include='*.mm' --include='*.h' )
161
179
  # Load .precheck-ignore path exclusions (Task 2 suppress.sh) and extend both
162
180
  # prune sets so a suppressed path is skipped by detection AND grep passes.
163
181
  load_precheck_ignore "$ROOT"
182
+ # --baseline <file>: findings recorded by an earlier --save-baseline are treated like
183
+ # a .precheck-ignore suppression (counted, kept in JSON, dropped from text + verdict).
184
+ [[ -n "$OPT_BASELINE" ]] && load_baseline "$OPT_BASELINE"
164
185
  while IFS= read -r _g; do
165
186
  [[ -z "$_g" ]] && continue
166
187
  PRUNE+=( -not -path "*/$_g/*" -not -path "$_g/*" )
@@ -945,7 +966,7 @@ fi
945
966
  set_rule "misleading-marketing"
946
967
  if [[ -d "$META_DIR" ]]; then
947
968
  mislead_re='virus scan|virus scanner|antivirus|anti-virus|malware (scan|remov|clean)|spyware remov|clean your (iphone|device)|speed booster|boost.*(speed|ram)|free money|guaranteed.*(win|prize)'
948
- mislead_hits=$(grep -rEniI "$mislead_re" "$META_DIR" 2>/dev/null | grep -v "^Binary file" | head -10)
969
+ mislead_hits=$(grep -rEniI "$mislead_re" "$META_DIR" 2>/dev/null | grep -v "^Binary file" | LC_ALL=C sort -t: -k1,1 -k2,2n | head -10)
949
970
  if [[ -n "$mislead_hits" ]]; then
950
971
  mislead_file="$(printf '%s\n' "$mislead_hits" | head -1 | cut -d: -f1)"
951
972
  warn "2.3.1 Misleading marketing — claims that often violate 2.3.1 (e.g. iOS virus/malware scanners, fake speed boosters) in metadata; verify the app truly delivers them or remove the claim:" "$mislead_file"
@@ -961,7 +982,7 @@ fi
961
982
  set_rule "kids-wording"
962
983
  if [[ -d "$META_DIR" ]]; then
963
984
  kids_re='for kids|for children|for your (kid|child)|kids[[:space:]]?app|für kinder|para niños|pour enfants'
964
- kids_hits=$(grep -rEniI "$kids_re" "$META_DIR" 2>/dev/null | grep -v "^Binary file" | head -10)
985
+ kids_hits=$(grep -rEniI "$kids_re" "$META_DIR" 2>/dev/null | grep -v "^Binary file" | LC_ALL=C sort -t: -k1,1 -k2,2n | head -10)
965
986
  # Cross-gate with §39 (5.1.4): when an ads/analytics SDK is also linked, §39 fires the
966
987
  # more specific Kids finding for the same wording signal — don't double-count it here
967
988
  # (one root signal must not cost two WARNs against the 5-WARN YELLOW threshold).
@@ -1174,7 +1195,7 @@ fi
1174
1195
  set_rule "realmoney-gambling"
1175
1196
  if [[ -d "$META_DIR" ]]; then
1176
1197
  gamble_re='real[ -]?money|gambling|casino|sportsbook|sports[ -]?betting|place[ -].*bets|wager(ing)?|roulette.*real'
1177
- gamble_hits=$(grep -rEniI "$gamble_re" "$META_DIR" 2>/dev/null | grep -v "^Binary file" | head -10)
1198
+ gamble_hits=$(grep -rEniI "$gamble_re" "$META_DIR" 2>/dev/null | grep -v "^Binary file" | LC_ALL=C sort -t: -k1,1 -k2,2n | head -10)
1178
1199
  if [[ -n "$gamble_hits" ]]; then
1179
1200
  gamble_first="$(printf '%s\n' "$gamble_hits" | head -1)" # "path:line:match"
1180
1201
  gamble_file="${gamble_first%%:*}"
@@ -1579,8 +1600,8 @@ fi
1579
1600
  # tracks "upgrade to recommended settings", not the actual toolchain, so this
1580
1601
  # is WARN-verify only, and only fires when the value is clearly pre-26.
1581
1602
  set_rule "xcode-sdk-requirement"
1582
- last_upgrade=$(find . "${PRUNE[@]}" -name 'project.pbxproj' -type f 2>/dev/null | head -5 \
1583
- | xargs grep -h 'LastUpgradeCheck' 2>/dev/null | grep -oE '[0-9]+' | sort -n | tail -1)
1603
+ last_upgrade=$(find . "${PRUNE[@]}" -name 'project.pbxproj' -type f -print0 2>/dev/null \
1604
+ | xargs -0 grep -h 'LastUpgradeCheck' 2>/dev/null | grep -oE '[0-9]+' | sort -n | tail -1)
1584
1605
  if [[ -n "$last_upgrade" ]] && (( last_upgrade < 2600 )); then
1585
1606
  warn "2.1 Xcode/SDK minimum — LastUpgradeCheck=$last_upgrade suggests the project was last upgraded with a pre-26 Xcode; since April 2026 App Store uploads must be built with the iOS 26 SDK (Xcode 26) or they are auto-rejected at upload. Verify the actual build toolchain (heuristic: this field tracks the upgrade-check, not the build)"
1586
1607
  fi
@@ -1602,7 +1623,7 @@ fi
1602
1623
  set_rule "saturated-category"
1603
1624
  if [[ -d "$META_DIR" ]]; then
1604
1625
  # Word-boundary anchored so 'fart' does not match 'farther', nor 'dating' 'updating'.
1605
- sat_re='(^|[^a-z])(dating|flashlight|sound effects?|wallpapers?|fortune telling|fortune teller|drinking games?|kama sutra|fart|burp)([^a-z]|$)'
1626
+ sat_re='(^|[^a-z])(dating|flashlight|sound effects?|wallpapers?|simple timers?|fortune telling|fortune teller|drinking games?|kama sutra|fart|burp)([^a-z]|$)'
1606
1627
  sat_hits=""
1607
1628
  for loc in "${LOCALES[@]+"${LOCALES[@]}"}"; do
1608
1629
  for mf in name.txt subtitle.txt keywords.txt; do
@@ -1639,8 +1660,10 @@ if [[ -n "$IOS_DIR" ]]; then
1639
1660
  # The trailing class also rejects the IPv6-capable siblings (sockaddr_in6, AF_INET6,
1640
1661
  # gethostbyname2) because their next character is alphanumeric.
1641
1662
  ipv4_api_re='(^|[^A-Za-z0-9_])(inet_addr|inet_aton|gethostbyname|sockaddr_in|AF_INET)([^A-Za-z0-9_]|$)'
1663
+ # Sorted by path then line before the cap: grep -r walks directories in filesystem
1664
+ # order (APFS and ext4 differ), and the golden tests pin this text verbatim.
1642
1665
  ipv4_api_hits=$(grep -rnEI "$ipv4_api_re" "$IOS_DIR" "${GREP_PRUNE[@]}" "${SRC_INC[@]}" 2>/dev/null \
1643
- | grep -vE '^[^:]+:[0-9]+:[[:space:]]*(//|\*|/\*|#)' | head -5)
1666
+ | grep -vE '^[^:]+:[0-9]+:[[:space:]]*(//|\*|/\*|#)' | LC_ALL=C sort -t: -k1,1 -k2,2n | head -5)
1644
1667
  # Literals: dotted quads in source AND plists (ATS exception domains, endpoints).
1645
1668
  # Pre-filter with grep, then let awk apply the exclusions per match. No brace
1646
1669
  # intervals in the awk regexes: mawk (Ubuntu CI) does not support them.
@@ -1668,9 +1691,9 @@ if [[ -n "$IOS_DIR" ]]; then
1668
1691
  }
1669
1692
  }' "$ipv4_f" 2>/dev/null | head -2)
1670
1693
  [[ -n "$ipv4_h" ]] && ipv4_lit_hits+="$ipv4_h"$'\n'
1671
- done < <(grep -rlE '(^|[^0-9])[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}([^0-9]|$)' "$IOS_DIR" "${GREP_PRUNE[@]}" "${SRC_INC[@]}" --include='*.plist' 2>/dev/null | head -50)
1694
+ done < <(grep -rlE '(^|[^0-9])[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}([^0-9]|$)' "$IOS_DIR" "${GREP_PRUNE[@]}" "${SRC_INC[@]}" --include='*.plist' 2>/dev/null | LC_ALL=C sort | head -50)
1672
1695
  ipv4_lit_hits="$(printf '%s' "$ipv4_lit_hits" | grep -v '^$' | head -5)"
1673
- ipv4_hits="$(printf '%s\n%s\n' "$ipv4_api_hits" "$ipv4_lit_hits" | grep -v '^$')"
1696
+ ipv4_hits="$(printf '%s\n%s\n' "$ipv4_api_hits" "$ipv4_lit_hits" | grep -v '^$' | LC_ALL=C sort -t: -k1,1 -k2,2n -k3)"
1674
1697
  if [[ -n "$ipv4_hits" ]]; then
1675
1698
  ipv4_n="$(printf '%s\n' "$ipv4_hits" | wc -l | tr -d ' ')"
1676
1699
  ipv4_first="$(printf '%s\n' "$ipv4_hits" | head -1)"
@@ -1685,10 +1708,21 @@ fi
1685
1708
  # shellcheck source=skills/appstore-precheck/scripts/lib/scan-guidelines.sh
1686
1709
  source "$SCRIPT_DIR/lib/scan-guidelines.sh"
1687
1710
 
1711
+ # --artifact / --ipa: the nine read-only artifact-review checks on a built
1712
+ # .app / .ipa / .xcarchive, as catalogued rules with `artifact` evidence.
1713
+ if [[ -n "$OPT_ARTIFACT" ]]; then
1714
+ # shellcheck source=skills/appstore-precheck/scripts/lib/scan-artifact.sh
1715
+ source "$SCRIPT_DIR/lib/scan-artifact.sh"
1716
+ fi
1717
+
1688
1718
  optin_run || exit $?
1719
+ [[ -n "$OPT_SAVE_BASELINE" ]] && save_baseline "$OPT_SAVE_BASELINE"
1689
1720
  echo "---END-OF-SCAN---"
1690
1721
  if [[ "$FORMAT" == text && "${_SUPPRESSED_COUNT:-0}" -gt 0 ]]; then
1691
- printf '(%s finding(s) suppressed via .precheck-ignore)\n' "$_SUPPRESSED_COUNT"
1722
+ printf '(%s finding(s) suppressed via .precheck-ignore)\n' "$((_SUPPRESSED_COUNT - ${_BASELINE_COUNT:-0}))"
1723
+ fi
1724
+ if [[ "$FORMAT" == text && "${_BASELINE_COUNT:-0}" -gt 0 ]]; then
1725
+ printf '(%s finding(s) matched the baseline %s)\n' "$_BASELINE_COUNT" "$OPT_BASELINE"
1692
1726
  fi
1693
1727
  if [[ "$FORMAT" == json ]]; then exec 1>&4 4>&-; render_json | coverage_run_json | optin_render_json;
1694
1728
  elif [[ "$FORMAT" == sarif ]]; then exec 1>&4 4>&-; render_sarif; fi
@@ -6,6 +6,8 @@ _SUPP_RULES="" # rule-ids suppressed everywhere, one per line
6
6
  _SUPP_RULE_PATH="" # "rule<TAB>glob" per line
7
7
  _SUPP_PATHS="" # path globs excluded from scanning, one per line (trailing / stripped)
8
8
  _SUPP_REASON="" # set by is_suppressed on a hit
9
+ _BASE_KEYS="" # "rule<TAB>file<TAB>message" per line, from --baseline
10
+ _BASE_FILE=""
9
11
 
10
12
  # _is_catalog_rule <token> -> 0 if token is a known rule slug.
11
13
  # The bound is derived from the catalog itself (rule_slug returns "" past the
@@ -54,6 +56,33 @@ load_precheck_ignore() {
54
56
  done < "$file"
55
57
  }
56
58
 
59
+ # load_baseline <file> — read a --save-baseline file. Problems are reported on stderr
60
+ # and leave the scan untouched: a baseline that cannot be read must never hide anything.
61
+ load_baseline() {
62
+ local file="$1" keys
63
+ _BASE_KEYS=""; _BASE_FILE="$file"
64
+ if [[ ! -f "$file" ]]; then printf 'scan.sh: baseline file not found: %s (ignored)\n' "$file" >&2; return 0; fi
65
+ if ! command -v jq >/dev/null 2>&1; then printf 'scan.sh: --baseline needs jq (ignored)\n' >&2; return 0; fi
66
+ # Fields are joined with US (0x1f) and newlines inside a message flattened to spaces, the
67
+ # same normalisation is_suppressed applies to the live message, so the two keys agree.
68
+ keys="$(jq -r '.findings[]? | select(.rule_id != null and .message != null) | [.rule_id, (.file // ""), (.message | gsub("\n"; " "))] | join("\u001f")' "$file" 2>/dev/null)" \
69
+ || { printf 'scan.sh: baseline is not a findings JSON file: %s (ignored)\n' "$file" >&2; return 0; }
70
+ _BASE_KEYS="$keys"
71
+ }
72
+
73
+ # save_baseline <file> — write the live FAIL/WARN findings of this run as a baseline.
74
+ # Reads the JSONL findings buffer, so it works in text and json mode alike.
75
+ save_baseline() {
76
+ local file="$1"
77
+ if ! command -v jq >/dev/null 2>&1; then printf 'scan.sh: --save-baseline needs jq\n' >&2; return 0; fi
78
+ [[ -s "${FINDINGS_TMP:-}" ]] || printf '' > "${FINDINGS_TMP:-/dev/null}"
79
+ jq -s --arg v "${PRECHECK_VERSION:-dev}" --arg d "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
80
+ '{tool:"appstore-precheck", version:$v, created:$d,
81
+ findings: [ .[] | select(.suppressed == false and (.severity == "FAIL" or .severity == "WARN"))
82
+ | {rule_id, severity, file, message} ]}' "$FINDINGS_TMP" > "$file" 2>/dev/null \
83
+ || printf 'scan.sh: could not write the baseline %s\n' "$file" >&2
84
+ }
85
+
57
86
  # precheck_prune_globs -> one path glob per line (for scan.sh PRUNE/GREP_PRUNE).
58
87
  precheck_prune_globs() { printf '%s' "$_SUPP_PATHS"; }
59
88
 
@@ -66,10 +95,14 @@ _inline_marker() {
66
95
  [[ "$spec" == "$rule" ]] # scoped marker must match
67
96
  }
68
97
 
69
- # is_suppressed <rule> <file> <line> -> 0 if suppressed (+ _SUPP_REASON), else 1.
98
+ # is_suppressed <rule> <file> <line> [<message>] -> 0 if suppressed (+ _SUPP_REASON), else 1.
99
+ # The message is passed only for FAIL/WARN: a baseline match needs rule + file + text.
70
100
  is_suppressed() {
71
- local rule="$1" file="${2:-}" line="${3:-}" r g target
101
+ local rule="$1" file="${2:-}" line="${3:-}" msg="${4:-}" r g target
72
102
  _SUPP_REASON=""
103
+ if [[ -n "$msg" && -n "$_BASE_KEYS" ]] && printf '%s\n' "$_BASE_KEYS" | grep -qxF "$(printf '%s\037%s\037%s' "$rule" "$file" "${msg//$'\n'/ }")"; then
104
+ _SUPP_REASON="baseline"; return 0
105
+ fi
73
106
  if [[ -n "$rule" ]] && printf '%s\n' "$_SUPP_RULES" | grep -qxF "$rule"; then
74
107
  _SUPP_REASON="rule:$rule"; return 0
75
108
  fi