feat(ios): secrets in UserDefaults, URL schemes and permissions of iOS apps (#479)
CI / Check (push) Skipped
CI / Detect Changes (push) Successful in 4s
CI / Deploy MCP (push) Skipped
CI / Deploy Docs (push) Successful in 1m12s
CI / Deploy Dashboard (push) Successful in 5m51s
CI / Deploy Agent (push) Successful in 7m29s

This commit was merged in pull request #479.
This commit is contained in:
sharang committed 2026-10-05 23:35:23 +00:00
1 parent 5fdf80a1e0
commit 5b2deec9e8
19 files changed
+906 -5

No files matched your search

@@ -0,0 +1,14 @@
{
"scan_status": "completed",
"skipped_stages": [],
"sbom": [],
"findings": [
"ios-config:ios-custom-url-scheme Info.plist:7",
"ios-config:ios-permission-without-usage-string Session.swift:12",
"ios-config:ios-sensitive-permission Info.plist:18",
"ios-config:ios-sensitive-permission Info.plist:20",
"semgrep:cra-ai-14-objc-secret-in-userdefaults LegacyLogin.m:4",
"semgrep:cra-ai-14-swift-secret-in-userdefaults Session.swift:7"
],
"cves": []
}
@@ -5,7 +5,8 @@
"findings": [
"mobsfscan:ios_app_logging PumpLink.m:8",
"mobsfscan:ios_ats_arbitrary_loads Info.plist:6",
"mobsfscan:ios_weak_hash Store.swift:10"
"mobsfscan:ios_weak_hash Store.swift:10",
"semgrep:cra-ai-14-swift-secret-in-userdefaults Store.swift:6"
],
"cves": []
}
+2 -1
View File
@@ -17,7 +17,8 @@ as a source archive. They prove that no mobile app ends with "0 packages,
| `react-native` | `package-lock.json`; neither `ios/Podfile` nor the Gradle app is locked | the npm packages; a recorded `sbom_dependencies` skip |
| `android-insecure` | nothing (no Gradle lock) | mobsfscan: manifest (debuggable, backups, cleartext, minSdk), Kotlin (JavaScript bridge, MD5), Java under `inspection/` (world-readable, `Random`) |
| `ios-insecure` | nothing | mobsfscan: ATS off in `Info.plist`, `CC_MD5` in Swift, `NSLog` in Objective-C |
| `ios-insecure` | nothing | mobsfscan: ATS off in `Info.plist`, `CC_MD5` in Swift, `NSLog` in Objective-C; semgrep: the password `Store.swift` keeps in `UserDefaults` |
| `ios-app-settings` | nothing | ios-config: the `pumplink` URL scheme, Bluetooth and local-network permissions, a contacts request without a usage string; semgrep: an access token in `UserDefaults` (Swift) and a password in `NSUserDefaults` (Objective-C) |
The other fixtures' code only makes each tree look like the app it stands for
and must stay free of findings, except React Native, whose Java and Swift files
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.example.pumplink</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.example.pumplink.pairing</string>
<key>CFBundleURLSchemes</key>
<array>
<string>pumplink</string>
</array>
</dict>
</array>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>PumpLink connects to your pump over Bluetooth.</string>
<key>NSLocalNetworkUsageDescription</key>
<string>PumpLink finds pump gateways on your network.</string>
</dict>
</plist>
@@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
void PLRememberLogin(NSString *password) {
[[NSUserDefaults standardUserDefaults] setObject:password forKey:@"PLPumpPassword"];
}
@@ -0,0 +1,15 @@
import Contacts
import Foundation
/// Keeps the pump cloud session of the signed-in user.
final class Session {
func signedIn(accessToken: String, user: String) {
UserDefaults.standard.set(accessToken, forKey: "pumpCloudAccessToken")
UserDefaults.standard.set(user, forKey: "lastUser")
}
func shareWithCaregiver() {
let store = CNContactStore()
store.requestAccess(for: .contacts) { _, _ in }
}
}
+21
View File
@@ -729,6 +729,27 @@
]
}
},
{
"key": "mobile-ios-app-settings",
"name": "iOS · URL scheme, permissions and secrets in UserDefaults",
"target_type": "ios_app",
"description": "Uploaded as a source archive. A Swift and Objective-C app whose Info.plist registers a custom URL scheme and asks for Bluetooth and the local network, which requests the contacts without a usage string, and which keeps an access token and a password in UserDefaults. Prüfwerk's own Swift and Objective-C semgrep rules and the ios-config checks must find each one.",
"artifacts": [
{
"kind": "source_archive",
"upload": "fixtures/nightly/mobile/ios-app-settings"
}
],
"expect": {
"sast_rule_ids": [
"ios-custom-url-scheme",
"ios-sensitive-permission",
"ios-permission-without-usage-string",
"cra-ai-14-swift-secret-in-userdefaults",
"cra-ai-14-objc-secret-in-userdefaults"
]
}
},
{
"key": "mobile-android-legacy-groovy",
"name": "Android · Groovy build without a lockfile",