Cursor Bugbot flagged this on PR RevylAI/greenlight#36 (commit 8c9aee1):
extractStringLiterals treated every quote byte as a delimiter with no
escape handling, so a backslash-escaped quote inside a literal (e.g. the
contraction in 'it\'s not available on android yet') closed the literal
early. Everything after the escaped quote fell outside any extracted
literal, so literalPatterns-based rules like platform-reference silently
missed real competitor mentions in that text.
Fixed by treating a backslash followed by any character as an escape
sequence while inside a string: both bytes are kept as literal content
and skipped over, so the following quote can't be mistaken for the
closing delimiter.
Verified by building before/after binaries and running codescan against
a real repro file containing an escaped apostrophe followed by "android":
the pre-fix binary produced zero platform-reference findings (bug
reproduced), the post-fix binary correctly flagged it. Re-checked the
existing bare-identifier-between-literals false positive case (still
correctly suppressed) and a plain true-positive case (still correctly
flagged) with no regression. go build/vet/test -count=1 ./.../gofmt -l
all clean.
The §2.3 platform-reference rule (and placeholder-content, same shape) used
'[^\'']*word[^\'']*'-style regexes to only flag the keyword inside a quoted
string. That pattern has no notion of which quote opened which string: given
two separate literals with a bare identifier between them, e.g.
serif: { label: 'Serif', ios: 'Georgia', android: 'serif' },
the regex starts at the quote that *closes* 'Georgia', scans through the
bare, unquoted ` android: ` text, and ends at the quote that *opens* 'serif'
-- "finding" the word android in the gap between two unrelated literals even
though neither literal actually contains it. Found by running greenlight
against a real app (fast-reader): this fired a WARN on an ordinary
cross-platform font-family config object, not any user-facing copy.
Added extractStringLiterals, a quote-type-aware scanner (same style as the
existing stripStringsAndComments) that extracts each literal's real content
first. platform-reference now matches against that via a new literalPatterns
field instead of the buggy quote-spanning regexes. placeholder-content's
three equivalent quote-wrapped patterns are dead weight with the same bug
and no detection benefit (its remaining bare pattern already matches
anywhere in the line, quoted or not) -- removed them too.
Added TestPlatformReferenceIgnoresBareIdentifierBetweenLiterals (RED before
the fix: 1 false finding on the clean case; GREEN after). Confirmed real
detection is unaffected: TestPlatformReferenceIgnoresCodeConstructs and
TestPlaceholderRuleIgnoresSwiftUIPlaceholder still pass, and a real
competitor mention inside an actual literal still fires.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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>
dedup() keyed solely on Title, so a rule that legitimately fires once per
occurrence (hardcoded-secrets, private-api, insecure-http, etc.) had every
instance past the first silently dropped from `preflight` whenever two
different files tripped the same rule — e.g. two real hardcoded secrets in
two files reported as one finding, hiding the second from the user and any
CI gate reading file/line. Key dedup on Title+File+Line instead, which still
collapses genuine cross-scanner duplicates of a project-level fact (no
file/line on either side) but keeps every distinct per-file occurrence.
Added TestRunKeepsSameRuleFindingsFromDifferentFiles (RED before the fix:
got 1 finding instead of 2; GREEN after).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
greenlight privacy had no --format flag at all, so greenlight privacy
--format json failed with "unknown flag: --format". Every sibling scan
command (preflight, codescan, playscan, ipa, scan, verify) already
supports --format json; privacy was the odd one out, with no way to
consume its findings as machine-readable output.
Add the flag following the existing convention (see verify.go /
playscan.go): suppress the banner for JSON output and encode the
already-json-tagged *privacy.ScanResult directly to stdout.
FixesRevylAI/greenlight#31.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The Google Ads/AdMob tracking-SDK pattern was unanchored and
case-insensitive (google.*ads), so it matched "ads" inside ordinary
identifiers such as loadSdk, downloads, or uploads whenever "google"
appeared earlier on the same line. That produced a CRITICAL "Tracking
SDKs detected without ATT implementation" finding - the top severity,
which trips --exit-code - on apps that ship no advertising SDK at all,
with a fix suggestion (add an ATT prompt) that is actively wrong for
those apps.
Narrow the pattern to the real AdMob tokens (google-mobile-ads,
googlemobileads, GADMobileAds, GADApplicationIdentifier, admob) and
tighten the neighboring Unity Ads pattern the same way, since it had
the identical google.*ads wildcard-substring shape.
FixesRevylAI/greenlight#30.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
'auth login' saves a session-based Apple ID credential (cookies, scnt,
session id) to config, and its own success message told users to run
'greenlight scan --app-id ...' next. But scan always builds its API
client from cfg.KeyID/IssuerID/PrivateKeyPath — fields only 'auth setup'
(the API-key method) ever populates. With a session-only config those
are empty, so NewClient failed deep inside generateToken with a
confusing "failed to read private key: open : no such file or
directory" instead of a real explanation.
config.Config.IsValid() already existed to check exactly this but was
never called anywhere in the codebase. scan now calls it and fails
fast with an actionable message when the stored auth can't drive the
v1 API, and the post-login message points users at 'preflight' (which
needs no account) instead of the broken 'scan' path.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
featureFormFactors mapped XR to two feature constants that do not exist, so no XR app ever matched and XR packages kept getting the phone track's blocking target API finding. XR is now matched on the android.software.xr. / android.hardware.xr. namespace, which no android.jar for API 34-36 lets us pin to an exact name.
Reported by Cursor Bugbot on #22.
Adds --apk/--aab to preflight, scans AAB feature-module native code, adds the 64-bit ABI parity rule, reports the Gradle-only coverage gap on artifact scans, respects Play's per-form-factor target API schedules (honouring android:required), and makes preflight --verify follow the project platform instead of hardcoding iOS.
Also decodes uses-feature and android:required on the compiled-manifest paths, where they were silently dropped, and stops a failed archive scan from discarding source findings.
The code intended for #21, which merged with only its README commit.
The framework attribute ID table is the fallback used when aapt2 omits an
attribute's name from the compiled string pool, which it routinely does. A
wrong entry fails silently: the attribute never resolves, and every rule that
reads it stops firing with no error.
foregroundServiceType was recorded as 0x01010596. aapt2 assigns it 0x01010599,
identically on android-34, -35 and -36. The consequence was that both
foreground-service checks, which are CRITICAL because the app throws at
startForeground() on Android 14+, silently reported nothing on any manifest
that relied on the fallback. Verified on a real aapt2-linked manifest with the
pool entry blanked: 0 findings before, 2 after.
Every remaining ID in the table was read back from `aapt2 dump xmltree` rather
than recalled, and TestFrameworkAttrIDsMatchAapt2 now pins all nine and fails
on any unverified addition. The two networkSecurityConfig entries were both
guesses and are removed; no rule reads that field.
The unit fixture had encoded the same wrong ID, which is why the existing tests
passed. It now uses the verified value.
Co-authored-by: ethan zhou <231755529+ethanzhoucool@users.noreply.github.com>
The fix text read "upgrade to 8.x or higher, migrating through 8 if you are
on 7", which is circular, and it repeated the no-direct-7-to-9 explanation
already carried in the finding's detail. The fix line now states only the
action to take.
Co-authored-by: ethan zhou <231755529+ethanzhoucool@users.noreply.github.com>
* feat(playscan): scan Android projects against Google Play policies
Adds a Google Play tier alongside the existing App Store checks. Android
projects are detected automatically, including the android/ directory of an
Expo or React Native app, so a cross-platform repo is checked against both
stores in one pass. Also available standalone as `greenlight playscan`.
Deadline checks, both landing 2026-08-31:
- Target API level: CRITICAL below API 35, HIGH below 36, with a live
day countdown
- Play Billing Library 7 and below, which has no direct v7 to v9 path
Policy checks:
- Restricted permissions: SMS and Call Log (including the 2026-07-15 change
dropping phone-call account verification), All files access,
QUERY_ALL_PACKAGES, REQUEST_INSTALL_PACKAGES, background location, broad
photo/video access, accessibility service, overlays, device admin, usage
stats, contacts
- Foreground service types missing their FOREGROUND_SERVICE_* permission,
which throws at startForeground() on Android 14+
- android:exported missing on components with an intent filter, debuggable,
cleartext traffic
- Ads SDK without the AD_ID permission, which silently zeroes the ad ID
- Account creation without both in-app and web deletion paths
Every finding carries a Doc link to the policy page it comes from. Play
policies are named rather than numbered and change often, so the citation is
worth more than a section reference.
The Apple scanners now skip only when a project is unambiguously
Android-only. Previously every pure-Android repo led with a CRITICAL for a
missing PrivacyInfo.xcprivacy, an iOS-only requirement. iOS-only and
cross-platform projects are unaffected.
targetSdk is resolved from the app module, convention plugins, version
catalogs, gradle.properties, and named constants, since most real projects
reach it through a reference rather than a literal. lint.targetSdk and
testOptions.targetSdk are explicitly excluded. When it cannot be resolved the
scan says so rather than reporting a pass.
Scope is documented in the README and command help: this reads the pre-merge
manifest, so permissions contributed by library manifests are not visible
until the build merges them.
Validated against nowinandroid, AnkiDroid, Thunderbird, Pocket Casts,
DuckDuckGo, and Mattermost, with every finding checked against source.
* feat(playscan): scan built APKs and AABs, with 16 KB page size checks
Adds `greenlight playscan --apk` / `--aab`, closing the gap the source scan
documents: a repo's AndroidManifest.xml is the pre-merge manifest, so
permissions contributed by library manifests are invisible until build time.
A built artifact carries the merged manifest, so its permission list is
complete.
Every existing policy rule runs unchanged against the decoded manifest. The
archive scan adds the native code checks, which only exist at this layer:
- 16 KB page size: ELF LOAD segment alignment on arm64-v8a, 16 KB zip
alignment of uncompressed libraries, and GNU_RELRO presence. Google Play
requires apps targeting Android 15+ to support 16 KB memory pages; an
unaligned library fails to load and crashes at startup on those devices.
Both container formats are decoded in pure Go with no new dependencies, so no
Android SDK, aapt2, or bundletool is required:
- APK: Android binary XML, including the string pool in both UTF-8 and UTF-16
form and the resource ID map. aapt2 emits an empty string-pool entry for
framework attributes and identifies them only by resource ID, so without the
map every android:* attribute reads as unnamed.
- AAB: the protobuf-encoded manifest, walked directly off the wire format.
foregroundServiceType is a bitmask once compiled; it is rendered back to the
pipe-separated names the source manifest uses so the foreground service rule
needs no second code path.
Only arm64-v8a is assessed for 16 KB alignment. 16 KB page size devices are
64-bit ARM, so flagging a 32-bit library at 4 KB would be noise.
Verified against real APKs. Termux 0.118.3 decodes to exactly the 15
permissions in its published source manifest, and its 4 KB aligned libraries
are flagged; F-Droid's 16 KB aligned library is not. Alignment findings were
cross-checked by parsing the ELF program headers independently.
* fix(playscan): address code review findings
Two denial-of-service bugs in the binary parsers, both reachable through the
stated threat model of scanning an archive someone handed you, and both
reproduced before and after the fix:
- protoxml: the decoder recursed once per manifest nesting level with no
bound. A deeply nested AAB drove a Go stack overflow, which is a process
abort recover() cannot catch. An 8.9 MB file was enough. Now capped at 100
levels, matching Android's own parser; the repro drops to 0.35s / 22 MB and
reports an undecodable manifest.
- axml: attrCount is a uint16 read straight from the file and need not match
the bytes present, but it was used directly to size an allocation. A 97 KB
APK of 36-byte chunks each claiming 65535 attributes cost 65s CPU and
1.46 GB RSS. Capped by the chunk's actual capacity; the repro drops to
0.04s / 110 MB.
Correctness:
- protoxml decoded compiled values against a guessed schema. Primitive's oneof
is non-contiguous in Resources.proto (float=3, int_decimal=6, int_hex=7,
boolean=8), and the code treated field 3 as the boolean, so every compiled
boolean in a bundle was misread and an AAB's debuggable=true was missed
entirely. Now decodes Item.str and Item.prim against the real field numbers.
- The BIND_* permissions are never requested via <uses-permission>; the
framework requires them as the bound component's android:permission. Those
rules could therefore never fire. Component permissions are now inspected,
and BIND_VPN_SERVICE is covered alongside accessibility and device admin.
- Every foreground service needs the base FOREGROUND_SERVICE permission from
API 28 regardless of type. Only the type-specific permissions were checked,
so an app missing the base one was reported clean.
- Gradle file ranking assumed the app module is named "app", the same
assumption already fixed for manifest selection. Ranking is now tied to the
module the selected manifest belongs to, so a library module's targetSdk
cannot be reported as the app's.
- The Billing Library version had to be a literal, but most builds reach it
through a variable or a version catalog version.ref, so the support-window
check silently never fired on them. Both forms now resolve. This surfaces a
real finding on Thunderbird, which ships Billing 7.1.1 via version.ref.
- detectIOS missed Objective-C sources and app.config.json, either of which
could classify a cross-platform repo as Android-only and skip the Apple
scanners.
Also drops GradleInfo.CompileSDK and .Dependencies, which were written or
declared but never read, and serializes an empty findings list as [] rather
than null.
---------
Co-authored-by: ethan zhou <231755529+ethanzhoucool@users.noreply.github.com>
* feat(codescan): detect crypto apps and flag Guideline 3.1.5(b) obligations
Crypto apps carry App Review obligations that static analysis can detect
the *need* for but cannot verify: wallet apps must ship from an
Organization account (3.1.5(b)(i)), and exchange / fiat on-off-ramp /
transmission apps must be the licensed exchange itself or an approved,
law-compliant organization in every region they ship (3.1.5(b)(iii)) --
which App Review routinely backs with a request for licensing evidence or
a legal opinion, geo-restricted availability, and a working demo account.
greenlight previously only knew one crypto rule (on-device mining), so a
custodial/exchange app could scan near-clean and still hit the single most
common crypto rejection. This adds:
- crypto-wallet-org-account (3.1.5, WARN): web3/wallet SDKs (ethers, viem,
wagmi, @reown, @walletconnect, @privy-io, @solana/web3.js, ...) -> the
Organization-account reminder.
- crypto-exchange-licensing (3.1.5, HIGH): on/off-ramp + exchange providers
(MoonPay, Transak, Ramp, Banxa, ...) and exchange/ramp/P2P domain phrases
-> the licensing / legal-opinion / geo-restriction / demo-account tier.
Both are project-level facts (firstMatchOnly, one finding per project) with
no antiPatterns -- the obligation cannot be discharged in source -- and are
suppressible with the existing greenlight:ignore[<rule-id>] directive.
Also expands the 3.1.5 guideline entry with (b)(i)/(ii)/(iii) subsections so
"greenlight guidelines search wallet|exchange|custody" returns results.
Tests cover firing, quote-bounded no-fire cases, severity, project-level
collapse, and the ignore directive. Verified against a real Expo crypto app.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(codescan): correct ignore-directive syntax and match scoped ramp SDKs
Addresses two P2 review comments on the crypto rules:
- The fix/doc text recommended the bracketed form
greenlight:ignore[<rule-id>], but directiveSuppresses splits on
whitespace/comma only, so the bracketed token never matches the rule id
and the advisory keeps firing. Switched to the supported space form
greenlight:ignore <rule-id>.
- The on/off-ramp provider regex required ramp-network/banxa/mercuryo/
onramper to be the whole quoted token, so scoped SDKs like
@ramp-network/ramp-instant-sdk never matched. Unified all providers to
allow an optional scope/subpath.
Tests: scoped Ramp + Sardine packages now fire; new assertions lock the
fix text to the directive form the scanner actually honors.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(codescan): calibrate crypto rules to kill non-crypto false positives
Addresses maintainer review + two Codex P2s on PR #14. The exchange rule was
HIGH and fired on loose phrases, so non-crypto apps failed preflight --exit-code.
Rework:
- crypto-exchange-sdk (HIGH): fires ONLY on real provider-SDK package
identifiers -- a scope subpath (@moonpay/react-native-moonpay-sdk,
@ramp-network/ramp-instant-sdk) or a -suffixed package (transak-react-native-
sdk). Bare words ("sardine", "sardines", "wyred", "moonpayments", "banxample")
can no longer match, so a recipe/maps/tracker app can't be gated by it.
- crypto-exchange-signals (WARN, new): the loose exchange/on-ramp/P2P phrase
heuristics, moved off the HIGH path. Skips obvious negations ("not a crypto
exchange", "does not buy crypto") and requires a real separator on the ramp
phrase so bare "onramp"/"offramp" road copy doesn't fire. Adds
"cryptocurrency exchange", "trade/swap crypto".
- crypto-wallet-org-account (WARN): native WalletCore/web3swift now anchored to
an import (a bare WalletCore identifier / Apple Wallet code no longer fires);
added @wagmi/core, @ethersproject/*, @coinbase/wallet-sdk, @rainbow-me/*,
thirdweb, @web3-onboard/* which the bare-name alternatives missed.
Guidelines: quote Apple's actual 3.1.5(b) bullet wording ("offered by the
exchange itself"), label the Resolution-Center asks as practical guidance (they
aren't guideline text), drop the invented (i)/(ii)/(iii) numbering for
descriptive "3.1.5(b) Wallets/Mining/Exchanges/ICOs" keys, add the ICO bullet
where "comply with all applicable law" actually comes from.
Also:
- Suppression: fix text now points to .greenlight.yml (enabled:false) since the
SDK rules fire on package.json where an inline directive can't live.
- Scanner: classify .mm as objc so native rules run on Obj-C++.
- Fix the bracketed greenlight:ignore[...] doc comment in rules.go.
Tests rewritten to cover every reviewer false-positive case and use non-comment
noFire lines that actually exercise the regex. Verified on a real build: the
reviewer's disclaimer+recipe app scans GREENLIT; a MoonPay/Ramp dependency
still trips the HIGH.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(codescan): add crypto-exchange-brand rule (exchange/wallet brands)
Adds a WARN rule matching references to known cryptocurrency exchange /
wallet brands (Coinbase, Binance, Kraken, Bybit, OKX, KuCoin, Crypto.com,
Bitfinex, Unigox, ...). Matched only as a domain (deep-link / API host /
associated domain) or an SDK package (ccxt, scoped @brand/*, binance-
connector), never a bare word — so the .tld / package anchor keeps Google
Gemini (gemini.google.com), the mythical kraken, "stargate.io", and the
node crypto module from firing.
WARN, not HIGH: a reference can just mean the app links out to the
exchange website. But for an app that ships its own exchange brand (its
associated domain or scoped SDK), this is a strong "this is a crypto
exchange" signal that pairs with the wallet/SDK/phrase rules.
firstMatchOnly + no antiPatterns like the other crypto rules; suppressible
inline or via .greenlight.yml. Tests cover brand domains/SDKs firing and
the FP guards (Google Gemini, stargate, bare word, node crypto) staying
clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds utm_source=greenlight&utm_medium=cli&utm_campaign=verify to the
signup URL shown when a user hits the runtime tier without a Revyl
account, so those signups attribute to greenlight in PostHog.
Co-authored-by: ethan zhou <231755529+ethanzhoucool@users.noreply.github.com>
A crashed sub-scanner is surfaced as a WARN ("Scanner did not complete"), but
preflightExit only failed on CRITICAL/HIGH, so `--exit-code` could pass in CI
even though a requested scanner (e.g. a malformed --ipa) never ran. Track it as
Result.Incomplete and fail the gate on it. Default behavior (no --exit-code) is
unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The narrowed pattern still matched call-shaped text like "UIWebView()" inside a
string literal or trailing comment, flipping a clean app to NOT READY. Add a
codeOnly rule flag that blanks string literals and comments before matching, and
set it on uiwebview-removed. Real usage still flags; textual mentions don't.
Tests add the call-shaped-text-in-string and -in-comment cases as negatives.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Lets teams tune the scanner project-wide (complementing the per-line
`// greenlight:ignore` directive): disable a rule, override its severity, or
ignore paths.
```yaml
rules:
hardcoded-ipv4: { severity: info }
platform-reference: { enabled: false }
ignore: [vendor, "*.generated.ts", src/legacy]
```
- New internal/codescan/config.go: loads .greenlight.yml/.greenlight.yaml from
the project root and applies rule enable/disable, PatternRule severity
overrides, and path-ignore globs (bare dir names, basename globs, path
prefixes).
- Strict validation: unknown rule ids, invalid severities, severity overrides on
rule types that can't honor them, and typo'd YAML fields (KnownFields) all
error clearly instead of being silently ignored.
- Scanner gains NewScannerWithConfig; codescan + preflight auto-discover the
file, and `codescan --config <path>` points at an explicit one.
- Applies to the code scan (the rule engine); documented as such.
- Tests for load/validate, apply (disable + override), and the ignore matcher.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Lets findings upload to GitHub code scanning so they show inline in the Security
tab and on PRs with file/line annotations.
- New internal/sarif package renders findings as a SARIF 2.1.0 log: severity ->
level (CRITICAL/HIGH=error, WARN=warning, INFO=note), file/line ->
physicalLocation, a stable per-rule id slugged from the title (+ guideline
prefix), and rules/results that serialize as [] (never null) when empty.
- `--format sarif` wired into codescan and preflight; the banner is suppressed
for machine formats so stdout stays valid JSON/SARIF (this also fixes a
pre-existing codescan --format json banner leak).
- `--verify --format sarif` errors up front instead of running (and billing) a
device flow whose runtime result SARIF can't carry; use --format json for
combined static+runtime output.
- README documents the format + a codeql-action/upload-sarif example.
- Tests validate structure, dedup, levels, locations, and the empty case.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
When a compiled Assets.car is present but no loose AppIcon*.png, the no-icon
CRITICAL was fully suppressed — but greenlight can't decode Assets.car to confirm
an AppIcon set actually exists, so an icon-less catalog passed silently. Emit an
INFO in that case instead (still no false CRITICAL on the common asset-catalog
app, but the recall gap is surfaced). Test asserts the INFO.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two confirmed bugs in the `// greenlight:ignore` directive:
- A trailing directive on a code line also silenced a real finding on the NEXT
line (the line-above lookback didn't distinguish a standalone directive
comment from a trailing comment on code). The lookback now only applies to a
standalone comment line.
- A prose comment ending in "greenlight:ignore" was treated as a bare directive.
The marker must now be the first token of a comment (only whitespace between
the comment opener and the marker), which also keeps suppression working on
lines containing // inside a string/URL literal.
- Tests pin both regressions.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- hardcoded-ipv4: drop build|sdk|revision from the ignore (unbounded substrings
that swallowed real violations like `sdkEndpoint = "172.16.0.4"`). Octet
validation already rejects version-shaped numbers; "version" still covers
sdkVersion-style identifiers.
- platform-reference: require the import `from '...'` ignore to match a
module-path token (no spaces), so competitor copy like
"Download from 'Google Play'" is no longer suppressed.
- Tests pin both regressions.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- uiwebview-removed: require a real usage context (call, ObjC pointer, type
position, or Delegate) so a UIWebView mention in a string literal or trailing
comment no longer trips this CRITICAL (it was a false NOT READY).
- ExportComplianceRule: also detect the unquoted `expo:` key, so app.config.js
and app.config.ts are covered (the quoted "expo" gate made the rule dead code
on JS/TS configs).
- Tests cover the string/comment negatives and an app.config.js positive.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Tier 2 coverage rule pack from the scanner review:
- uiwebview-removed (CRITICAL, §2.5.1): Apple stopped accepting apps/updates
using UIWebView, so its presence is a hard rejection. Prefix-matched so
UIWebViewDelegate is caught, with a word boundary so custom names like
MyUIWebView are not.
- export-compliance (INFO): flags an Info.plist or Expo app.json that doesn't
declare encryption export compliance (ITSAppUsesNonExemptEncryption /
ios.config.usesNonExemptEncryption). Without it, App Store Connect prompts for
export compliance on every upload.
- README + codescan --help updated to list both. Tests for each.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Tier 2 feature. The IPA inspector read Info.plist / PrivacyInfo.xcprivacy as a
string and grepped for keys. Production builds ship BINARY plists (bplist00), so
the empty-purpose-string and ATS checks were dead, the bundle id was never
extracted, and version/icon checks false-fired on essentially every real IPA.
- Parse both plists with howett.net/plist (auto-detects binary vs XML) into a
map; read CFBundleIdentifier, version keys, NSAppTransportSecurity, and the
usage-description strings from actual values.
- Read zip entries with io.ReadAll under a 16 MiB cap instead of a single
rc.Read into a header-sized buffer (the old read truncated Deflate'd entries
and trusted UncompressedSize64 -- a decompression-bomb vector).
- Treat a compiled Assets.car as a valid icon source, so apps whose icons live
in the asset catalog no longer get a false "No app icon" CRITICAL.
- Only warn about CFBundleDisplayName when CFBundleName is also absent; simplify
the framework privacy-manifest path; drop dead arch-detection code.
- Tests build in-memory IPAs with binary and XML plist fixtures.
Adds howett.net/plist v1.0.1.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Addresses review nits:
- `greenlight --version` now prints "greenlight <v>" to match the `version`
subcommand (was cobra's default "greenlight version <v>").
- Document directiveSuppresses: bare directive (no trailing tokens) suppresses
all rules; otherwise tokens are matched against the rule id, so a trailing
reason without an id does not blanket-suppress.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mechanical: `gofmt -w .` clears the pre-existing formatting backlog (14 files)
so a gofmt check can be enforced in CI. No logic changes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Tier 1 (QOL), content batch:
- version: `--version` now works (rootCmd.Version is set), and `go install
...@latest` reports the embedded module version instead of "dev" via a
runtime/debug.ReadBuildInfo() fallback. ldflags-injected release builds still
take precedence.
- checks: App Store metadata length checks (name, description, keywords,
promotional text) count characters with utf8.RuneCountInString, not bytes, so
non-ASCII metadata is not falsely flagged as over Apple's limits.
- codescan: honor an inline `// greenlight:ignore[ rule-id]` directive on the
matching line or the line directly above it (bare = all rules on the line).
- Tests for each.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Closes the unit-test gap flagged in review (preflight had none):
- computeSummary counts HIGH separately; Passed stays "no criticals".
- dedup keeps the highest severity when scanners share a title.
- preflightExit trips only with --exit-code, on critical/high or a failed flow.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Tier 0 (verdict integrity), severity + CI-gating batch:
- codescan: new SeverityHigh tier between WARN and CRITICAL. The four
flow-dependent guidelines static analysis can only weakly assert -- missing
ATT (5.1.2), Sign in with Apple (4.8), Restore Purchases (3.1.1), account
deletion (5.1.1) -- move from WARN to HIGH. They are likely rejections, not
best-practice nits; labeling them WARN let rejectable apps read as GREENLIT.
- Severity now marshals to its NAME ("HIGH") instead of an integer ordinal, so
inserting a tier never shifts the JSON wire value for consumers.
- preflight + codescan: three-state headline -- NOT READY (critical) /
NEEDS REVIEW (high, no critical) / GREENLIT (neither). Summary gains a `high`
count. `passed` deliberately stays "no criticals" for backward compatibility
(README CI reads .summary.critical), so no existing behavior silently flips.
- preflight + verify: opt-in --exit-code flag for CI gating. preflight exits
non-zero on any CRITICAL/HIGH (or, with --verify, a failed flow); verify exits
non-zero on any failed/errored flow (it previously always exited 0, defeating
its purpose as a gate). Implemented via an ErrThreshold sentinel that main()
maps to a quiet exit 1; cobra error/usage printing moved to main().
- Tests: hard-rejection rules pinned at HIGH, summary High counting, name-based
JSON marshaling.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Tier 0 (verdict integrity), scanner-correctness batch:
- privacy: Required Reason stat()/statfs()/fstat() patterns now match real call
sites with arguments (stat(path, &st)), not only the argument-less stat()
form that almost never appears in source. Drop the broken \\.standard\\.
UserDefaults clause (matched a literal backslash; UserDefaults already covers
the real case).
- codescan: hardcoded-ipv4 validates 0-255 octets so version/build strings like
"2020.10.5.1" / "8.4.1.2" aren't misread as IPv4; widen the ignore to
version/build/sdk/revision lines.
- codescan: platform-reference no longer matches bare unquoted tokens (fired on
virtually every React Native app via Platform.OS); only string/JSX literals,
with ignores for Platform.*, imports, package names, and build config.
- preflight: drain the previously-swallowed scanner error channel so a crashed
sub-scanner surfaces as a WARN instead of a clean "no issues found".
- verify: write the credential-bearing temp YAML at 0600, not 0644.
- Tests covering each regex change.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two additions to `greenlight verify` (and `preflight --verify`).
--artifact uploads a prebuilt simulator .app (iOS) or .apk (Android) to
Revyl before running, so a build that isn't on Revyl yet can be validated
in one step. It resolves the build name to an app id; if the name is new it
registers the app explicitly with `revyl app create`, then uploads with
`revyl build upload --file <art> --app <id> --set-current`. A device .ipa is
rejected (Revyl runs on cloud simulators), and a platform/extension mismatch
(e.g. --platform ios with an .apk) is caught before upload. It is mutually
exclusive with --build. The upload outcome shows in terminal and JSON.
--open auto-opens the live Revyl session in the browser while the test runs
and prints "Watch live: <url>" to stderr, so --format json stays clean on
stdout. The link is app.revyl.ai/sessions/<session_id>?wfr=<execution_id>.
revyl client: add CreateApp. UploadBuild now uploads to an app id; the prior
--name path dropped into an interactive app picker that hangs with no TTY.
Tests: ValidateArtifact accepts .app/.apk, rejects .ipa, platform mismatch,
and missing/unsupported paths.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- runner: the displayed/dry-run YAML now redacts secret --var values; the
executed YAML (temp file) still uses the real values. Closes the dry-run
counterpart of the credential-leak fix.
- runner: stop the report-finalization poll as soon as a fetch error occurs
(repErr != nil) instead of sleeping ~36s with no chance of success.
- codescan: dedupOnceRules keys on guideline+title, not title alone, so two
rules sharing a title can't be merged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- runner: redact sensitive --var values (passwords/tokens/etc.) from the
reported FailedStep/FailedReason so inlined credentials don't leak into the
terminal or JSON output.
- runner: only engage the Revyl readiness/onboarding check when at least one
selected flow is actually claimed, so a project with no flow-dependent
features no longer prompts for sign-up with "0 flows".
- codescan: correct the dedupOnceRules comment to match the sort-then-dedup
behavior.
Tests added: redactVars.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- cli: suppress the human banner under --format json (verify and preflight) so
stdout is valid JSON and pipes into jq.
- runner: surface the report fetch error in the "could not determine" detail
instead of always blaming a non-finalized report; clean up the temp dir if the
YAML write fails (no leaked dirs across runs).
- revyl: truncate cleanReason by runes, not bytes, so a long reason can't be cut
mid UTF-8 character.
- codescan: dedupOnceRules sorts findings by file/line/title before collapsing,
so the surviving finding per project-level rule is deterministic (findings are
appended from goroutines).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- runner: require the Revyl report to finalize before declaring VERIFIED or
FAILED. Previously a passing exit code with an unsettled report could yield a
false VERIFIED; now an undecided report is always "could not determine."
- verify: validate --flows against the known flow ids (a typo failed silently as
an empty "nothing to verify" run) and validate/normalize --platform to ios or
android before generating YAML.
Tests added: validateFlows.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Available(): require the --revyl path to be an executable file (not just any
existing file), so a non-executable path fails fast instead of at run time.
- AppID() / parseReport(): return an explicit error when no JSON can be
extracted from the revyl output, so a CLI/schema change surfaces as a real
error (and, for AppID, as "could not resolve the app" rather than the
misleading "no Revyl app found").
- README: drop the bare `greenlight verify .` example mislabeled as "dry-run";
keep the explicit `--dry-run` form.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codescan:
- Sync claims.go reDeleteAccount with the expanded account-no-delete anti-pattern
so HasDeleteAccountCode / StaticPassed no longer drift (Vault "Close account").
- Tighten the §5.1.1 anti-pattern: drop the over-broad `account.*clos` (matched
incidental `accountClosed`) and narrow `delete.*my.*(data|account)` to account
only, so GDPR data-deletion and stray lines can't suppress a real violation.
- firstMatchOnly findings are now collapsed to one per project at the scanner
level (dedupOnceRules), not just one per file.
verify / revyl:
- Don't classify an undecided report as FAILED: if the report never finalizes,
report StatusError ("could not determine the outcome") instead of crying wolf.
- Propagate AppID resolution errors so a CLI/parse failure isn't surfaced as a
misleading "no Revyl app found".
- yamlStr escapes \n/\r/\t and `platform` is now quoted, so a --var/--platform
value with control chars can't corrupt the generated YAML.
- Authenticated() trusts the auth-status exit code instead of requiring a
specific success word (resilient to reworded/JSON output).
- extractJSON does balanced brace matching (string-aware), robust to braces in
surrounding log lines; previously first-{ to last-} could grab the wrong span.
- --var uses StringArray + a first-'=' split (parseVars) instead of pflag
StringToString, so values with commas or '==' (JWT/base64) survive intact.
cli:
- verify --format json now includes the `onboarding` field, so machine consumers
see why flows are pending.
Tests added: parseVars, extractJSON balanced, account anti-pattern tightening.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Running `codescan` on a normal SwiftUI app (Vault) produced 27 warnings, almost
all bogus. Fixes:
- §2.1 placeholder-content: drop the bare word "placeholder" from the match set.
It was firing on SwiftUI's `placeholder:` parameter and ordinary input hints
("you@example.com", "MM/YY", "$0"), which aren't App Completeness violations.
Real placeholder content (lorem ipsum, coming soon, TBD, todo) still matches.
- §5.1.1 account-no-delete: recognize "close account" / "cancel account" /
"erase account" / "delete my data" as deletion (Vault labels it "Close
account"), so apps that DO offer deletion aren't false-warned. Deliberately
excludes "deactivate" — Apple deems it insufficient, so it must not suppress.
- "Missing safeguard" rules (account-no-delete, iap-no-restore,
social-login-no-apple, missing-att) now report once per file via a new
firstMatchOnly flag, instead of one near-identical finding per matching line.
Result: Vault goes from 27 warnings to a correct GREENLIT. Adds rule tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Vault run exposed two report-timing issues:
1. `revyl test run` can return a moment before the report finalizes, so reading
it immediately yields session_status=running with no failing step. Poll the
report (up to ~36s) until it settles, so the finding carries the real failing
step + reason instead of just a bare FAILED.
2. Revyl's passed_steps/failed_steps counts can lag the per-step statuses. Count
steps with a terminal status from the step array too and take the larger — so
the "0 steps = setup failure" guard never misfires when steps actually ran.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The real cause of "0 steps executed" on Vault/amazoon: `revyl test create` was
called with only the YAML build.name, never `--app <app-id>`. Without that
association, `revyl test run` resolves the build version but never installs/
launches it, so the run records zero steps. (Spootify happened to work; Vault
and amazoon did not — confirmed by launching Vault directly via `device start`,
which worked, vs the test run, which didn't.)
Fix:
- revyl.Client.AppID(name): resolve a build/app name to its Revyl app id via
`revyl app list --json` (exact then case-insensitive match)
- EnsureTest(name, yamlPath, appID): pass `--app`, and delete-then-create so the
test is always freshly bound to the right build (avoids stale --force sync
conflicts); run in the YAML's dir so revyl's .revyl/ scratch stays contained
- runner: resolve the app id once, error clearly if the build name has no app
- also inline credential values into step text instead of a metadata.variables
block (the block was an earlier red herring but inlining is cleaner regardless)
Verified end to end: greenlight drives Vault on a cloud sim through sign-up ->
Profile -> Close account -> confirm, and correctly reports the flow dead-ends on
the "account closed" screen instead of returning to a logged-out state.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Running verify against a second app surfaced a silent bug: greenlight used a
stable test name (greenlight-account-deletion) for every app. The first run
bound that test to app A; on the next app, `revyl test create --force` updated
the steps but did NOT rebind the build, so the run silently executed against
app A again (the report's app_name gave it away).
Now the test name embeds the build: greenlight-<build-slug>-<flow>, so each app
gets its own test bound to the right build. renderTestYAML takes the name as a
param; runner threads one tname through create/run/report/share. Drops the now
dead Flow.TestName field.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Test-running against amazoon surfaced a correctness bug: a run that failed
before executing any step (the build didn't launch on the cloud device) was
reported as "the §5.1.1 flow FAILED" — a false catch. Two causes, both fixed:
1. RunTest classified outcomes from stdout keywords and short-circuited to an
error before the structured report was ever read. Removed — RunTest now only
hard-errors when revyl itself can't run (non-exit error); a non-zero exit is
left for the report to adjudicate.
2. The runner keyed "did the flow run" off total_steps. Real reports show
total_steps/passed/failed all 0 when nothing executed. Now StepsRun =
passed_steps + failed_steps, and a failed run with 0 executed steps is
classified as a setup error ("could not run"), never a flow failure. A
genuine step failure (failed_steps>0, e.g. the Spootify run) still reports
FAILED with the failing step + reason.
Also prefer the report's `success` boolean as the verdict over session_status.
Adds a regression test for the amazoon 0-step case.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- preflight (static): add a light one-line tip pointing to `preflight --verify`
— a pointer to the runtime command, not a signup wall
- terminology: Revyl runs on cloud devices (cloud-hosted sims), not physical
hardware. Replace every "real device(s)" with "cloud device(s)" across the
CLI output, help text, README, and SKILL — including the upstream tagline
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The free static scanner should deliver full value on its own without pushing
Revyl. Remove the automatic runtime nudge from plain `preflight` so its default
output is unchanged from upstream — offline, complete, no pitch.
The Revyl runtime tier stays strictly opt-in: it only appears when the user
explicitly runs `greenlight verify` or passes `preflight --verify`. Also
decouples the two tiers in the README lead so static reads as its own product.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>