agentleFS
bokuwalilybokuwalily/claude-code-skills/skills/ios-permission-key-security-matrix/SKILL.md

ios-permission-key-security-matrix

Skill0 starsChanged 5 months agoMITView on GitHub

iOSアプリのproject.yml / Info.plistの差分をセキュリティレビューするとき、各 NSXxx キーが「追加専用」か「フル読み書き」かを判定する。XcodeGen project.yml の変更レビュー時に発火する。

The file

Files
SKILL.md

Procedure

1. 差分の分類

project.yml / Info.plist の変更を以下の4カテゴリに分類する。

カテゴリ内容セキュリティ影響
ビルド番号CURRENT_PROJECT_VERSION, MARKETING_VERSIONなし
使用説明文字列NSXxxUsageDescription 系権限の種類に依存(下表参照)
CI/IaC変更scripts, preBuildScripts, postBuildScripts要チェック
コード変更.swift, .m ファイル参照別途コードレビュー

2. Photosライブラリ権限の区別(非自明)

NSPhotoLibraryAddUsageDescription  →  追加専用(write-only)
NSPhotoLibraryUsageDescription     →  フル読み書き(read+write)
  • Add専用は写真を保存するだけ(シェアカード保存など)で、ユーザーのアルバムを読み取れない
  • フル読み書きはユーザーの全写真にアクセスできるため影響が大きい
  • セキュリティ観点では Add専用のほうが常に狭い権限 → 必要最小権限の原則に沿っている

3. よく使う権限キー一覧

権限キーアクセス範囲リスク
NSPhotoLibraryAddUsageDescription追加専用低
NSPhotoLibraryUsageDescription全読み書き中〜高
NSCameraUsageDescriptionカメラ撮影のみ低〜中
NSMicrophoneUsageDescriptionマイク録音中
NSLocationWhenInUseUsageDescription使用中のみ位置情報低〜中
NSLocationAlwaysUsageDescription常時位置情報高
NSContactsUsageDescription連絡先読み取り高
NSFaceIDUsageDescriptionFace ID中

4. レビュー手順

1. diff を読み、「何が増えたか」を4カテゴリに分類
2. 権限キーが追加された場合:
   a. 上表でアクセス範囲を確認
   b. 使用説明文字列が静的か動的(文字列補間あり)か確認
   c. 実際に使う用途と権限の範囲が一致するか確認
3. scripts / build phases の変更があれば別途コマンド注入を確認
4. コード変更がなく権限のみなら "code paths not affected" と明示して報告

Pitfalls

  • NSPhotoLibraryAddUsageDescription と NSPhotoLibraryUsageDescription を混同しやすい。前者はApple必須(なければクラッシュ)で追加専用、後者がフルアクセス。
  • 使用説明文字列に \(variable) などの文字列補間が入っていると XSS 的ではないが内容注入リスクがある(稀)。
  • ビルド番号バンプだけの差分は "no findings" で即結論出してよい。調査深堀り不要。
  • Info.plistの ITSAppUsesNonExemptEncryption: false はApp Store向けの輸出コンプライアンス申告。セキュリティ上は問題ない(暗号化を使わないという申告)。

Verification

  • NSPhotoLibraryAddUsageDescription のみ追加 → findings なし(追加専用・狭い権限)
  • NSPhotoLibraryUsageDescription 追加 → findings あり(フルアクセス・用途の妥当性確認が必要)
  • ビルド番号のみ変更 → findings なし(即回答可能)
  • build scripts 追加 → コマンド内容を必ず確認してから判定

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.