appstore-precheck 1.20.0 → 1.20.1

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,16 @@ All notable changes to this project are documented here. Versioning follows
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.20.1] — 2026-10-02
9
+
10
+ ### Fixed
11
+ - Static readers skip special files without blocking, bound quoted-string matching, and omit absolute paths from input-error reasons. Repository-wide `grep` passes skip FIFOs and devices (`-D skip`), so a stray named pipe no longer hangs the default scan.
12
+ - Empty release notes recognize initial versions from Info.plist or MARKETING_VERSION; document-browser warnings require file access, list UI, and a browser title together.
13
+ - Exploration artifacts refuse symlink targets. Demo credentials are redacted by value; secure-field detection is not relied on.
14
+ - Modular SKIP summaries count checks separately from supplemental gaps and group their reasons. A shared execution table remains cross-validated against section coverage.
15
+ - Explicit `--dynamic-blocking` requires jq and exits 64 when it is unavailable.
16
+ - Legacy shell assertions use shared helpers with synthetic failure probes on Bash 3.2.
17
+
8
18
  ## [1.20.0] — 2026-10-02
9
19
 
10
20
  ### Guideline section coverage 45 → 93 of 102 leaf rules (91%)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appstore-precheck",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
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)",
@@ -4,7 +4,7 @@ description: Read-only pre-submission check for an iOS app before App Store revi
4
4
  license: MIT
5
5
  metadata:
6
6
  author: Berkay Turk
7
- version: 1.20.0
7
+ version: 1.20.1
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
 
@@ -408,6 +408,8 @@ device and never touches an existing one or the repo, but the launched app reach
408
408
  and receives the demo credentials you supplied — tell the user so before the first launch. It
409
409
  requires macOS + Xcode + a simulator runtime and is permanently local-only (it cannot run in CI).
410
410
  It is a pre-submit local smoke signal, not a TestFlight / crash-reporter / QA replacement.
411
+ The separate `scan.sh --dynamic-blocking` opt-in requires jq; without it the scanner exits 64
412
+ with `--dynamic-blocking needs jq` before optional work.
411
413
 
412
414
  **Getting a build without building.** Never run `xcodebuild` / `flutter build` / `gradle`. Run
413
415
  `bash <skill-dir>/scripts/app-discover.sh --repo <repo> --json`: it lists the simulator `.app`
@@ -69,7 +69,8 @@ reporter, or real-device QA.
69
69
  - **Determinism before findings.** The launch checks run **N=3 times**, each on a freshly erased
70
70
  device; a `DYNAMIC-FINDING` for a crash needs **3/3**. Mixed evidence is not unanimous and stays SKIP with its counts; fewer than three repeats
71
71
  or any unreadable repeat also stays SKIP. Blocking is off by default; explicit `--dynamic-blocking`
