caelum0x 522cb903fc fix(privacy): stop File Timestamp pattern matching PascalCase Stat() components
The bare stat()/fstat()/lstat() patterns for the NSPrivacyAccessedAPICategoryFileTimestamp
check were case-insensitive and enabled for TypeScript/JavaScript, so they matched any
PascalCase identifier shaped like `function Stat(...)` -- the common React/React Native
convention for a small stat-display component -- and not just the real lowercase POSIX
C calls they were meant to catch.

Found by running `greenlight privacy` against a real portfolio app (runner-map): it
declares nine `function Stat({ label, value })` components across its screens and
components, none of which touch a real file-timestamp API, yet the scan produced a
CRITICAL "Required Reason API used but not declared" finding -- the top severity --
telling the user to add a privacy manifest entry they don't need.

Make the stat()/fstat()/lstat() patterns case-sensitive (real POSIX calls are always
lowercase); getattrlist has no such casing collision so it stays case-insensitive.
Added TestFileTimestampPatternIgnoresPascalCaseStatComponent as a regression, and
verified real detection still works via the existing
TestRequiredReasonDetectsRealCallSites (lowercase stat(path, &s) in Files.swift).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-28 20:47:40 +03:00
..