iOS Sensitive Data in NSLog / os_log

Detects sensitive data passed to NSLog, print, or os_log that ends up in device logs accessible via Xcode/Console.

zakirkun Updated

File contents

iOS Sensitive Data in Logs

Overview

iOS device logs (accessible via Xcode Console, idevicesyslog, and Crash Reports) can be read by:

  • Developers with physical device access
  • Malicious apps with log access entitlements
  • Anyone who can read the device logs via iTunes backup

Logging passwords, tokens, PII, or financial data is a compliance violation.

Remediation

  • Remove all NSLog/print calls in production builds using macros
  • Use os_log with %{private} format specifier for sensitive data
  • Build with DEBUG flag guard: #if DEBUG ... NSLog(...) ... #endif

zakirkun/ice-tea/tree/main/skills/mobile/ios/ios-sensitive-logging commit 3a508f14a5

Frequently asked questions

npx skillmds@latest add zakirkun/ios-sensitive-data-in-nslog-os-log