72
- uses only the documented fresh unanimous launch/login allowlist.
72
+ uses only the documented fresh unanimous launch/login allowlist. `scan.sh --dynamic-blocking`
73
+ requires jq; if unavailable it exits 64 with `--dynamic-blocking needs jq` before optional work.
73
74
  - **One flow per Maestro invocation.** The iOS 26 driver misbehaves in batch mode (Maestro issues
74
75
  #3254 / #3318): every `mcp__maestro__run` call carries exactly one flow; the runner reads the
75
76
  hierarchy with one `maestro hierarchy` call at a time.
@@ -31,6 +31,12 @@ def scan_sources(skill):
31
31
  result = {}
32
32
  for text in [entry] + [(scripts / name).read_text() for name in modules]:
33
33
  text = '\n'.join(line for line in text.splitlines() if not line.lstrip().startswith('#'))
34
+ table = re.search(r"done <<'STATIC_GUIDELINE_TABLE'\n(.*?)\nSTATIC_GUIDELINE_TABLE", text, re.S)
35
+ if table:
36
+ for slug, guideline, evidence in re.findall(
37
+ r'^([\w-]+)\|([1-5](?:\.\d+)+)\|(source|metadata|resource)$', table[1], re.M):
38
+ if slug in slugs:
39
+ add(result, guideline, '§%d' % slugs[slug])
34
40
  chunks = re.split(r'set_rule "([\w-]*)"', text)
35
41
  for index in range(1, len(chunks), 2):
36
42
  slug = chunks[index]
@@ -9,7 +9,6 @@ import collections
9
9
  import hashlib
10
10
  import importlib.util
11
11
  import json
12
- import os
13
12
  import pathlib
14
13
  import re
15
14
  import subprocess
@@ -90,6 +89,7 @@ _scrub_spec = importlib.util.spec_from_file_location('dyn_scrub', pathlib.Path(_
90
89
  _scrub = importlib.util.module_from_spec(_scrub_spec)
91
90
  _scrub_spec.loader.exec_module(_scrub)
92
91
  scrub_tree = _scrub.scrub_tree
92
+ _safe_write = _scrub.sibling('safe_write')
93
93
 
94
94
 
95
95
  def summarize(tree, name, screenshot=None, timestamp=None):
@@ -225,7 +225,7 @@ def navigate(udid, bundle_id, path, out, deadline):
225
225
  flow = private / 'navigation-flow.yaml'
226
226
  content = 'appId: ' + json.dumps(bundle_id) + '\n---\n- launchApp:\n clearState: false\n'
227
227
  content += ''.join('- tapOn:\n text: ' + json.dumps('^' + re.escape(label) + '$') + '\n' for label in path)
228
- flow.write_text(content)
228
+ _safe_write.write_text(flow, content)
229
229
  flow.chmod(0o600)
230
230
  command(['maestro', '--device', udid, 'test', '--debug-output', str(private / 'debug'),
231
231
  '--test-output-dir', str(private / 'output'), str(flow)],
@@ -235,11 +235,15 @@ def navigate(udid, bundle_id, path, out, deadline):
235
235
  def capture_screen(udid, out, name, deadline, authenticated=False, allowed=None):
236
236
  raw = command(['maestro', '--device', udid, 'hierarchy'], min(45, max(.01, deadline-time.monotonic())), cwd=out)
237
237
  tree = scrub_tree(json.loads(raw), authenticated=authenticated, allowed=allowed)
238
- (out / (name + '.json')).write_text(json.dumps(tree, indent=2))
238
+ _safe_write.write_text(out / (name + '.json'), json.dumps(tree, indent=2))
239
239
  png = None if authenticated else name + '.png'
240
240
  try:
241
241
  if png:
242
- command(['xcrun', 'simctl', 'io', udid, 'screenshot', '--type=png', str(out / png)], min(15, max(.01, deadline-time.monotonic())), cwd=out)
242
+ with tempfile.TemporaryDirectory(prefix='.screenshot-', dir=str(out)) as temporary:
243
+ image = pathlib.Path(temporary) / png
244
+ command(['xcrun', 'simctl', 'io', udid, 'screenshot', '--type=png', str(image)],
245
+ min(15, max(.01, deadline-time.monotonic())), cwd=out)
246
+ _safe_write.write_bytes(out / png, image.read_bytes())
243
247
  except (OSError, subprocess.SubprocessError):
244
248
  png = None
245
249
  screen = summarize(tree, name, png, time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()))
@@ -304,7 +308,7 @@ def main():
304
308
  screens = live_explore(args.udid, args.bundle_id, out, args.max_screens, args.seconds, authorization, args.authenticated)
305
309
  report = {'schema_version': 1, 'screens': screens, 'checks': evaluate(screens, {}),
306
310
  'screen_budget': args.max_screens, 'time_budget_seconds': args.seconds}
307
- (out / 'screen-inventory.json').write_text(json.dumps(report, indent=2) + '\n')
311
+ _safe_write.write_text(out / 'screen-inventory.json', json.dumps(report, indent=2) + '\n')
308
312
  print(json.dumps(report)); return 0
309
313
 
310
314
 
@@ -37,9 +37,7 @@ def scrub_tree(value, authenticated=False, allowed=None, key=''):
37
37
  if isinstance(value, list):
38
38
  return [scrub_tree(x, authenticated, allowed, key) for x in value]
39
39
  if isinstance(value, dict):
40
- secure = any('securetextfield' in str(value.get(k, '')).lower() for k in ('type', 'class'))
41
- return {scrub_text(k): ('[redacted]' if secure and k in ('text', 'value', 'accessibilityText', 'label')
42
- else scrub_tree(v, authenticated, allowed, k)) for k, v in value.items()}
40
+ return {scrub_text(k): scrub_tree(v, authenticated, allowed, k) for k, v in value.items()}
43
41
  return value
44
42
 
45
43
 
@@ -7,7 +7,15 @@ optin_trust() {
7
7
  fi
8
8
  }
9
9
 
10
+ optin_blocking_tools() {
11
+ if [[ "${OPT_DYN_BLOCK:-0}" == 1 ]] && ! command -v jq >/dev/null 2>&1; then
12
+ echo 'scan.sh: --dynamic-blocking needs jq' >&2
13
+ return 64
14
+ fi
15
+ }
16
+
10
17
  optin_validate() {
18
+ optin_blocking_tools || return $?
11
19
  [[ "$OPT_BUILD" != 1 || -z "$OPT_APP" ]] || { echo 'scan.sh: choose --build or --app' >&2; return 64; }
12
20
  if [[ "$OPT_DEMO" == 1 || "$OPT_DYN_BLOCK" == 1 ]]; then
13
21
  [[ "$OPT_NO_RUNTIME" != 1 && ( "$OPT_BUILD" == 1 || -n "$OPT_APP" ) ]] || { echo 'scan.sh: runtime flags need --build/--app and cannot use --no-runtime' >&2; return 64; }
@@ -24,6 +32,7 @@ PY
24
32
  }
25
33
 
26
34
  optin_run() {
35
+ optin_blocking_tools || return $?
27
36
  [[ "$OPT_BUILD" == 1 || -n "$OPT_APP" || "$OPT_METADATA" == 1 ]] || return 0
28
37
  if ! command -v python3 >/dev/null 2>&1; then
29
38
  set_rule 'opt-in-review'; skip 'opt-in review — Python 3 required'; return 0
@@ -50,9 +59,6 @@ optin_run() {
50
59
  fi
51
60
  OPT_RAN_OK=1
52
61
  [[ "$FORMAT" != text ]] || printf 'OPT-IN: report — %s/summary.json\n' "$OPT_OUT"
53
- if [[ "$OPT_DYN_BLOCK" == 1 ]] && ! command -v jq >/dev/null 2>&1; then
54
- set_rule 'dynamic-blocking'; skip 'dynamic blocking — jq unavailable; no blocking conclusions imported'; return 0
55
- fi
56
62
  if [[ "$OPT_DYN_BLOCK" == 1 ]]; then
57
63
  while IFS= read -r line; do
58
64
  [[ -n "$line" ]] || continue
@@ -33,6 +33,15 @@ def _current_umask():
33
33
 
34
34
  def write_text(path, text, encoding="utf-8"):
35
35
  """Atomically write ``text`` to ``path``; refuse a symlink or non-regular target."""
36
+ _write(path, text, "w", encoding)
37
+
38
+
39
+ def write_bytes(path, data):
40
+ """Atomically write binary output under the same regular-file policy."""
41
+ _write(path, data, "wb", None)
42
+
43
+
44
+ def _write(path, content, stream_mode, encoding):
36
45
  target = os.path.abspath(os.fspath(path))
37
46
  mode = _existing_mode(target)
38
47
  if mode is not None and not stat.S_ISREG(mode):
@@ -43,8 +52,8 @@ def write_text(path, text, encoding="utf-8"):
43
52
  fd, temporary = tempfile.mkstemp(dir=directory, prefix="." + os.path.basename(target) + ".",
44
53
  suffix=".tmp")
45
54
  try:
46
- with os.fdopen(fd, "w", encoding=encoding) as handle:
47
- handle.write(text)
55
+ with os.fdopen(fd, stream_mode, encoding=encoding) as handle:
56
+ handle.write(content)
48
57
  handle.flush()
49
58
  os.fsync(handle.fileno())
50
59
  if hasattr(os, "chmod"):
@@ -2,12 +2,17 @@
2
2
  # Additional source checks are advisory; absent inputs remain additive coverage gaps.
3
3
  # shellcheck disable=SC2034
4
4
  COVERAGE_GAPS_JSON="${COVERAGE_GAPS_JSON:-[]}"
5
- STATIC_GAP_COUNT=0 STATIC_GAP_SLUGS="" STATIC_GAP_REASON="" STATIC_EMOJI_STATUS=SKIP
5
+ STATIC_GAP_COUNT=0 STATIC_GAP_TOTAL=0 STATIC_GAP_SLUGS="" STATIC_GAP_REASON="" STATIC_EMOJI_STATUS=SKIP
6
6
  STATIC_GUIDELINES_JSON='{}'
7
+ # The reader understands only --exclude-dir=... entries; grep-only flags such as `-D skip` stay out.
8
+ STATIC_READER_EXCLUDES=()
9
+ for _prune in "${GREP_PRUNE[@]+"${GREP_PRUNE[@]}"}"; do
10
+ case "$_prune" in --exclude-dir=*) STATIC_READER_EXCLUDES+=("$_prune") ;; esac
11
+ done
7
12
  if command -v python3 >/dev/null 2>&1 && command -v jq >/dev/null 2>&1; then
8
13
  STATIC_GUIDELINES_JSON="$(python3 -B "$SCRIPT_DIR/lib/static-reader.py" \
9
14
  --root "$ROOT" --metadata "${META_DIR:-/nonexistent}" --plist "${INFO_PLIST:-/nonexistent}" \
10
- "${GREP_PRUNE[@]+"${GREP_PRUNE[@]}"}" )" || STATIC_GUIDELINES_JSON='{"_reader_error":"reader invocation failed; see stderr"}'
15
+ "${STATIC_READER_EXCLUDES[@]+"${STATIC_READER_EXCLUDES[@]}"}" )" || STATIC_GUIDELINES_JSON='{"_reader_error":"reader invocation failed; see stderr"}'
11
16
  fi
12
17
 
13
18
  static_guideline_select() {
@@ -24,8 +29,12 @@ static_guideline_select() {
24
29
 
25
30
  static_guideline_gap() {
26
31
  local id="$1" guideline="$2" reason="$3"
27
- STATIC_GAP_COUNT=$((STATIC_GAP_COUNT + 1))
28
- STATIC_GAP_SLUGS="${STATIC_GAP_SLUGS}${STATIC_GAP_SLUGS:+, }$id"
32
+ STATIC_GAP_TOTAL=$((STATIC_GAP_TOTAL + 1))
33
+ case "$id" in
34
+ *-not-audited) ;;
35
+ *) STATIC_GAP_COUNT=$((STATIC_GAP_COUNT + 1))
36
+ STATIC_GAP_SLUGS="${STATIC_GAP_SLUGS}${STATIC_GAP_SLUGS:+, }$id" ;;
37
+ esac
29
38
  STATIC_GAP_REASON="$reason"
30
39
  if command -v jq >/dev/null 2>&1; then
31
40
  COVERAGE_GAPS_JSON="$(printf '%s' "$COVERAGE_GAPS_JSON" | jq -c \
@@ -39,161 +48,62 @@ static_guideline_gap() {
39
48
  fi
40
49
  }
41
50
 
42
- # §56 — 2.3.12: release-notes-specificity
43
- set_rule "release-notes-specificity"
44
- static_guideline_select "release-notes-specificity"
45
- case "$STATIC_STATUS" in
46
- WARN) warn "2.3.12 release-notes-specificity — $STATIC_REASON" "$STATIC_FILE" ;;
47
- PASS) pass "2.3.12 release-notes-specificity — $STATIC_REASON" ;;
48
- *) static_guideline_gap "release-notes-specificity" "2.3.12" "$STATIC_REASON" ;;
49
- esac
50
-
51
- # §57 — 2.4.4: device-restart-instructions
52
- set_rule "device-restart-instructions"
53
- static_guideline_select "device-restart-instructions"
54
- case "$STATIC_STATUS" in
55
- WARN) warn "2.4.4 device-restart-instructions — $STATIC_REASON" "$STATIC_FILE" ;;
56
- PASS) pass "2.4.4 device-restart-instructions — $STATIC_REASON" ;;
57
- *) static_guideline_gap "device-restart-instructions" "2.4.4" "$STATIC_REASON" ;;
58
- esac
59
-
60
- # §58 — 2.5.6: browser-engine
61
- set_rule "browser-engine"
62
- static_guideline_select "browser-engine"
63
- case "$STATIC_STATUS" in
64
- WARN) warn "2.5.6 browser-engine — $STATIC_REASON" "$STATIC_FILE" ;;
65
- PASS) pass "2.5.6 browser-engine — $STATIC_REASON" ;;
66
- *) static_guideline_gap "browser-engine" "2.5.6" "$STATIC_REASON" ;;
67
- esac
68
-
69
- # §59 — 2.5.11: intent-handler-parity
70
- set_rule "intent-handler-parity"
71
- static_guideline_select "intent-handler-parity"
72
- case "$STATIC_STATUS" in
73
- WARN) warn "2.5.11 intent-handler-parity — $STATIC_REASON" "$STATIC_FILE" ;;
74
- PASS) pass "2.5.11 intent-handler-parity — $STATIC_REASON" ;;
75
- *) static_guideline_gap "intent-handler-parity" "2.5.11" "$STATIC_REASON" ;;
76
- esac
77
-
78
- # §60 — 2.5.12: call-filter-controls
79
- set_rule "call-filter-controls"
80
- static_guideline_select "call-filter-controls"
81
- case "$STATIC_STATUS" in
82
- WARN) warn "2.5.12 call-filter-controls — $STATIC_REASON" "$STATIC_FILE" ;;
83
- PASS) pass "2.5.12 call-filter-controls — $STATIC_REASON" ;;
84
- *) static_guideline_gap "call-filter-controls" "2.5.12" "$STATIC_REASON" ;;
85
- esac
86
-
87
- # §61 — 2.5.13: face-authentication
88
- set_rule "face-authentication"
89
- static_guideline_select "face-authentication"
90
- case "$STATIC_STATUS" in
91
- WARN) warn "2.5.13 face-authentication — $STATIC_REASON" "$STATIC_FILE" ;;
92
- PASS) pass "2.5.13 face-authentication — $STATIC_REASON" ;;
93
- *) static_guideline_gap "face-authentication" "2.5.13" "$STATIC_REASON" ;;
94
- esac
95
-
96
- # §62 — 2.5.15: document-browser-access
97
- set_rule "document-browser-access"
98
- static_guideline_select "document-browser-access"
99
- case "$STATIC_STATUS" in
100
- WARN) warn "2.5.15 document-browser-access — $STATIC_REASON" "$STATIC_FILE" ;;
101
- PASS) pass "2.5.15 document-browser-access — $STATIC_REASON" ;;
102
- *) static_guideline_gap "document-browser-access" "2.5.15" "$STATIC_REASON" ;;
103
- esac
104
-
105
- # §63 — 2.5.16: extension-bundle-parity
106
- set_rule "extension-bundle-parity"
107
- static_guideline_select "extension-bundle-parity"
108
- case "$STATIC_STATUS" in
109
- WARN) warn "2.5.16 extension-bundle-parity — $STATIC_REASON" "$STATIC_FILE" ;;
110
- PASS) pass "2.5.16 extension-bundle-parity — $STATIC_REASON" ;;
111
- *) static_guideline_gap "extension-bundle-parity" "2.5.16" "$STATIC_REASON" ;;
112
- esac
113
-
114
- # §64 — 2.5.17: matter-extension
115
- set_rule "matter-extension"
116
- static_guideline_select "matter-extension"
117
- case "$STATIC_STATUS" in
118
- WARN) warn "2.5.17 matter-extension — $STATIC_REASON" "$STATIC_FILE" ;;
119
- PASS) pass "2.5.17 matter-extension — $STATIC_REASON" ;;
120
- *) static_guideline_gap "matter-extension" "2.5.17" "$STATIC_REASON" ;;
121
- esac
122
-
123
- # §65 — 2.5.18: extension-advertising
124
- set_rule "extension-advertising"
125
- static_guideline_select "extension-advertising"
126
- case "$STATIC_STATUS" in
127
- WARN) warn "2.5.18 extension-advertising — $STATIC_REASON" "$STATIC_FILE" ;;
128
- PASS) pass "2.5.18 extension-advertising — $STATIC_REASON" ;;
129
- *) static_guideline_gap "extension-advertising" "2.5.18" "$STATIC_REASON" ;;
130
- esac
131
-
132
- # §66 — 4.2.1: ar-integration-depth
133
- set_rule "ar-integration-depth"
134
- static_guideline_select "ar-integration-depth"
135
- case "$STATIC_STATUS" in
136
- WARN) warn "4.2.1 ar-integration-depth — $STATIC_REASON" "$STATIC_FILE" ;;
137
- PASS) pass "4.2.1 ar-integration-depth — $STATIC_REASON" ;;
138
- *) static_guideline_gap "ar-integration-depth" "4.2.1" "$STATIC_REASON" ;;
139
- esac
140
-
141
- # §67 — 4.2.3: companion-app-required
142
- set_rule "companion-app-required"
143
- static_guideline_select "companion-app-required"
144
- case "$STATIC_STATUS" in
145
- WARN) warn "4.2.3 companion-app-required — $STATIC_REASON" "$STATIC_FILE" ;;
146
- PASS) pass "4.2.3 companion-app-required — $STATIC_REASON" ;;
147
- *) static_guideline_gap "companion-app-required" "4.2.3" "$STATIC_REASON" ;;
148
- esac
149
-
150
- # §68 — 4.5.5: game-center-id-sharing
151
- set_rule "game-center-id-sharing"
152
- static_guideline_select "game-center-id-sharing"
153
- case "$STATIC_STATUS" in
154
- WARN) warn "4.5.5 game-center-id-sharing — $STATIC_REASON" "$STATIC_FILE" ;;
155
- PASS) pass "4.5.5 game-center-id-sharing — $STATIC_REASON" ;;
156
- *) static_guideline_gap "game-center-id-sharing" "4.5.5" "$STATIC_REASON" ;;
157
- esac
158
-
159
- # §69 — 4.5.6: metadata-emoji
160
- set_rule "metadata-emoji"
161
- static_guideline_select "metadata-emoji"
162
- case "$STATIC_STATUS" in
163
- WARN) warn "4.5.6 metadata-emoji — $STATIC_REASON" "$STATIC_FILE" ;;
164
- PASS) pass "4.5.6 metadata-emoji — $STATIC_REASON" ;;
165
- *) static_guideline_gap "metadata-emoji" "4.5.6" "$STATIC_REASON" ;;
166
- esac
167
-
168
- STATIC_EMOJI_STATUS="$STATIC_STATUS"
169
-
170
- # §70 — 4.7.2: miniapp-native-bridge
171
- set_rule "miniapp-native-bridge"
172
- static_guideline_select "miniapp-native-bridge"
173
- case "$STATIC_STATUS" in
174
- WARN) warn "4.7.2 miniapp-native-bridge — $STATIC_REASON" "$STATIC_FILE" ;;
175
- PASS) pass "4.7.2 miniapp-native-bridge — $STATIC_REASON" ;;
176
- *) static_guideline_gap "miniapp-native-bridge" "4.7.2" "$STATIC_REASON" ;;
177
- esac
178
-
179
- # §71 — 5.2.4: apple-endorsement-claims
180
- set_rule "apple-endorsement-claims"
181
- static_guideline_select "apple-endorsement-claims"
182
- case "$STATIC_STATUS" in
183
- WARN) warn "5.2.4 apple-endorsement-claims — $STATIC_REASON" "$STATIC_FILE" ;;
184
- PASS) pass "5.2.4 apple-endorsement-claims — $STATIC_REASON" ;;
185
- *) static_guideline_gap "apple-endorsement-claims" "5.2.4" "$STATIC_REASON" ;;
186
- esac
51
+ # §56–§71: slug | guideline | evidence class. Keep coverage-sections.py in sync.
52
+ while IFS='|' read -r _static_slug _static_guideline _static_evidence; do
53
+ set_rule "$_static_slug"
54
+ set_evidence "$_static_evidence"
55
+ static_guideline_select "$_static_slug"
56
+ case "$STATIC_STATUS" in
57
+ WARN) warn "$_static_guideline $_static_slug — $STATIC_REASON" "$STATIC_FILE" ;;
58
+ PASS) pass "$_static_guideline $_static_slug — $STATIC_REASON" ;;
59
+ *) static_guideline_gap "$_static_slug" "$_static_guideline" "$STATIC_REASON" ;;
60
+ esac
61
+ if [[ "$_static_slug" == metadata-emoji ]]; then STATIC_EMOJI_STATUS="$STATIC_STATUS"; fi
62
+ done <<'STATIC_GUIDELINE_TABLE'
63
+ release-notes-specificity|2.3.12|metadata
64
+ device-restart-instructions|2.4.4|source
65
+ browser-engine|2.5.6|source
66
+ intent-handler-parity|2.5.11|source
67
+ call-filter-controls|2.5.12|source
68
+ face-authentication|2.5.13|source
69
+ document-browser-access|2.5.15|source
70
+ extension-bundle-parity|2.5.16|source
71
+ matter-extension|2.5.17|source
72
+ extension-advertising|2.5.18|source
73
+ ar-integration-depth|4.2.1|source
74
+ companion-app-required|4.2.3|source
75
+ game-center-id-sharing|4.5.5|source
76
+ metadata-emoji|4.5.6|resource
77
+ miniapp-native-bridge|4.7.2|source
78
+ apple-endorsement-claims|5.2.4|metadata
79
+ STATIC_GUIDELINE_TABLE
187
80
 
