cra-ai-14-objc-secret-in-userdefaults: a regex rule, because semgrep has no Objective-C parser.
What counts: the key or the value names a password, token, key, credential or session id. Never a literal true/number.
Tests:
semgrep --test compliance-agent/rules: 20/20.
The rule ids come out bare through bare_rule_id (#463/#473), pinned by a test.
The control-map binding says languages: [swift, objc, regex]. regex is there because of the Objective-C rule; the existing test requires a binding to name every language its rules run on.
Reads: every Info.plist (with Apple's DOCTYPE) and the INFOPLIST_KEY_* settings in project.pbxproj. Pods/, Carthage/ and build/ are skipped.
Findings:
ios-custom-url-scheme, Low, CWE-939: the schemes from CFBundleURLTypes. Remedy: Universal Links, validate the input, PKCE for OAuth.
ios-sensitive-permission, Info: one finding per access type. Bluetooth's and calendars' old and new keys count once.
ios-permission-without-usage-string, Low: a request (location, camera, microphone, contacts, photos, Bluetooth, tracking) that no usage string covers, reported at the call. Only judged when the tree has a plist or Xcode project; an Expo app.json app is not judged.
CRA mapping: URL schemes and permissions are an inventory with no CRA mapping. cra-ai-2 (attack surface) and cra-ai-17 (data minimisation) deliberately stay not code-checkable, which a test pins.
Dashboard: label "iOS-App-Einstellungen".
Docs:guide/scanning, reference/tools.
Tests
Unit tests:
plist: line numbers, schemes, permission dedup, Pods skipped, binary/broken plist;
Nightly, run locally (bless, then compare, both green):
new fixture mobile/ios-app-settings: all 6 expected findings;
ios-insecure gains semgrep:cra-ai-14-swift-secret-in-userdefaults Store.swift:6. The fixture stores a password in UserDefaults, a true positive that mobsfscan missed.
The Python baselines' drift was discarded (it came from new OSV advisories).
To check on stage
Upload an iOS app as an archive (for example fixtures/nightly/mobile/ios-app-settings).
Expect two Codeanalyse findings for UserDefaults (Swift line 7, ObjC line 4) under CRA control cra-ai-14.
Expect findings with the tool name "iOS-App-Einstellungen": the URL scheme pumplink (Low), Bluetooth and local network (Info), and contacts without a usage string (Low, Session.swift:12).
**iOS readiness, story 2: static checks.** Requested by the platform session for the mobile epic. Stage only. Builds on #478.
## Already covered by mobsfscan (not duplicated)
ATS exceptions (`ios_ats_*`), Keychain accessibility, weak hashes and ciphers, TLS, UIWebView and web views.
## New
### Own semgrep rules: secrets in UserDefaults (→ cra-ai-14)
- **New packs**, both added to `RULE_PACKS`: `rules/cra_semgrep_swift.yaml` and `rules/cra_semgrep_objc.yaml`.
- **Rules:**
- `cra-ai-14-swift-secret-in-userdefaults`: `UserDefaults.standard` or a suite, called directly or through a local variable.
- `cra-ai-14-swift-secret-in-appstorage`: `@AppStorage`.
- `cra-ai-14-objc-secret-in-userdefaults`: a regex rule, because semgrep has no Objective-C parser.
- **What counts:** the key or the value names a password, token, key, credential or session id. Never a literal `true`/number.
- **Tests:**
- `semgrep --test compliance-agent/rules`: 20/20.
- The rule ids come out bare through `bare_rule_id` (#463/#473), pinned by a test.
- The control-map binding says `languages: [swift, objc, regex]`. `regex` is there because of the Objective-C rule; the existing test requires a binding to name every language its rules run on.
### `pipeline/ios_config.rs` (scanner `ios-config`, stage 4)
- **Reads:** every `Info.plist` (with Apple's DOCTYPE) and the `INFOPLIST_KEY_*` settings in `project.pbxproj`. `Pods/`, `Carthage/` and `build/` are skipped.
- **Findings:**
- `ios-custom-url-scheme`, **Low**, CWE-939: the schemes from `CFBundleURLTypes`. Remedy: Universal Links, validate the input, PKCE for OAuth.
- `ios-sensitive-permission`, **Info**: one finding per access type. Bluetooth's and calendars' old and new keys count once.
- `ios-permission-without-usage-string`, **Low**: a request (location, camera, microphone, contacts, photos, Bluetooth, tracking) that no usage string covers, reported at the call. Only judged when the tree has a plist or Xcode project; an Expo `app.json` app is not judged.
- **CRA mapping:** URL schemes and permissions are an **inventory with no CRA mapping**. cra-ai-2 (attack surface) and cra-ai-17 (data minimisation) deliberately stay *not code-checkable*, which a test pins.
- **Dashboard:** label "iOS-App-Einstellungen".
- **Docs:** `guide/scanning`, `reference/tools`.
## Tests
- Unit tests:
- plist: line numbers, schemes, permission dedup, Pods skipped, binary/broken plist;
- pbxproj keys;
- requests in Swift/ObjC at the right line;
- not judged without a plist.
- fmt and clippy `-D warnings` (agent, dashboard). Agent lib: 656 tests.
- **Nightly, run locally** (bless, then compare, both green):
- new fixture `mobile/ios-app-settings`: all 6 expected findings;
- `ios-insecure` gains `semgrep:cra-ai-14-swift-secret-in-userdefaults Store.swift:6`. The fixture stores a password in UserDefaults, a true positive that mobsfscan missed.
- The Python baselines' drift was discarded (it came from new OSV advisories).
## To check on stage
1. Upload an iOS app as an archive (for example `fixtures/nightly/mobile/ios-app-settings`).
2. Expect two **Codeanalyse** findings for UserDefaults (Swift line 7, ObjC line 4) under CRA control cra-ai-14.
3. Expect findings with the tool name "iOS-App-Einstellungen": the URL scheme `pumplink` (Low), Bluetooth and local network (Info), and contacts without a usage string (Low, `Session.swift:12`).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
iOS readiness, story 2 (static checks). mobsfscan already covers ATS,
Keychain accessibility, weak hashes/ciphers, TLS and web views; this
adds what it does not.
- Own semgrep rules in new packs (rules/cra_semgrep_swift.yaml,
rules/cra_semgrep_objc.yaml, both in RULE_PACKS):
cra-ai-14-swift-secret-in-userdefaults (UserDefaults.standard or a
suite, directly or through a local), cra-ai-14-swift-secret-in-appstorage
(@AppStorage) and cra-ai-14-objc-secret-in-userdefaults (a regex rule:
semgrep has no Objective-C parser). A key or value naming a password,
token, key, credential or session id, never a literal flag or number.
Test cases beside them (semgrep --test: 20/20). Mapped to cra-ai-14;
ids come out bare through #463's bare_rule_id, which a test pins.
- pipeline/ios_config.rs (scanner ios-config, stage 4): every Info.plist
(Apple's DOCTYPE allowed) and the pbxproj INFOPLIST_KEY_* settings,
outside Pods/Carthage/build:
- ios-custom-url-scheme (Low, CWE-939): CFBundleURLTypes schemes;
- ios-sensitive-permission (Info, CWE-250): one per access granted
(location, camera, microphone, contacts, photos, calendars,
Bluetooth, local network, health, motion, speech, tracking);
- ios-permission-without-usage-string (Low): a request in Swift or
Objective-C no usage string covers, at the call; judged only when
the tree holds a plist or Xcode project (not an Expo app.json).
The first two are an inventory, bound to no control: cra-ai-2 and
cra-ai-17 stay not code-checkable.
- Dashboard label "iOS-App-Einstellungen"; docs (scanning, tools).
- Nightly fixture mobile/ios-app-settings (all six findings); the
ios-insecure baseline gains the password Store.swift keeps in
UserDefaults, a true positive mobsfscan missed.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang
merged commit 5b2deec9e8 into main2026-10-05 23:35:24 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
iOS readiness, story 2: static checks. Requested by the platform session for the mobile epic. Stage only. Builds on #478.
Already covered by mobsfscan (not duplicated)
ATS exceptions (
ios_ats_*), Keychain accessibility, weak hashes and ciphers, TLS, UIWebView and web views.New
Own semgrep rules: secrets in UserDefaults (→ cra-ai-14)
RULE_PACKS:rules/cra_semgrep_swift.yamlandrules/cra_semgrep_objc.yaml.cra-ai-14-swift-secret-in-userdefaults:UserDefaults.standardor a suite, called directly or through a local variable.cra-ai-14-swift-secret-in-appstorage:@AppStorage.cra-ai-14-objc-secret-in-userdefaults: a regex rule, because semgrep has no Objective-C parser.true/number.semgrep --test compliance-agent/rules: 20/20.bare_rule_id(#463/#473), pinned by a test.languages: [swift, objc, regex].regexis there because of the Objective-C rule; the existing test requires a binding to name every language its rules run on.pipeline/ios_config.rs(scannerios-config, stage 4)Info.plist(with Apple's DOCTYPE) and theINFOPLIST_KEY_*settings inproject.pbxproj.Pods/,Carthage/andbuild/are skipped.ios-custom-url-scheme, Low, CWE-939: the schemes fromCFBundleURLTypes. Remedy: Universal Links, validate the input, PKCE for OAuth.ios-sensitive-permission, Info: one finding per access type. Bluetooth's and calendars' old and new keys count once.ios-permission-without-usage-string, Low: a request (location, camera, microphone, contacts, photos, Bluetooth, tracking) that no usage string covers, reported at the call. Only judged when the tree has a plist or Xcode project; an Expoapp.jsonapp is not judged.guide/scanning,reference/tools.Tests
-D warnings(agent, dashboard). Agent lib: 656 tests.mobile/ios-app-settings: all 6 expected findings;ios-insecuregainssemgrep:cra-ai-14-swift-secret-in-userdefaults Store.swift:6. The fixture stores a password in UserDefaults, a true positive that mobsfscan missed.To check on stage
fixtures/nightly/mobile/ios-app-settings).pumplink(Low), Bluetooth and local network (Info), and contacts without a usage string (Low,Session.swift:12).🤖 Generated with Claude Code
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p