feat(sast): Android and iOS app analysis with mobsfscan
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 7m13s

mobsfscan (LGPL-3.0, used unchanged) checks Java, Kotlin, Swift and
Objective-C code and the AndroidManifest and Info.plist settings, with a
CWE and the OWASP MASVS requirement on each rule. It runs on the image's
semgrep (installed --no-deps, its other dependencies pinned) with metrics
off.

Three of its defaults would mislead on a customer's tree, so:
- docker/pruefwerk_mobsfscan.py clears its path ignores: libsast skips
  any path that merely contains 'spec' or 'fixtures', so code under
  inspection/ vanished. Ours are anchored as /name/ and passed with -c,
  which also stops it reading a .mobsf file from the repository.
- --type auto configures the iOS rules only when there is no Android
  code, so a React Native or Flutter app was checked as Android only. It
  now runs once per platform present.
- Manifest and plist matches report line 1; the line that sets the key is
  looked up. App-wide "missing protection" hints carry no location and
  are left out.

The scan runs in scan_tree after cppcheck when the tree holds Java,
Kotlin, Swift or Objective-C (`.m`/`.mm` now count as objc); a failure
records a sast_mobile skip, which the CRA view treats like a failed
semgrep. The control map binds mobsfscan by CWE to cra-ai-1, 7, 8, 9, 13,
14, 15, 16 and 20, each with only the languages it has rules for.

Nightly: android-insecure and ios-insecure fixtures, and one flaw each in
the React Native fixture's Java and Swift, so both platforms must run.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-10-01 18:37:15 +02:00
1 parent 3ad6cc538b
commit 043f3589bd
29 files changed
+961 -15

No files matched your search

+2 -1
View File
@@ -27,6 +27,7 @@ For the **CRA** framework (40 controls) the split is **21 covered · 0 needs_too
- **Custom semgrep detectors**, shipped in the binary and matched back to controls **by rule id** so a broad CWE can't over-attribute:
- for Python and JavaScript/TypeScript: `cra-ai-1`, `7`, `10`, `14` (secure-by-default, weak password hashing, insecure session cookies, weak data-at-rest ciphers), `cra-ai-20` (shell commands and SQL built from variables, request input echoed into a response), `cra-ai-8` (hard-coded credentials, Python) and `cra-ai-15` (plain `http://` requests);
- for C and C++ firmware: `cra-ai-8`, `13`, `16`, `20` (hard-coded credentials including `#define` macros, broken hash/cipher, `rand()`, unbounded string functions and non-literal format strings), next to cppcheck for memory safety.
- **mobsfscan** for Android and iOS apps, bound **by CWE** (a mobsfscan binding only ever attaches mobsfscan findings): `cra-ai-1` (debuggable, exported components, outdated `minSdkVersion`), `7`, `8`, `9`, `13`, `14`, `15` (cleartext, TLS, App Transport Security), `16` and `20`. Each binding lists only the languages mobsfscan has rules for under those CWEs, so `cra-ai-1` covers Java and Kotlin (its manifest checks) but not Swift.
- **8 grounded surface checks** (`cra-ai-6`, `11`, `12`, `24`, `27`, `28`, `29`, `30`): the absence-based controls (no rate limiting, no security logging, no update-signature check…) that have no syntactic pattern.
- **Marked not_code_checkable** (`cra-ai-2`, `3`, `4`, `5`, among the 19): minimal attack surface, secure architecture, least privilege, tamper protection.
@@ -34,7 +35,7 @@ For the **CRA** framework (40 controls) the split is **21 covered · 0 needs_too
Each binding in the control map names the **languages** its rules run on (`languages`, empty for language-independent tools such as gitleaks, syft and osv). A test keeps these in step with the rule pack. Each scan run records the source languages it saw outside vendor code (`ScanRun.languages`).
The CRA status calls a covered control **"no violation found"** only when one of its bindings applies to those languages *and* no tool it relies on failed in that scan (a skipped `sast`, `sast_c_cpp` or `cve_lookup` stage). Otherwise the control is **not assessed**, with the reason: not scanned yet, no rule for the languages found, a tool that did not complete, or languages unknown (a run from before they were recorded). A C-only firmware repo therefore never reads "no violation found" for controls only Python rules check (#368, #387).
The CRA status calls a covered control **"no violation found"** only when one of its bindings applies to those languages *and* no tool it relies on failed in that scan (a skipped `sast`, `sast_c_cpp`, `sast_mobile` or `cve_lookup` stage). Otherwise the control is **not assessed**, with the reason: not scanned yet, no rule for the languages found, a tool that did not complete, or languages unknown (a run from before they were recorded). A C-only firmware repo therefore never reads "no violation found" for controls only Python rules check (#368, #387).
At scale, the **master-controls** corpus (breakpilot's deduped clusters, exported as OSCAL) currently provides **~2,882 code-checkable controls** (2,143 `network` + 739 `source_code`), matched semantically.