188
81
  if [[ "$STATIC_EMOJI_STATUS" != SKIP ]]; then
189
82
  static_guideline_gap "metadata-emoji-icon-not-audited" "4.5.6" "Apple emoji artwork in icon pixels requires visual review."
190
83
  fi
84
+ STATIC_GAP_FALLBACK_SLUGS="$STATIC_GAP_SLUGS" STATIC_GAP_REASON_FALLBACK="$STATIC_GAP_REASON"
191
85
  if command -v jq >/dev/null 2>&1; then
192
86
  _input_gap="$(printf '%s' "$STATIC_GUIDELINES_JSON" | jq -r '._input_gaps // empty | "\(.count) files skipped: \(.paths | join(", "))"')"
193
87
  if [[ -n "$_input_gap" ]]; then static_guideline_gap "source-inputs-not-audited" "source" "$_input_gap"; fi
194
- STATIC_GAP_REASON="$(printf '%s' "$COVERAGE_GAPS_JSON" | jq -jr '[.[].reason] | unique | join("; ")' | tr '\n\r\t' ' ')"
88
+ STATIC_GAP_SLUGS="$(printf '%s' "$COVERAGE_GAPS_JSON" | jq -jr '
89
+ def grouped: group_by(.reason) | map((map(.rule_id) | join(", ")) + " (" + .[0].reason + ")") | join("; ");
90
+ [.[] | select(.rule_id | endswith("-not-audited") | not)] | grouped' | tr '\n\r\t' ' ')"
91
+ STATIC_GAP_REASON="$(printf '%s' "$COVERAGE_GAPS_JSON" | jq -jr '
92
+ [.[] | select(.rule_id | endswith("-not-audited"))] |
93
+ map(.rule_id + " (" + .reason + ")") | join("; ")' | tr '\n\r\t' ' ')"
94
+ if [[ -z "$STATIC_GAP_SLUGS" && -n "$STATIC_GAP_FALLBACK_SLUGS" ]]; then
95
+ # jq is present but failed: fall back to the bash accumulator so the list is never empty.
96
+ STATIC_GAP_SLUGS="$STATIC_GAP_FALLBACK_SLUGS ($STATIC_GAP_REASON_FALLBACK)"
97
+ fi
98
+ STATIC_GAP_SLUGS="${STATIC_GAP_SLUGS}${STATIC_GAP_REASON:+; additional coverage gaps: $STATIC_GAP_REASON}"
99
+ else
100
+ STATIC_GAP_SLUGS="$STATIC_GAP_SLUGS ($STATIC_GAP_REASON)"
195
101
  fi
