Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .claude/skills/mobile-audit/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
name: mobile-audit
description: Run a structured, evidence-based release audit of an Android and/or iOS mobile app (native, Flutter, React Native, or hybrid) and end with a Go / Conditional / No-Go decision. Covers build integrity, functional/UX/accessibility/performance/reliability, local + network + backend security (OWASP MASVS/MASWE/MASTG traceability), privacy and data governance, permissions, supply chain, and Apple/Google store compliance and listing accuracy. Use whenever the user wants to audit, review, vet, harden, or "check before release" a mobile app, asks if an app is ready for the App Store or Google Play, wants a security/privacy/compliance review of an APK/AAB/IPA or a mobile codebase, or mentions MASVS, Data Safety, privacy labels, or release readiness - even if they do not say "audit".
---

# Mobile App Audit

Produces a traceable release audit: every control ends in an explicit state backed by evidence, every problem is a structured finding, and the output is a release decision rather than a pass count.

**Why it is built this way.** An LLM audit's characteristic failure is silence being read as safety: "I found no problems" gets reported as "there are no problems". So this skill never lets an untested item pass. It also separates what was *run* from what was *inferred from code*, because a static read of Dart/Kotlin/Swift cannot prove runtime behavior on a device.

## Authorization and scope

Audit only apps the user owns or is authorized to assess. Tamper, instrumentation, and reverse-engineering checks (domain 19) run against the user's own builds. Do not run active tests against third-party backends or production services without the user confirming they are in scope; static analysis and test/staging targets are the default.

## Workflow

Work phase by phase. Each phase writes evidence to `audit/` (create it in the repo root, or ask where) and later phases consume it, e.g. Discovery -> Data Inventory -> Privacy -> Store Disclosure. Do not re-derive facts an earlier phase established.

| Section | Phases | Domains (see `references/domains.md`) |
|---|---|---|
| **A. Scope & Build** | 0 Init, 1 Discovery, 2 Architecture/attack surface | 01 Identity, 02 Build integrity, 03 Install/upgrade/removal |
| **B. Quality** | 3 Feature inventory, 4 Functional, 5 GUI, 6 UX/A11y, 7 Compat, 8 Perf, 9 Reliability | 04-11, 20 Offline |
| **C. Security** | 10 Local, 11 Network, 12 API/backend, 13 Authn/Authz, 17 Tamper | 12-15, 19 |
| **D. Privacy & Supply chain** | 14 Privacy, 15 Permissions, 16 Dependencies/SBOM, 18 Logging/telemetry | 16, 17, 18, 21 |
| **E. Store** | 19 Apple, 20 Google, 21 Listing | 22, 23 |
| **F. Gate** | 22 Regression verify, 23 RC audit, 24 Decision | 24 |

The user may ask for one section or one domain ("just the security section", "just Google Play compliance"). Run what was asked, still do Phase 0-1 (they are cheap and everything depends on them), and mark everything else NOT TESTED in the report instead of omitting it.

### Phase 0 - Initialization
0. **Adapt to the project and the request before asking anything.** Detect from the repo, then confirm in one line and proceed unless something is ambiguous:
- *Platforms:* `android/` + Gradle/manifest -> Android; `ios/` + Xcode project/Info.plist -> iOS; both -> both; Flutter/RN projects usually have both folders, so check whether each is actually configured (bundle ID, signing, entitlements) or just scaffolding. A platform the user says is "later" or that is only scaffolding is out of scope; note it in the report instead of auditing it.
- *Domains that don't apply:* no backend/network calls -> 13-14 N/A; no accounts -> 15 and account-deletion checks N/A; no payments -> billing checks N/A; no UGC -> moderation N/A; no ads/analytics -> verify by dependency search, then N/A. Mark each N/A with the evidence that showed it, so the claim can be checked.
- *Request scope overrides defaults:* honor "just security", "skip store stuff", "Android only", "no performance". Skipped domains are listed NOT TESTED (user-excluded) in the report, not dropped.
- *Depth follows the threat model:* a local-only app with a PIN needs strong storage/crypto/lock checks and little RESILIENCE; a networked app with accounts needs API/authz depth.
Then state the resulting scope (platforms, active domains, N/A domains, excluded domains) in two or three lines before starting.
1. Ask or detect: the artifact under audit (path/hash of APK/AAB/IPA, or "source only"), target environment, threat model/data sensitivity, and what the user wants (full audit vs section).
2. Choose an **evidence mode** and state it up front:
- **Source-only** - repo access, no build. Static findings only; runtime states become NOT TESTED or MANUAL REVIEW.
- **Artifact** - APK/AAB/IPA inspected (`scripts/inspect_artifact.sh` for Android helpers). Verifies what actually ships.
- **Runtime** - app executed on emulator/device by the user or via tooling; dynamic checks possible.
3. Create `audit/coverage.md` (see Evidence states) and `audit/findings/`.

