[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7C1HR84AC1YVPVG52G0TJRY":3,"skill-same:01M7C1HR84AC1YVPVG52G0TJRY":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7C1HR84AC1YVPVG52G0TJRY","swift-security",null,"Use when working with iOS\u002FmacOS Keychain Services (SecItem queries, kSecClass, OSStatus errors), biometric authentication (LAContext, Face ID, Touch ID), CryptoKit (AES-GCM, ChaChaPoly, ECDSA, ECDH, HPKE, ML-KEM), Secure Enclave, secure credential storage (OAuth tokens, API keys), certificate pinning (SecTrust, SPKI), keychain sharing across apps\u002Fextensions, migrating secrets from UserDefaults or plists, or OWASP MASVS\u002FMASTG mobile compliance on Apple platforms.","om-scogo\u002Fskillsh-scraper","om-scogo","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F160466840?v=4","01M79AWB6DFVCQ7RK70CS34B96","Om Achrekar","01M79AWB6ZM9SKR8KDH1WSSM22",0,"MIT","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fdpearson2699-swift-ios-skills\u002Fswift-security\u002FSkill.md",[],[],"2026-11-15 14:19:17",false,"---\nname: swift-security\ndescription: Use when working with iOS\u002FmacOS Keychain Services (SecItem queries, kSecClass, OSStatus errors), biometric authentication (LAContext, Face ID, Touch ID), CryptoKit (AES-GCM, ChaChaPoly, ECDSA, ECDH, HPKE, ML-KEM), Secure Enclave, secure credential storage (OAuth tokens, API keys), certificate pinning (SecTrust, SPKI), keychain sharing across apps\u002Fextensions, migrating secrets from UserDefaults or plists, or OWASP MASVS\u002FMASTG mobile compliance on Apple platforms.\nlicense: MIT\n---\n\n# Swift Security\n\nUse this skill for client-side Apple platform security work: Keychain Services,\naccess control, biometric-gated secrets, CryptoKit, Secure Enclave keys,\ncredential storage, certificate trust, keychain sharing, legacy secret\nmigration, security testing, and OWASP mobile compliance mapping.\n\nDefault to iOS 17+ and Swift concurrency examples when the deployment target is\nunknown. Keep iOS 13+ compatibility notes when the user asks for older targets.\nTreat iOS 26 CryptoKit post-quantum APIs as availability-gated.\n\n## Contents\n\n- [Workflow](#workflow)\n- [Reference Loading](#reference-loading)\n- [Security Invariants](#security-invariants)\n- [Sibling Boundaries](#sibling-boundaries)\n- [Review Checklist](#review-checklist)\n- [Common Mistakes](#common-mistakes)\n- [Output Rules](#output-rules)\n- [References](#references)\n\n## Workflow\n\nClassify the request before loading references.\n\n1. Review existing code: run the [Review Checklist](#review-checklist), then\n   load [common-anti-patterns.md](references\u002Fcommon-anti-patterns.md) plus the\n   domain reference for each failing area. Report severity, evidence, and the\n   corrected pattern.\n2. Improve or migrate code: identify the migration type, load the migration\n   and target-domain references, preserve existing data, verify the new item,\n   then remove legacy storage only after success.\n3. Implement new security code: load the minimum domain references, use the\n   provided correct patterns, include OSStatus handling and tests, then run the\n   relevant checklist.\n\nDo not load every reference file by default. This skill is intentionally split\nfor progressive disclosure; load only the files needed by the user's task.\n\n### Minimum Safe Keychain Write\n\nUse separate add, identity, and update dictionaries; handle every `OSStatus`:\n\n```swift\nfunc saveSecret(_ data: Data, account: String) throws {\n    let identity: [CFString: Any] = [\n        kSecClass: kSecClassGenericPassword,\n        kSecAttrService: \"com.example.app\",\n        kSecAttrAccount: account,\n    ]\n    var add = identity\n    add[kSecValueData] = data\n    add[kSecAttrAccessible] = kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly\n\n    switch SecItemAdd(add as CFDictionary, nil) {\n    case errSecSuccess:\n        return\n    case errSecDuplicateItem:\n        let status = SecItemUpdate(\n            identity as CFDictionary,\n            [kSecValueData: data] as CFDictionary\n        )\n        guard status == errSecSuccess else { throw KeychainError(status: status) }\n    case let status:\n        throw KeychainError(status: status)\n    }\n}\n```\n\nLoad [keychain-fundamentals.md](references\u002Fkeychain-fundamentals.md) for read,\ndelete, access-control, locked-device, and test patterns.\n\n## Reference Loading\n\n| If the task involves | Load |\n| --- | --- |\n| General keychain CRUD or OSStatus handling | [keychain-fundamentals.md](references\u002Fkeychain-fundamentals.md) |\n| Choosing `kSecClass` or item identity | [keychain-item-classes.md](references\u002Fkeychain-item-classes.md) |\n| Accessibility classes or `SecAccessControl` | [keychain-access-control.md](references\u002Fkeychain-access-control.md) |\n| Face ID, Touch ID, or biometric-gated secrets | [biometric-authentication.md](references\u002Fbiometric-authentication.md) |\n| Secure Enclave keys | [secure-enclave.md](references\u002Fsecure-enclave.md) |\n| Hashing, HMAC, AES-GCM, ChaChaPoly, HKDF, PBKDF2 | [cryptokit-symmetric.md](references\u002Fcryptokit-symmetric.md) |\n| Signing, ECDH, HPKE, ML-KEM, ML-DSA | [cryptokit-public-key.md](references\u002Fcryptokit-public-key.md) |\n| OAuth tokens, API keys, logout, refresh rotation | [credential-storage-patterns.md](references\u002Fcredential-storage-patterns.md) |\n| App\u002Fextension keychain sharing | [keychain-sharing.md](references\u002Fkeychain-sharing.md) |\n| Certificate trust, SPKI pinning, mTLS | [certificate-trust.md](references\u002Fcertificate-trust.md) |\n| UserDefaults\u002Fplist\u002FNSCoding migration | [migration-legacy-stores.md](references\u002Fmigration-legacy-stores.md) |\n| Unit, integration, simulator, device, or CI tests | [testing-security-code.md](references\u002Ftesting-security-code.md) |\n| OWASP MASVS\u002FMASTG or enterprise audit mapping | [compliance-owasp-mapping.md](references\u002Fcompliance-owasp-mapping.md) |\n| Full security review | [common-anti-patterns.md](references\u002Fcommon-anti-patterns.md), then each touched domain reference |\n\n## Security Invariants\n\nUse directive language only for these security invariants and the matching\nanti-patterns in [common-anti-patterns.md](references\u002Fcommon-anti-patterns.md).\nFor architecture choices outside this list, use advisory language.\n\n- Never store tokens, passwords, API keys, signing keys, or refresh tokens in\n  `UserDefaults`, `Info.plist`, `.xcconfig`, source code, logs, files, or\n  `NSCoding` archives. Use Keychain or fetch secrets at runtime.\n- Never ignore `OSStatus`. Every `SecItemAdd`, `SecItemCopyMatching`,\n  `SecItemUpdate`, and `SecItemDelete` path must handle success and expected\n  failures such as `errSecDuplicateItem`, `errSecItemNotFound`, and\n  `errSecInteractionNotAllowed`.\n- Never use `LAContext.evaluatePolicy()` as the only gate for a secret. Bind\n  protected secrets to keychain items with `SecAccessControl`, then let\n  keychain access trigger LocalAuthentication.\n- Always set `kSecAttrAccessible` or `kSecAttrAccessControl` explicitly when\n  adding keychain items.\n- Always use add-or-update for persistent keychain writes. Do not delete-then-add\n  as a normal update path.\n- Keep `SecItem*` work off the main actor. Use an actor or serial queue for\n  keychain access.\n- On macOS AppKit targets, target the data protection keychain with\n  `kSecUseDataProtectionKeychain: true` unless deliberately working with\n  legacy file-based keychain items.\n- Never reuse an AES-GCM nonce with the same key.\n- Never use raw ECDH `SharedSecret` bytes as a symmetric key. Derive with HKDF\n  or X9.63 derivation.\n- Never use `Insecure.MD5` or `Insecure.SHA1` for security purposes.\n\n## Sibling Boundaries\n\nThis skill owns client-side storage, cryptographic primitives, hardware-backed\nkeys, and trust evaluation. Route adjacent work deliberately:\n\n- Use `authentication` for Sign in with Apple, passkeys, OAuth UI flows,\n  `ASAuthorizationController`, credential state, and account sign-in UX.\n- Use `cryptokit` for primitive CryptoKit API syntax and examples when storage,\n  key lifecycle, protocol\u002Ftrust design, Secure Enclave policy, certificate\n  trust, misuse review, or compliance is not part of the task.\n- Keep application-level E2E encryption security reviews here when the work\n  involves key ownership, derivation, storage, rotation\u002Frecovery, Secure Enclave,\n  HPKE\u002FPQC migration, protocol trust boundaries, or misuse analysis.\n- Use `device-integrity` for DeviceCheck and App Attest attestation\u002Fassertion\n  flows.\n- Use `ios-networking` for URLSession, request pipelines, ATS configuration,\n  retries, caching, reachability, and transport architecture.\n- Use `app-store-review` for privacy manifests, ATT, App Review guideline\n  compliance, and submission readiness.\n\nThis skill may mention those areas only to identify a security handoff.\n\n## Review Checklist\n\nUse this checklist for code reviews and migration plans. Mark each item pass,\nfail, or not applicable; for each failure, cite the reference file and severity.\n\n- Secrets are not stored in `UserDefaults`, plists, source, logs, files, or\n  archives.\n- Every `SecItem*` call checks `OSStatus` and handles common recoverable errors.\n- Biometric access to secrets is keychain-bound with `SecAccessControl`, not a\n  standalone `Bool` from `LAContext.evaluatePolicy()`.\n- Keychain add dictionaries set an explicit accessibility policy.\n- Keychain writes use add-or-update rather than delete-then-add.\n- Keychain work is isolated from UI\u002Fmain-actor code.\n- The selected `kSecClass` matches the item type and primary-key attributes.\n- CryptoKit code avoids nonce reuse, raw shared-secret use, weak hashes, and\n  hardcoded keys.\n- Custom encryption designs identify key ownership, derivation, storage,\n  rotation\u002Frecovery, availability gates, and protocol\u002Ftrust boundaries.\n- Secure Enclave code checks availability, handles simulator\u002Fdevice differences,\n  persists only `dataRepresentation`, and designs for device-bound keys.\n- App\u002Fextension sharing uses full Team ID access groups and matching\n  entitlements on every target.\n- Certificate trust uses current `SecTrust` APIs, validates hostname\u002Fpolicy, and\n  uses SPKI or CA pinning when pinning is required.\n- macOS keychain code intentionally chooses data protection or file-based\n  keychain behavior.\n- Tests cover success, duplicate, missing item, locked-device, simulator\u002Fdevice,\n  and migration paths where applicable.\n- OWASP MASVS\u002FMASTG mappings are included when compliance is requested.\n\n## Common Mistakes\n\n- Generating partial keychain examples without duplicate handling or\n  `errSecItemNotFound` handling.\n- Adding biometric UI but leaving the secret readable without keychain access\n  control.\n- Choosing `kSecAttrAccessibleWhenUnlocked` implicitly by omitting the attribute.\n- Using `kSecAttrAccessibleAlways` or\n  `kSecAttrAccessibleAlwaysThisDeviceOnly`, both deprecated.\n- Mixing `kSecAttrAccessible` and `kSecAttrAccessControl` on the same add query.\n- Treating Secure Enclave keys as importable, exportable, syncable, or suitable\n  for symmetric encryption.\n- Claiming SHA-3, ML-KEM, ML-DSA, or X-Wing CryptoKit APIs are available before\n  iOS 26.\n- Treating HPKE as available before iOS 17.\n- Implementing certificate pinning by hashing only raw key bytes instead of the\n  correct SPKI representation.\n- Expanding this skill into account-login, networking, App Attest, or App Store\n  review guidance instead of handing off to sibling skills.\n\n## Output Rules\n\n- For security findings, state severity: CRITICAL for exploitable secret or\n  cryptography failures, HIGH for silent security boundary\u002Fdata-loss issues, and\n  MEDIUM for brittle or incomplete hardening.\n- Include wrong and corrected code examples for implementation reviews when a\n  concrete anti-pattern is present.\n- Include minimum iOS\u002FmacOS availability when recommending versioned APIs.\n- Cite the reference file that supports each substantive security pattern.\n- For keychain code, include `OSStatus` handling and explicit accessibility in\n  examples.\n- For implementation or migration answers, end with `## Reference Files` and\n  list the loaded references with a one-line purpose.\n- Do not invent WWDC session numbers or source citations. If a claim is not\n  present in the loaded references or official Apple documentation, say it needs\n  verification.\n\n## References\n\n- [keychain-fundamentals.md](references\u002Fkeychain-fundamentals.md) - SecItem CRUD, OSStatus handling, add-or-update, macOS data protection keychain.\n- [keychain-item-classes.md](references\u002Fkeychain-item-classes.md) - `kSecClass` selection, primary keys, certificates, identities.\n- [keychain-access-control.md](references\u002Fkeychain-access-control.md) - Accessibility constants, `SecAccessControl`, background access, data protection.\n- [biometric-authentication.md](references\u002Fbiometric-authentication.md) - Keychain-bound biometrics, `LAContext`, enrollment-change handling.\n- [secure-enclave.md](references\u002Fsecure-enclave.md) - Secure Enclave constraints, persistence, biometric keys, iOS 26 PQ APIs.\n- [cryptokit-symmetric.md](references\u002Fcryptokit-symmetric.md) - SHA, HMAC, AES-GCM, ChaChaPoly, HKDF, PBKDF2.\n- [cryptokit-public-key.md](references\u002Fcryptokit-public-key.md) - Signing, key agreement, HPKE, ML-KEM, ML-DSA, key formats.\n- [credential-storage-patterns.md](references\u002Fcredential-storage-patterns.md) - OAuth tokens, API keys, rotation, logout cleanup.\n- [keychain-sharing.md](references\u002Fkeychain-sharing.md) - Access groups, extensions, iCloud sync, macOS access groups.\n- [certificate-trust.md](references\u002Fcertificate-trust.md) - SecTrust, SPKI\u002FCA pinning, `NSPinnedDomains`, client certificates.\n- [migration-legacy-stores.md](references\u002Fmigration-legacy-stores.md) - UserDefaults\u002Fplist\u002FNSCoding migration and cleanup.\n- [common-anti-patterns.md](references\u002Fcommon-anti-patterns.md) - Review backbone for insecure generated code.\n- [testing-security-code.md](references\u002Ftesting-security-code.md) - Protocol mocks, real keychain tests, CI\u002Fdevice split.\n- [compliance-owasp-mapping.md](references\u002Fcompliance-owasp-mapping.md) - OWASP Mobile Top 10, MASVS, MASTG evidence mapping.\n","# Swift Security\n\nUse this skill for client-side Apple platform security work: Keychain Services,\naccess control, biometric-gated secrets, CryptoKit, Secure Enclave keys,\ncredential storage, certificate trust, keychain sharing, legacy secret\nmigration, security testing, and OWASP mobile compliance mapping.\n\nDefault to iOS 17+ and Swift concurrency examples when the deployment target is\nunknown. Keep iOS 13+ compatibility notes when the user asks for older targets.\nTreat iOS 26 CryptoKit post-quantum APIs as availability-gated.\n\n## Contents\n\n- [Workflow](#workflow)\n- [Reference Loading](#reference-loading)\n- [Security Invariants](#security-invariants)\n- [Sibling Boundaries](#sibling-boundaries)\n- [Review Checklist](#review-checklist)\n- [Common Mistakes](#common-mistakes)\n- [Output Rules](#output-rules)\n- [References](#references)\n\n## Workflow\n\nClassify the request before loading references.\n\n1. Review existing code: run the [Review Checklist](#review-checklist), then\n   load [common-anti-patterns.md](references\u002Fcommon-anti-patterns.md) plus the\n   domain reference for each failing area. Report severity, evidence, and the\n   corrected pattern.\n2. Improve or migrate code: identify the migration type, load the migration\n   and target-domain references, preserve existing data, verify the new item,\n   then remove legacy storage only after success.\n3. Implement new security code: load the minimum domain references, use the\n   provided correct patterns, include OSStatus handling and tests, then run the\n   relevant checklist.\n\nDo not load every reference file by default. This skill is intentionally split\nfor progressive disclosure; load only the files needed by the user's task.\n\n### Minimum Safe Keychain Write\n\nUse separate add, identity, and update dictionaries; handle every `OSStatus`:\n\n```swift\nfunc saveSecret(_ data: Data, account: String) throws {\n    let identity: [CFString: Any] = [\n        kSecClass: kSecClassGenericPassword,\n        kSecAttrService: \"com.example.app\",\n        kSecAttrAccount: account,\n    ]\n    var add = identity\n    add[kSecValueData] = data\n    add[kSecAttrAccessible] = kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly\n\n    switch SecItemAdd(add as CFDictionary, nil) {\n    case errSecSuccess:\n        return\n    case errSecDuplicateItem:\n        let status = SecItemUpdate(\n            identity as CFDictionary,\n            [kSecValueData: data] as CFDictionary\n        )\n        guard status == errSecSuccess else { throw KeychainError(status: status) }\n    case let status:\n        throw KeychainError(status: status)\n    }\n}\n```\n\nLoad [keychain-fundamentals.md](references\u002Fkeychain-fundamentals.md) for read,\ndelete, access-control, locked-device, and test patterns.\n\n## Reference Loading\n\n| If the task involves | Load |\n| --- | --- |\n| General keychain CRUD or OSStatus handling | [keychain-fundamentals.md](references\u002Fkeychain-fundamentals.md) |\n| Choosing `kSecClass` or item identity | [keychain-item-classes.md](references\u002Fkeychain-item-classes.md) |\n| Accessibility classes or `SecAccessControl` | [keychain-access-control.md](references\u002Fkeychain-access-control.md) |\n| Face ID, Touch ID, or biometric-gated secrets | [biometric-authentication.md](references\u002Fbiometric-authentication.md) |\n| Secure Enclave keys | [secure-enclave.md](references\u002Fsecure-enclave.md) |\n| Hashing, HMAC, AES-GCM, ChaChaPoly, HKDF, PBKDF2 | [cryptokit-symmetric.md](references\u002Fcryptokit-symmetric.md) |\n| Signing, ECDH, HPKE, ML-KEM, ML-DSA | [cryptokit-public-key.md](references\u002Fcryptokit-public-key.md) |\n| OAuth tokens, API keys, logout, refresh rotation | [credential-storage-patterns.md](references\u002Fcredential-storage-patterns.md) |\n| App\u002Fextension keychain sharing | [keychain-sharing.md](references\u002Fkeychain-sharing.md) |\n| Certificate trust, SPKI pinning, mTLS | [certificate-trust.md](references\u002Fcertificate-trust.md) |\n| UserDefaults\u002Fplist\u002FNSCoding migration | [migration-legacy-stores.md](references\u002Fmigration-legacy-stores.md) |\n| Unit, integration, simulator, device, or CI tests | [testing-security-code.md](references\u002Ftesting-security-code.md) |\n| OWASP MASVS\u002FMASTG or enterprise audit mapping | [compliance-owasp-mapping.md](references\u002Fcompliance-owasp-mapping.md) |\n| Full security review | [common-anti-patterns.md](references\u002Fcommon-anti-patterns.md), then each touched domain reference |\n\n## Security Invariants\n\nUse directive language only for these security invariants and the matching\nanti-patterns in [common-anti-patterns.md](references\u002Fcommon-anti-patterns.md).\nFor architecture choices outside this list, use advisory language.\n\n- Never store tokens, passwords, API keys, signing keys, or refresh tokens in\n  `UserDefaults`, `Info.plist`, `.xcconfig`, source code, logs, files, or\n  `NSCoding` archives. Use Keychain or fetch secrets at runtime.\n- Never ignore `OSStatus`. Every `SecItemAdd`, `SecItemCopyMatching`,\n  `SecItemUpdate`, and `SecItemDelete` path must handle success and expected\n  failures such as `errSecDuplicateItem`, `errSecItemNotFound`, and\n  `errSecInteractionNotAllowed`.\n- Never use `LAContext.evaluatePolicy()` as the only gate for a secret. Bind\n  protected secrets to keychain items with `SecAccessControl`, then let\n  keychain access trigger LocalAuthentication.\n- Always set `kSecAttrAccessible` or `kSecAttrAccessControl` explicitly when\n  adding keychain items.\n- Always use add-or-update for persistent keychain writes. Do not delete-then-add\n  as a normal update path.\n- Keep `SecItem*` work off the main actor. Use an actor or serial queue for\n  keychain access.\n- On macOS AppKit targets, target the data protection keychain with\n  `kSecUseDataProtectionKeychain: true` unless deliberately working with\n  legacy file-based keychain items.\n- Never reuse an AES-GCM nonce with the same key.\n- Never use raw ECDH `SharedSecret` bytes as a symmetric key. Derive with HKDF\n  or X9.63 derivation.\n- Never use `Insecure.MD5` or `Insecure.SHA1` for security purposes.\n\n## Sibling Boundaries\n\nThis skill owns client-side storage, cryptographic primitives, hardware-backed\nkeys, and trust evaluation. Route adjacent work deliberately:\n\n- Use `authentication` for Sign in with Apple, passkeys, OAuth UI flows,\n  `ASAuthorizationController`, credential state, and account sign-in UX.\n- Use `cryptokit` for primitive CryptoKit API syntax and examples when storage,\n  key lifecycle, protocol\u002Ftrust design, Secure Enclave policy, certificate\n  trust, misuse review, or compliance is not part of the task.\n- Keep application-level E2E encryption security reviews here when the work\n  involves key ownership, derivation, storage, rotation\u002Frecovery, Secure Enclave,\n  HPKE\u002FPQC migration, protocol trust boundaries, or misuse analysis.\n- Use `device-integrity` for DeviceCheck and App Attest attestation\u002Fassertion\n  flows.\n- Use `ios-networking` for URLSession, request pipelines, ATS configuration,\n  retries, caching, reachability, and transport architecture.\n- Use `app-store-review` for privacy manifests, ATT, App Review guideline\n  compliance, and submission readiness.\n\nThis skill may mention those areas only to identify a security handoff.\n\n## Review Checklist\n\nUse this checklist for code reviews and migration plans. Mark each item pass,\nfail, or not applicable; for each failure, cite the reference file and severity.\n\n- Secrets are not stored in `UserDefaults`, plists, source, logs, files, or\n  archives.\n- Every `SecItem*` call checks `OSStatus` and handles common recoverable errors.\n- Biometric access to secrets is keychain-bound with `SecAccessControl`, not a\n  standalone `Bool` from `LAContext.evaluatePolicy()`.\n- Keychain add dictionaries set an explicit accessibility policy.\n- Keychain writes use add-or-update rather than delete-then-add.\n- Keychain work is isolated from UI\u002Fmain-actor code.\n- The selected `kSecClass` matches the item type and primary-key attributes.\n- CryptoKit code avoids nonce reuse, raw shared-secret use, weak hashes, and\n  hardcoded keys.\n- Custom encryption designs identify key ownership, derivation, storage,\n  rotation\u002Frecovery, availability gates, and protocol\u002Ftrust boundaries.\n- Secure Enclave code checks availability, handles simulator\u002Fdevice differences,\n  persists only `dataRepresentation`, and designs for device-bound keys.\n- App\u002Fextension sharing uses full Team ID access groups and matching\n  entitlements on every target.\n- Certificate trust uses current `SecTrust` APIs, validates hostname\u002Fpolicy, and\n  uses SPKI or CA pinning when pinning is required.\n- macOS keychain code intentionally chooses data protection or file-based\n  keychain behavior.\n- Tests cover success, duplicate, missing item, locked-device, simulator\u002Fdevice,\n  and migration paths where applicable.\n- OWASP MASVS\u002FMASTG mappings are included when compliance is requested.\n\n## Common Mistakes\n\n- Generating partial keychain examples without duplicate handling or\n  `errSecItemNotFound` handling.\n- Adding biometric UI but leaving the secret readable without keychain access\n  control.\n- Choosing `kSecAttrAccessibleWhenUnlocked` implicitly by omitting the attribute.\n- Using `kSecAttrAccessibleAlways` or\n  `kSecAttrAccessibleAlwaysThisDeviceOnly`, both deprecated.\n- Mixing `kSecAttrAccessible` and `kSecAttrAccessControl` on the same add query.\n- Treating Secure Enclave keys as importable, exportable, syncable, or suitable\n  for symmetric encryption.\n- Claiming SHA-3, ML-KEM, ML-DSA, or X-Wing CryptoKit APIs are available before\n  iOS 26.\n- Treating HPKE as available before iOS 17.\n- Implementing certificate pinning by hashing only raw key bytes instead of the\n  correct SPKI representation.\n- Expanding this skill into account-login, networking, App Attest, or App Store\n  review guidance instead of handing off to sibling skills.\n\n## Output Rules\n\n- For security findings, state severity: CRITICAL for exploitable secret or\n  cryptography failures, HIGH for silent security boundary\u002Fdata-loss issues, and\n  MEDIUM for brittle or incomplete hardening.\n- Include wrong and corrected code examples for implementation reviews when a\n  concrete anti-pattern is present.\n- Include minimum iOS\u002FmacOS availability when recommending versioned APIs.\n- Cite the reference file that supports each substantive security pattern.\n- For keychain code, include `OSStatus` handling and explicit accessibility in\n  examples.\n- For implementation or migration answers, end with `## Reference Files` and\n  list the loaded references with a one-line purpose.\n- Do not invent WWDC session numbers or source citations. If a claim is not\n  present in the loaded references or official Apple documentation, say it needs\n  verification.\n\n## References\n\n- [keychain-fundamentals.md](references\u002Fkeychain-fundamentals.md) - SecItem CRUD, OSStatus handling, add-or-update, macOS data protection keychain.\n- [keychain-item-classes.md](references\u002Fkeychain-item-classes.md) - `kSecClass` selection, primary keys, certificates, identities.\n- [keychain-access-control.md](references\u002Fkeychain-access-control.md) - Accessibility constants, `SecAccessControl`, background access, data protection.\n- [biometric-authentication.md](references\u002Fbiometric-authentication.md) - Keychain-bound biometrics, `LAContext`, enrollment-change handling.\n- [secure-enclave.md](references\u002Fsecure-enclave.md) - Secure Enclave constraints, persistence, biometric keys, iOS 26 PQ APIs.\n- [cryptokit-symmetric.md](references\u002Fcryptokit-symmetric.md) - SHA, HMAC, AES-GCM, ChaChaPoly, HKDF, PBKDF2.\n- [cryptokit-public-key.md](references\u002Fcryptokit-public-key.md) - Signing, key agreement, HPKE, ML-KEM, ML-DSA, key formats.\n- [credential-storage-patterns.md](references\u002Fcredential-storage-patterns.md) - OAuth tokens, API keys, rotation, logout cleanup.\n- [keychain-sharing.md](references\u002Fkeychain-sharing.md) - Access groups, extensions, iCloud sync, macOS access groups.\n- [certificate-trust.md](references\u002Fcertificate-trust.md) - SecTrust, SPKI\u002FCA pinning, `NSPinnedDomains`, client certificates.\n- [migration-legacy-stores.md](references\u002Fmigration-legacy-stores.md) - UserDefaults\u002Fplist\u002FNSCoding migration and cleanup.\n- [common-anti-patterns.md](references\u002Fcommon-anti-patterns.md) - Review backbone for insecure generated code.\n- [testing-security-code.md](references\u002Ftesting-security-code.md) - Protocol mocks, real keychain tests, CI\u002Fdevice split.\n- [compliance-owasp-mapping.md](references\u002Fcompliance-owasp-mapping.md) - OWASP Mobile Top 10, MASVS, MASTG evidence mapping.\n",{"name":5,"license":15,"description":7},"main","8859218955d9504cd18b59e7892100718039d3b4","data\u002Fskills\u002Fdpearson2699-swift-ios-skills\u002Fswift-security",1,"https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper","https:\u002F\u002Fgithub.com\u002Fom-scogo","SDE-1 @ Scogo ","2026-07-18 12:22:46",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add om-scogo\u002Fskillsh-scraper --skill swift-security",{"tool":38,"command":39},"bunx","bunx skills add om-scogo\u002Fskillsh-scraper --skill swift-security",{"tool":41,"command":42},"pnpm","pnpm dlx skills add om-scogo\u002Fskillsh-scraper --skill swift-security","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fdpearson2699-swift-ios-skills\u002Fswift-security\u002FSkill.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"metadata.json","REFERENCE","参考文档",486,"https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fdpearson2699-swift-ios-skills\u002Fswift-security\u002Fmetadata.json",[53,60,65,72,77,84],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7D6MC9FAAEV4CMNYX8W7JTG","arxiv-search","Search arXiv physics, math, and computer science preprints using natural language queries. Powered by Valyu semantic search.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fyorkeccak-scientific-skills\u002Farxiv-search\u002Fskills\u002Farxiv-search\u002FSKILL.md",[],[],{"skillNo":61,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M7D6M85CKKN87TA98VCQV4H7","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fyorkeccak-scientific-skills\u002Farxiv-search\u002FSkill.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7D4ZTCS4DR3CE4JY06X84T2","working-with-legacy-code","Safely change and test untested codebases using Feathers' \"Working Effectively with Legacy Code\". Use when the user mentions \"legacy code\", \"no tests\", \"untested codebase\", \"how do I test this\", \"seams\", \"characterization tests\", \"golden master\", \"sprout method\", \"afraid to change this code\", \"monster method\", \"dependency breaking\", or \"inherited a messy codebase\". Also trigger when changing code without tests safely, getting a class under test when constructors, statics, or singletons block it, adding features to tangled modules, or planning incremental test coverage for an old codebase. Covers the legacy-code change algorithm, seams, characterization tests, sprout\u002Fwrap, and dependency-breaking techniques. For refactoring code that already has tests, see refactoring-patterns. For day-to-day code quality, see clean-code.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fworking-with-legacy-code\u002Fworking-with-legacy-code\u002FSKILL.md",[],[],{"skillNo":73,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7D4ZHZKJD2RSNGAF63V14P4","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fworking-with-legacy-code\u002FSkill.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7D4ZB4CJBFW5JE67CPH2QRV","web-typography","Select, pair, and implement typefaces for web projects. Use when the user mentions \"font pairing\", \"which typeface\", \"line height\", \"responsive typography\", \"web font loading\", \"type hierarchy\", \"variable fonts\", \"FOUT\u002FFOIT\", \"typographic scale\", or \"the text is hard to read\". Also trigger when choosing between system fonts and web fonts, optimizing font-loading performance, or designing readable long-form content. Covers readability evaluation, CSS implementation, and performance optimization. For overall UI design systems, see refactoring-ui. For dramatic typographic experiences, see top-design.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fweb-typography\u002Fweb-typography\u002FSKILL.md",[],[],{"skillNo":85,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M7D4Z4MVYVY3NMJ18BNV6WNA","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fweb-typography\u002FSkill.md",[],[]]