196
- if [[ "$STATIC_GAP_COUNT" -gt 0 ]]; then
102
+ if [[ "$STATIC_GAP_TOTAL" -gt 0 ]]; then
197
103
  set_rule "modular-checks-not-audited"
198
- skip "modular-checks-not-audited — $STATIC_GAP_COUNT check(s) did not run: $STATIC_GAP_SLUGS ($STATIC_GAP_REASON)"
104
+ if [[ "$STATIC_GAP_COUNT" -eq 0 ]]; then
105
+ skip "modular-checks-not-audited — additional coverage gaps: $STATIC_GAP_REASON"
106
+ else
107
+ skip "modular-checks-not-audited — $STATIC_GAP_COUNT check(s) did not run: $STATIC_GAP_SLUGS"
108
+ fi
199
109
  fi
@@ -7,6 +7,7 @@ import os
7
7
  import pathlib
8
8
  import plistlib
9
9
  import re
10
+ import stat
10
11
  from xml.parsers.expat import ExpatError
11
12
 
12
13
  PRUNE = {'.git', 'Pods', 'Carthage', '.build', 'build', 'DerivedData',
@@ -24,16 +25,25 @@ def uncomment(text):
24
25
  return TOKEN.sub(lambda m: '\n' * m[0].count('\n') if m[0].startswith(('/', '/*')) else m[0], text)
25
26
 
26
27
 
28
+ def checked_bytes(path):
29
+ limit = (8 if path.suffix in RESOURCE else 2) * 1024 * 1024
30
+ fd = os.open(str(path), os.O_RDONLY | os.O_NONBLOCK | os.O_NOFOLLOW)
31
+ with os.fdopen(fd, 'rb') as stream:
32
+ info = os.fstat(stream.fileno())
33
+ if not stat.S_ISREG(info.st_mode):
34
+ raise ValueError('special file skipped')
35
+ if info.st_size > limit:
36
+ raise ValueError('input exceeds read limit')
37
+ data = stream.read(limit + 1)
38
+ if len(data) > limit:
39
+ raise ValueError('input exceeds read limit')
40
+ return data
41
+
42
+
27
43
  def checked_text(path):
28
- if path.is_symlink():
29
- raise ValueError('symlink input not followed')
30
- limit = 8 if path.suffix in RESOURCE else 2
31
- if path.stat().st_size > limit * 1024 * 1024:
32
- raise ValueError('input exceeds %d MiB read limit' % limit)
33
- with path.open('rb') as stream:
34
- bom = stream.read(2)
35
- encoding = 'utf-16' if path.suffix == '.strings' and bom in (b'\xff\xfe', b'\xfe\xff') else 'utf-8'
36
- return path.read_text(encoding=encoding)
44
+ data = checked_bytes(path)
45
+ encoding = 'utf-16' if path.suffix == '.strings' and data[:2] in (b'\xff\xfe', b'\xfe\xff') else 'utf-8'
46
+ return data.decode(encoding)
37
47
 
38
48
 
39
49
  def input_error(path, exc, root=None):
@@ -42,15 +52,12 @@ def input_error(path, exc, root=None):
42
52
  name = str(path.relative_to(root)) if root else path.name
43
53
  except ValueError:
44
54
  name = path.name
45
- return name
55
+ return name + (' (special file skipped)' if isinstance(exc, ValueError) and str(exc) == 'special file skipped' else '')
46
56
 
47
57
 
48
58
  def read_candidate(path):
49
59
  if path.suffix in {'.plist', '.entitlements'}:
50
- if path.is_symlink() or path.stat().st_size > 2 * 1024 * 1024:
51
- raise ValueError('manifest is a symlink or exceeds 2 MiB read limit')
52
- with path.open('rb') as stream:
53
- value = plistlib.load(stream)
60
+ value = plistlib.loads(checked_bytes(path))
54
61
  if not isinstance(value, dict):
55
62
  raise ValueError('manifest root is not a dictionary')
56
63
  return plistlib.dumps(value).decode('utf-8')
@@ -115,33 +122,51 @@ def metadata_files(c, names):
115
122
  try:
116
123
  checked_text(p)
117
124
  except (OSError, UnicodeError, ValueError) as exc:
118
- raise ValueError(input_error(p, exc)) from exc
125
+ detail = str(exc) if isinstance(exc, ValueError) else type(exc).__name__
126
+ err = ValueError(input_error(p, exc, c.get('root')) + ': ' + detail)
127
+ err.filename = None
128
+ err.sanitized = True
129
+ raise err from exc
119
130
  return files
120
131
 
121
132
 
133
+ def app_version(c):
134
+ version = str(c['main'].get('CFBundleShortVersionString', ''))
135
+ if re.fullmatch(r'\d+(?:\.\d+){1,2}', version):
136
+ return version
137
+ versions = {v for p, text in c['files'].items() if p.suffix == '.pbxproj'
138
+ for v in re.findall(r'\bMARKETING_VERSION\s*=\s*"?(\d+(?:\.\d+){1,2})"?\s*;', uncomment(text))}
139
+ if versions:
140
+ return next(iter(versions)) if len(versions) == 1 else ''
141
+ version_file = c['metadata'] / 'version.txt'
142
+ return checked_text(version_file).strip() if version_file.is_file() else ''
143
+
144
+
122
145
  def release_notes(c):
123
146
  files = metadata_files(c, ['release_notes'])
124
147
  if not files:
125
148
  return outcome(skip=True, reason='Release notes metadata unavailable.')
149
+ version, initial_empty = app_version(c), False
126
150
  for p in files:
127
151
  value = checked_text(p).strip()
128
152
  desc = p.with_name('description.txt')
129
153
  same = desc.is_file() and not desc.is_symlink() and value == checked_text(desc).strip()
130
- version_file = c['metadata'] / 'version.txt'
131
- version = checked_text(version_file).strip() if version_file.is_file() else ''
132
- if not value and version == '1.0':
154
+ if not value and version in ('1.0', '1.0.0'):
155
+ initial_empty = True
133
156
  continue
134
157
  if not value and not version:
135
158
  return outcome(True, 'Empty release notes with unknown version; low-confidence update review.', p)
136
159
  if not value or re.fullmatch(r'lorem(?: ipsum)?[.!]?|TODO|N[/-]A', value, re.I) or same:
137
160
  return outcome(True, 'Release notes are empty, a placeholder, or repeat the description.', p)
161
+ if initial_empty:
162
+ return outcome(reason='empty release notes accepted for the initial version')
138
163
  return outcome(reason='Release notes contain specific non-placeholder text.')
139
164
 
140
165
 
141
166
  def restart(c):
142
167
  source = {p: t for p, t in c['src'].items()
143
168
  if not re.search(r'(?m)^\s*(?:@testable\s+)?import\s+(?:Testing|XCTest)\b', t)}
144
- p = hit_file(source, r'"[^"\n]*(?:restart your device|reboot|change your settings in Settings\s*>\s*General)[^"\n]*"')
169
+ p = hit_file(source, r'"[^"\n]{0,512}(?:restart your device|reboot|change your settings in Settings\s*>\s*General)[^"\n]{0,512}"')
145
170
  p = p or hit_file(c['resources'], r'restart your device|\breboot\b|change your settings in Settings\s*>\s*General')
146
171
  return outcome(bool(p), 'Device restart/settings instruction string; inspect the user-facing context.' if p else '', p)
147
172
 
@@ -149,7 +174,7 @@ def restart(c):
149
174
  def browser(c):
150
175
  deps = {p: uncomment(t) for p, t in c['files'].items() if p.name in {'Podfile', 'Package.swift', 'Package.resolved'} or p.suffix == '.pbxproj'}
151
176
  p = next((p for p, text in deps.items()
152
- if re.search(r"[\"'][^\"'\n]*\b(?:Chromium|CEF|Gecko|Blink)\b(?![^\"'\n]*\.(?:swift|m|mm|h|storyboard|xib)[\"'])|\b(?:Chromium|CEF|Gecko|Blink)\.framework", text)), None)
177
+ if re.search(r"[\"'][^\"'\n]{0,512}\b(?:Chromium|CEF|Gecko|Blink)\b(?![^\"'\n]{0,512}\.(?:swift|m|mm|h|storyboard|xib)[\"'])|\b(?:Chromium|CEF|Gecko|Blink)\.framework", text)), None)
153
178
  legacy = hit_file(c['src'], r'\bUIWebView\s*(?:\(|[*>])|:\s*UIWebView\b')
