Files
pruefwerk/compliance-agent/rules/cra_semgrep_objc.yaml
T
sharang 5b2deec9e8
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
feat(ios): secrets in UserDefaults, URL schemes and permissions of iOS apps (#479)
2026-10-05 23:35:23 +00:00

17 lines
1.1 KiB
YAML

# Prüfwerk's own semgrep rules for Objective-C (iOS apps), as regex patterns:
# semgrep has no Objective-C parser. Same conventions and provenance as
# cra_semgrep_swift.yaml, whose Swift rules these mirror.
# Test cases: cra_semgrep_objc.m (`semgrep --test compliance-agent/rules`).
rules:
# --- cra-ai-14: data at rest -------------------------------------------------
- id: cra-ai-14-objc-secret-in-userdefaults
languages: [regex]
severity: WARNING
message: A password, token or key is stored in NSUserDefaults, an unencrypted plist in the app container that backups and device extraction read (CWE-312). Store it in the Keychain (kSecClassGenericPassword, with a ThisDeviceOnly accessibility).
metadata:
cwe: ["CWE-312: Cleartext Storage of Sensitive Information"]
control: cra-ai-14
paths:
include: ["*.m", "*.mm"]
pattern-regex: (?i)\[\s*(?:\[\s*NSUserDefaults\s+standardUserDefaults\s*\]|\[\s*\[\s*NSUserDefaults\s+alloc\s*\]\s*initWithSuiteName:[^\]]*\]|\w*defaults)\s+set(?:Object|Value):[^\]\n]*(?:passw|passcode|token|secret|api_?key|credential|private_?key|session_?id)[^\]\n]*\]