### Phase 1 - Discovery (domain 01)
Capture the identity record from `references/domains.md` section 01 (IDs, version, build, commit SHA, SDK levels, backends, SDKs, data classes). Pull from manifests, `Info.plist`, `pubspec.yaml`/`package.json`/Gradle, CI config, and git.

**Identity gate:** if the audited artifact cannot be tied to the artifact intended for publication (same version/build/commit/signing), the final decision may not be "Go". Say so in the report header.

### Phase 2 - Architecture and attack surface
Draw the flow `Client -> Network -> Edge -> API -> Auth -> Services -> Storage`, list every entry point (deep links, intents, URL schemes, exported components, push payloads, share targets, file imports, widgets) and every outbound host. This map drives Sections C and D; refer back to it rather than re-scanning.

### Phases 3-9 - Quality, 10-18 - Security/Privacy/Supply chain, 19-21 - Store
For each domain, open its entry in `references/domains.md`, then load only the platform file(s) in scope:
- `references/android.md` - manifest, Gradle, Keystore, Play specifics, tooling commands
- `references/ios.md` - plist, entitlements, ATS, Keychain, App Store specifics, tooling commands
- `references/security-masvs.md` - control-group traceability (MASVS-STORAGE/CRYPTO/AUTH/NETWORK/PLATFORM/CODE/RESILIENCE/PRIVACY) for every security finding
- `references/store-compliance.md` - store checks. **Store policies change; fetch or version-check current Apple and Google requirements at audit time** (WebSearch/WebFetch) and record the date and source you used. Never rely on memory for target-API deadlines, Data Safety rules, or review guidelines.

For each control: test or inspect, record the state and evidence, and raise a finding if it fails. Prefer cheap deterministic checks (grep, plist/manifest parse, dependency listing, `aapt2`) over reasoning from impressions. Fan independent domains out to subagents when many are in scope; give each the Phase 1-2 artifacts and the finding schema, and have it return findings plus coverage rows, not prose.

### Phases 22-24 - Verification and decision
Re-test every FAIL that the user fixed during the audit, on the same artifact lineage, and record the result. Then compute the decision with `references/report-template.md`.

## Evidence states (the Coverage & Evidence Matrix)

Every control gets exactly one state. There is no implicit pass.

| State | Meaning | Requires |
|---|---|---|
| PASS | Tested, requirement met | Evidence (command output, file+line, screenshot, log) |
| PASS-WARN | Met, with a concern | Evidence + concern |
| FAIL | Requirement violated | Evidence + a finding ID |
| BLOCKED | Could not test (no device, no creds, no network) | What was missing |
| N/A | Demonstrably not applicable | Why (e.g. "no accounts exist: manifest + code search show no sign-up") |
| NOT TESTED | Audit did not evaluate it | - |
| MANUAL REVIEW | A human must verify | What to check and how |

Also tag each PASS/FAIL with how it was established: `[runtime]`, `[artifact]`, or `[static]`. A `[static]` PASS on a runtime behavior (e.g. "screenshots are blocked", "token not logged") is capped at PASS-WARN unless backed by a test. The report's headline must show the coverage ratio (tested vs NOT TESTED/BLOCKED) next to every score, because a score over thin coverage is misleading.

## Findings

One structured finding per issue, using the schema in `references/findings-schema.md`, saved as `audit/findings/<ID>.md`. IDs: `MOB-<DOMAIN>-<nnnn>` (`SEC`, `API`, `PRV`, `UX`, `PERF`, `REL`, `STORE`, `BLD`, `A11Y`, `IOS`, `AND`). Severity S0-S5 plus blocker flags (store / security / functional / data-loss / privacy / quality) are defined there. Rules:
- Evidence is mandatory; a finding without a reproducible observation is a hypothesis - mark confidence `low` and route it to MANUAL REVIEW.
- Never print secrets, tokens, or PII found during the audit. Cite location and type, redact the value.
- Recommend a concrete remediation and a verification procedure so Phase 22 can close it.
- Server-side trust: any control enforced only by the client is a finding (the client is attacker-controlled).

## Decision and report

Follow `references/report-template.md`: header (identity + evidence mode + coverage), scores per area, decision (GO / CONDITIONAL GO / CONDITIONAL NO-GO / NO-GO), blockers, critical findings, then the coverage matrix and appendix. Rules for the decision:
- Any S5, or any unresolved store/security/privacy/data-loss blocker -> NO-GO.
- Identity gate failed -> cannot be GO.
- Large NOT TESTED / BLOCKED areas in security, privacy, or store -> cannot be GO; say what is missing to get there.
- Be direct: lead with the decision and blockers, not the methodology.