154
179
  if legacy:
155
180
  return outcome(True, 'Deprecated UIWebView reference; verify the shipping target and Xcode SDK before removal.', legacy)
@@ -167,7 +192,7 @@ def intents(c):
167
192
 
168
193
  def call_filter(c):
169
194
  p = hit_file(c['src'], r'\b(?:ILMessageFilterExtension|CXCallDirectoryProvider|CXCallDirectoryManager)\b')
170
- ui = hit_file(c['src'], r'"[^"\n]*(?:blocked (?:numbers|callers)|call blocking|spam filter|blocking settings)[^"\n]*"') or hit_file(c['resources'], r'blocked numbers|call blocking|spam filter')
195
+ ui = hit_file(c['src'], r'"[^"\n]{0,512}(?:blocked (?:numbers|callers)|call blocking|spam filter|blocking settings)[^"\n]{0,512}"') or hit_file(c['resources'], r'blocked numbers|call blocking|spam filter')
171
196
  return outcome(bool(p and not ui), 'Call/filter API signal without a visible blocking-control label; inspect reachable settings.' if p and not ui else 'No missing filter-control signal (or APIs not used).', p)
172
197
 
173
198
 
@@ -185,11 +210,11 @@ def documents(c):
185
210
  picker = hit_file(c['src'], r'\bUIDocumentPicker\w*\b|\.fileImporter\s*\(|\bUIDocumentBrowserViewController\b')
