axiom-codex/skills/axiom-scan-security-privacy/SKILL.md
Use when the user mentions security review, App Store submission prep, Privacy Manifest requirements, hardcoded credentials, or sensitive data storage.
npx skillsauth add charleswiltgen/axiom axiom-scan-security-privacyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an expert at detecting security and privacy issues — both known anti-patterns AND missing/incomplete patterns that cause App Store rejections, security vulnerabilities, and privacy violations.
Run a comprehensive security and privacy audit using 5 phases: map the security posture, detect known anti-patterns, reason about what's missing, correlate compound issues, and score security health. Report all issues with:
Include: **/*.swift, **/Info.plist, **/PrivacyInfo.xcprivacy, **/*.entitlements
Skip: *Tests.swift, *Previews.swift, *Mock*, *Fixture*, *Stub*, */Pods/*, */Carthage/*, */.build/*, */DerivedData/*, */scratch/*, */docs/*, */.claude/*, */.claude-plugin/*
Before grepping, build a mental model of the codebase's security and privacy surface.
Glob: **/PrivacyInfo.xcprivacy — is a manifest present?
Glob: **/*.entitlements — what entitlements are requested?
Glob: **/Info.plist — what usage descriptions are present?
Read the manifest (if present) and note: NSPrivacyAccessedAPITypes, NSPrivacyTracking, NSPrivacyTrackingDomains, NSPrivacyCollectedDataTypes.
Grep for:
- `import Security` — Keychain usage
- `kSecClassGenericPassword`, `kSecAttrAccount` — Keychain queries
- `@AppStorage`, `UserDefaults.standard` — plain-text persistence
- `Logger`, `os_log`, `NSLog`, `print` — logging surface
- `URLSession` — network traffic
- `ATTrackingManager` — tracking prompts
- `import CryptoKit`, `import CommonCrypto` — crypto usage
Read 2-3 key files (AuthService, NetworkClient, any file importing Security) to understand:
Write a brief Security & Privacy Map (5-10 lines) summarizing:
Present this map in the output before proceeding.
Run all 7 existing detection patterns. These are fast and reliable. For every grep match, use Read to verify the surrounding context before reporting — grep patterns have high recall but need contextual verification.
Pattern: API keys, secrets, or tokens in source code Search:
apiKey.*=.*"[^"]+", api_key.*=.*"[^"]+", secret.*=.*"[^"]+", token.*=.*"[^"]+", password.*=.*"[^"]+"AKIA[0-9A-Z]{16}sk-[a-zA-Z0-9]{24,}ghp_[a-zA-Z0-9]{36}-----BEGIN.*PRIVATE KEY-----Issue: Keys are extractable from binary via strings or Hopper
Fix: Move to Keychain, environment variables, or server-side proxy
Pattern: Required Reason API used without PrivacyInfo.xcprivacy
Search: Glob **/PrivacyInfo.xcprivacy. If missing, grep for:
UserDefaults, NSUserDefaults → NSPrivacyAccessedAPICategoryUserDefaultsFileManager.*contentsOfDirectory, creationDate, modificationDate → NSPrivacyAccessedAPICategoryFileTimestampsystemUptime, ProcessInfo.*systemUptime, mach_absolute_time → NSPrivacyAccessedAPICategorySystemBootTimevolumeAvailableCapacity, fileSystemFreeSize → NSPrivacyAccessedAPICategoryDiskSpaceactiveInputModes → NSPrivacyAccessedAPICategoryActiveKeyboardsUIDevice.*identifierForVendor → tracking considerationsIssue: App Store Connect blocks submission since May 2024 Fix: Create PrivacyInfo.xcprivacy with declared API types and reason codes
Pattern: Auth tokens in @AppStorage/UserDefaults Search:
@AppStorage.*token, @AppStorage.*key, @AppStorage.*secretUserDefaults.*token, UserDefaults.*apiKey, UserDefaults.*passwordUserDefaults\.standard\.set.*tokenIssue: UserDefaults is unencrypted — accessible via backup extraction and jailbreak
Fix: Keychain with kSecAttrAccessibleWhenUnlockedThisDeviceOnly
Pattern: Cleartext network transmission Search:
http://[a-zA-Z] — HTTP URLs (excluding comments, strings used for tests)NSAllowsArbitraryLoads.*true — global ATS bypassNSExceptionAllowsInsecureHTTPLoads — per-domain HTTP exceptionIssue: Data in cleartext; App Store requires ATS exception justification
Fix: Switch to HTTPS or add justified per-domain NSExceptionDomains entry
Note: Exclude http://localhost, http://127.0.0.1, and documentation strings.
Pattern: Credentials or PII in log output Search:
print.*password, print.*token, print.*apiKeyLogger.*password, Logger.*tokenos_log.*password, os_log.*tokenNSLog.*password, NSLog.*tokenIssue: Logs visible via Console.app, sysdiagnose; included in crash reports
Fix: Remove, redact, or use Logger with privacy: .private / .sensitive
Pattern: ATT API used without Info.plist key Search:
ATTrackingManager, requestTrackingAuthorization, trackingAuthorizationStatusNSUserTrackingUsageDescriptionIssue: ATT prompt cannot display; App Store rejects; app may crash Fix: Add NSUserTrackingUsageDescription with clear, user-facing justification
Pattern: URLSession without certificate pinning for sensitive endpoints Search:
URLSession\.shared, URLSessionConfiguration\.default in files handling auth/paymentsSecTrust, TrustKit, or custom urlSession(_:didReceive:completionHandler:)Issue: MITM vulnerability for high-value traffic Fix: Implement URLSessionDelegate with certificate or public-key pinning for auth/payment endpoints Note: Usually not a rejection risk, but expected for banking, health, enterprise.
Using the Security & Privacy Map from Phase 1 and your domain knowledge, check for what's missing — not just what's wrong.
| Question | What it detects | Why it matters |
|----------|----------------|----------------|
| Does every Required Reason API found in Phase 1 have a matching declaration in PrivacyInfo.xcprivacy with a valid reason code? | Partial manifest coverage | Apple rejects builds where one API is declared but others are used without declaration |
| Are third-party SDK privacy manifests accounted for (do bundled SDKs from Pods/SPM each ship their own PrivacyInfo.xcprivacy)? | Missing SDK manifests | Since Spring 2024, common SDKs (Firebase, Alamofire, etc.) must ship manifests — missing ones trigger rejection |
| If the app uses any CryptoKit/CommonCrypto symbols, is ITSAppUsesNonExemptEncryption declared in Info.plist? | Missing export compliance | App Store Connect blocks submission pending manual export review |
| Are all entitlements declared in .entitlements actually used in code (Keychain sharing, App Groups, iCloud, HealthKit, Camera)? | Over-broad entitlements | Unused entitlements expand attack surface and raise reviewer suspicion |
| Are all usage descriptions (NSCameraUsageDescription, NSPhotoLibraryUsageDescription, NSLocationWhenInUseUsageDescription, etc.) present for every privacy-sensitive API actually called? | Missing descriptions | Runtime crash when the permission prompt tries to present without a description |
| Do all network endpoints handling credentials, tokens, or user content use HTTPS (not just "most")? | Mixed-transport leak | One HTTP endpoint transmitting a token is sufficient for credential interception |
| Is there a Keychain migration path for tokens previously stored in UserDefaults/AppStorage? | Dangling plaintext | Upgrade users still carry plaintext tokens even after the codebase moves to Keychain |
| Does the app use @Environment(\.scenePhase) or UIApplication backgrounding to clear sensitive screens from snapshots? | Screen capture leak | Task switcher snapshot exposes account numbers, messages, credentials |
| Does the app use kSecAttrAccessibleWhenUnlockedThisDeviceOnly for tokens (not .kSecAttrAccessibleAlways or .kSecAttrAccessibleAfterFirstUnlock)? | Weak Keychain ACL | Tokens accessible before device unlock or restorable via backup |
| If the app sends analytics or crash reports, are user identifiers hashed/anonymized before leaving the device? | PII exfiltration | Third-party analytics receive raw user IDs; violates privacy nutrition label claims |
For each finding, explain what's missing and why it matters. Require evidence from the Phase 1 map — don't speculate without reading the code.
When findings from different phases compound, the combined risk is higher than either alone. Bump the severity when you find these combinations:
| Finding A | + Finding B | = Compound | Severity | |-----------|------------|-----------|----------| | Hardcoded API key | HTTP endpoint | Key transmitted in cleartext to attacker-observable network | CRITICAL | | Insecure token storage (AppStorage) | No Keychain migration path | Every upgrade user still exposed; fix is incomplete | HIGH | | Missing Privacy Manifest | Required Reason API in use | Guaranteed App Store Connect rejection | CRITICAL | | ATT API called | Missing NSUserTrackingUsageDescription | App crash + App Store rejection | CRITICAL | | Sensitive data in logs | No privacy levels on Logger | Data in sysdiagnose, crash reports, visible to support tooling | HIGH | | Crypto in use | Missing ITSAppUsesNonExemptEncryption | Submission blocked pending export review (2-3 day delay) | HIGH | | Unused entitlements | Keychain sharing claimed | Expanded attack surface + reviewer scrutiny | MEDIUM | | Missing usage description | Privacy-sensitive API called | Runtime crash when permission prompt presents | CRITICAL | | HTTPS used everywhere | But one HTTP endpoint for "non-sensitive" data | If that endpoint carries cookies/auth headers, full session hijack possible | HIGH | | Third-party SDK present | No SDK privacy manifest | Rejection cites SDK, not your code — harder to diagnose | HIGH |
Cross-auditor overlap notes:
storage-auditornetworking-auditoriap-auditor (receipt validation)axiom-build (code signing / provisioning)Calculate and present a health score:
## Security Posture
| Metric | Value |
|--------|-------|
| Hardcoded credentials | N found |
| Privacy Manifest status | COMPLETE / PARTIAL / MISSING (N required APIs declared, M undeclared) |
| Token storage | KEYCHAIN / APPSTORAGE / MIXED |
| Network transport | HTTPS_ONLY / MIXED / HTTP_PRESENT |
| Logging hygiene | REDACTED / LEAKING (N sensitive log statements) |
| ATT compliance | N/A / COMPLIANT / MISSING_DESCRIPTION |
| Export compliance | N/A / DECLARED / MISSING |
| Entitlement scope | MINIMAL / EXCESSIVE (N unused entitlements) |
| **Posture** | **HARDENED / GAPS / VULNERABLE** |
Scoring:
.whenUnlockedThisDeviceOnly, HTTPS everywhere, privacy-leveled logging, export compliance declared# Security & Privacy Audit Results
## Security & Privacy Map
[5-10 line summary from Phase 1]
## Summary
- CRITICAL: [N] issues
- HIGH: [N] issues
- MEDIUM: [N] issues
- LOW: [N] issues
- Phase 2 (pattern detection): [N] issues
- Phase 3 (completeness reasoning): [N] issues
- Phase 4 (compound findings): [N] issues
## App Store Readiness: READY / NOT READY
## Security Posture
[Phase 5 table]
## Issues by Severity
### [SEVERITY/CONFIDENCE] [Category]: [Description]
**File**: path/to/file.swift:line
**Phase**: [2: Detection | 3: Completeness | 4: Compound]
**Issue**: What's wrong or missing
**Impact**: App Store rejection / security vulnerability / privacy violation
**Fix**: Code example showing the fix
**Cross-Auditor Notes**: [if overlapping with another auditor]
## Privacy Manifest Checklist
| API Category | Found in Code | Declared in Manifest | Status |
|--------------|--------------|---------------------|--------|
| UserDefaults | Y/N | Y/N | OK / MISSING |
| FileTimestamp | Y/N | Y/N | OK / MISSING |
| SystemBootTime | Y/N | Y/N | OK / MISSING |
| DiskSpace | Y/N | Y/N | OK / MISSING |
| ActiveKeyboards | Y/N | Y/N | OK / MISSING |
## Recommendations
1. [Immediate — CRITICAL rejection and security risks]
2. [Short-term — Privacy Manifest completion, Keychain migration, HTTPS]
3. [Long-term — SSL pinning, snapshot protection, analytics anonymization]
If >50 issues in one category: Show top 10, provide total count, list top 3 files If >100 total issues: Summarize by category, show only CRITICAL/HIGH details
.gitignored config files (verify with Git log)dictionaryKey, mapKey)privacy: .private or .sensitivekSecAttrAccessibleAfterFirstUnlock for tokens that need to survive background fetch (valid trade-off)For implementation patterns: axiom-shipping skill (privacy manifest creation)
For Keychain patterns: axiom-security skill
For ATS configuration: axiom-networking skill
For entitlement issues: axiom-build skill
For IAP-adjacent receipt security: Launch iap-auditor agent
development
Use when building ANY watchOS app — app structure, independent apps, Watch Connectivity, Smart Stack widgets, complications, controls, RelevanceKit, background tasks, ClockKit migration.
development
Use when working with HealthKit, WorkoutKit, health data, workouts, or fitness features on iOS or watchOS. Covers permissions, queries, background delivery, custom workouts, multidevice coordination.
development
Use when building, fixing, or improving ANY SwiftUI UI — views, navigation, layout, animations, performance, architecture, gestures, debugging, iOS 26 features.
content-media
Use when working with camera, photos, audio, haptics, ShazamKit, or Now Playing. Covers AVCaptureSession, PHPicker, PhotosPicker, AVFoundation, Core Haptics, audio recognition, MediaPlayer, CarPlay, MusicKit.