Offer to publish the report as an artifact or write it to `audit/REPORT.md`.
44 changes: 44 additions & 0 deletions .claude/skills/mobile-audit/references/android.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Android specifics

Contents: artifact inspection · manifest · storage/crypto · network · build · Play · Flutter/RN notes

## Artifact inspection (domain 02, 12, 13, 17, 18, 19)
```bash
aapt2 dump badging app.apk # package, versionCode/Name, min/target SDK, uses-permission, ABIs
aapt2 dump permissions app.apk
apkanalyzer manifest print app.apk # MERGED manifest (what actually ships)
apkanalyzer files list app.apk ; apkanalyzer apk summary app.apk
apksigner verify --print-certs -v app.apk # signing scheme versions + cert SHA-256 (identity gate)
unzip -l app.aab | head # AAB: bundletool build-apks / dump manifest
bundletool dump manifest --bundle=app.aab
```
Search the unpacked package for: `http://`, `api_key`, `secret`, `BEGIN PRIVATE KEY`, `.env`, `google-services.json` content, staging hostnames, `debuggable`. `scripts/inspect_artifact.sh <apk>` runs the common set and writes `audit/artifact/`.

## Manifest checks
- `android:debuggable` absent/false in release; `android:allowBackup` and `dataExtractionRules`/`fullBackupContent` match intent (backup of tokens/DB is a finding unless documented).
- `usesCleartextTraffic` false or scoped by `networkSecurityConfig`; no user-CA trust in release.
- Exported components: every `activity/service/receiver/provider` with intent-filter or `exported=true` is an entry point; check permission guards and input validation. Android 12+ requires explicit `exported`.
- Deep links / App Links: `autoVerify`, assetlinks.json, parameter validation.
- `uses-permission`: each must map to a feature (domain 17). Plugins add some silently; `tools:node="remove"` strips them. Check `minSdk`/`targetSdk` against current Play requirement (fetch current deadline, do not assume).
- Foreground services: type declared + Play declaration.
- `FLAG_SECURE` on sensitive screens; recents thumbnail behavior (set flag before backgrounding, clear after resume).

## Storage and crypto (domain 12)
Look in app-private dirs (`/data/data/<pkg>`: databases, shared_prefs, files, cache, no_backup) via `adb run-as` on debuggable builds or an emulator. Tokens/keys belong in Keystore-backed storage (EncryptedSharedPreferences/Keystore, or `flutter_secure_storage`), not plain prefs/SQLite. Check external storage/MediaStore writes, clipboard use, logcat output (`adb logcat` through a full user flow, grep for tokens/PII), notification content on lock screen, share-intent leakage, and key derivation (PBKDF2/Argon2 iterations, random salt, no hardcoded keys, GCM not ECB).

## Network (domain 13)
`network_security_config.xml`, pinning (`<pin-set>` with backup pin and expiry), TrustManager/HostnameVerifier overrides, WebView settings (`setJavaScriptEnabled`, `addJavascriptInterface`, file access, mixed content).

## Build and release (domain 02)
R8/minify and shrink on, `mapping.txt` archived not shipped, `signingConfigs` not using debug keys, `key.properties`/keystore not in git, Play App Signing enrolled, versionCode monotonic, no test ad unit IDs, `BuildConfig.DEBUG` paths dead.

## Play-specific (domain 22; fetch current policy)
Target API level requirement, Data Safety form vs real behavior, account deletion (in-app + web link), permissions declaration forms (SMS, call log, background location, all-files, accessibility), foreground-service types, ads declaration, content rating, target audience / Families, billing (Play Billing for digital goods), 64-bit, AAB, Play pre-launch report. Android Vitals thresholds (crash and ANR rates) are a post-release extension.

## Framework notes
- **Flutter:** release is AOT, but strings/endpoints remain readable in `libapp.so`; `--obfuscate --split-debug-info` is optional hardening, not a security boundary. Check `flutter_secure_storage` use, plugin permission additions, `assets/` for bundled secrets, platform channel inputs.
- **React Native:** check the JS bundle (`index.android.bundle`) for secrets/endpoints; Hermes bytecode still decompiles; disable dev menu/remote debugging in release; CodePush/OTA update integrity.
- **Hybrid/WebView:** bridge exposure and origin allowlists.

## Runtime tooling (when a device/emulator is available)
`adb shell dumpsys package <pkg>`, `adb shell am start -W` (startup time), `adb shell dumpsys gfxinfo <pkg>` (frames), `adb shell dumpsys meminfo <pkg>`, `adb shell dumpsys batterystats`, Perfetto/Macrobenchmark, `adb logcat`, Android Studio profilers, `adb shell pm revoke` / `appops` for permission denial tests. Network faults: emulator `-netdelay/-netspeed`, or a proxy (mitmproxy/Charles) on a test device.
Loading
Loading