186
211
  if picker:
187
212
  return outcome(reason='System document access is used; inspect custom browser reachability separately.')
213
+ title = hit_file(c['src'], r'(?:navigationTitle|Text|title\s*=)\s*\(?\s*"(?:My Files|Files|Documents)"')
214
+ title = title or hit_file(c['resources'], r'"(?:My Files|Files|Documents)"')
188
215
  custom = next((p for p, t in c['src'].items()
189
- if re.search(r'FileManager\.default\.contentsOfDirectory', t)
216
+ if title and re.search(r'FileManager\.default\.contentsOfDirectory|\benumerator\s*\(\s*at\s*:', t)
190
217
  and re.search(r'\b(?:List|Table|UICollectionView|UITableView)\b', t)), None)
191
- custom = custom or hit_file(c['src'], r'(?:navigationTitle|Text|title\s*=)\s*\(?\s*"(?:My Files|Files|Documents)"')
192
- custom = custom or hit_file(c['resources'], r'"(?:My Files|Files|Documents)"')
193
218
  return outcome(bool(custom), 'Custom file-browser signal without system document access; inspect Files/iCloud availability.' if custom else 'No custom file-browser signal.', custom)
194
219
 
195
220
 
@@ -239,7 +264,7 @@ def ar_depth(c):
239
264
 
240
265
 
241
266
  def companion(c):
242
- p = hit_file(c['src'], r'"[^"\n]*(?:download|install)\s+[^"\n]{1,60}\s+to (?:continue|proceed|use)[^"\n]*"') or hit_file(c['resources'], r'(?:download|install)\s+[^"\n]{1,60}\s+to (?:continue|proceed|use)')
267
+ p = hit_file(c['src'], r'"[^"\n]{0,512}(?:download|install)[ \t]{1,60}[^"\n]{1,60}[ \t]{1,60}to (?:continue|proceed|use)[^"\n]{0,512}"') or hit_file(c['resources'], r'(?:download|install)[ \t]{1,60}[^"\n]{1,60}[ \t]{1,60}to (?:continue|proceed|use)')
243
268
  bad = bool(c['main'].get('LSApplicationQueriesSchemes') and p)
244
269
  return outcome(bad, 'App-query schemes coexist with an install-to-continue instruction; inspect whether core functionality requires another app.' if bad else '', p if bad else None)
245
270
 
@@ -315,7 +340,11 @@ def evaluate(root, metadata, main, excludes):
315
340
  try:
316
341
  result[key] = check(c)
317
342
  except (OSError, UnicodeError, ValueError) as exc:
318
- result[key] = outcome(skip=True, reason='Input could not be completely read: ' + str(exc)[:500])
343
+ if getattr(exc, 'sanitized', False):
344
+ detail = str(exc)
345
+ else:
346
+ detail = input_error(getattr(exc, 'filename', None) or 'input', exc, root) + ' (' + type(exc).__name__ + ')'
347
+ result[key] = outcome(skip=True, reason='Input could not be completely read: ' + detail)
319
348
  for key, row in result.items():
320
349
  if key.startswith('_'):
321
350
  continue
@@ -323,7 +352,7 @@ def evaluate(root, metadata, main, excludes):
323
352
  try:
324
353
  row['file'] = str(pathlib.Path(row['file']).relative_to(root))
325
354
  except ValueError:
326
- pass
355
+ row['file'] = pathlib.Path(row['file']).name
327
356
  return result
328
357
 
329
358
 
@@ -146,7 +146,8 @@ PRUNE=( -not -path '*/.git/*' -not -path '*/Pods/*' -not -path '*/Carthage/*'
146
146
 
147
147
  # Same prune set expressed as grep --exclude-dir globs, for repo-wide grep -r passes
148
148
  # (the find-style PRUNE above is not valid grep syntax).
149
- GREP_PRUNE=( --exclude-dir=.git --exclude-dir=Pods --exclude-dir=Carthage
149
+ # -D skip: never block on FIFOs/sockets/devices that happen to match a source glob.
150
+ GREP_PRUNE=( -D skip --exclude-dir=.git --exclude-dir=Pods --exclude-dir=Carthage
150
151
  --exclude-dir=.build --exclude-dir=build --exclude-dir=DerivedData
151
152
  --exclude-dir=SourcePackages --exclude-dir=checkouts --exclude-dir=.swiftpm
152
153
  --exclude-dir=.claude --exclude-dir=worktrees