← ClaudeAtlas

security-reviewlisted

Performs security review for Flutter/Dart code. Use when implementing authentication, handling user input, working with API keys or secrets, managing permissions, storing sensitive data locally, or integrating third-party APIs. Provides Flutter-specific security checklists and patterns.
tarrragon/ccsession · ★ 0 · Code & Development · score 48
Install: claude install-skill tarrragon/ccsession
# Security Review(Flutter/Dart) Flutter/Dart 專案的安全審查快速指引。本 Skill 提供安全檢查清單和核心原則,詳細程式碼範例請參考 `references/flutter-security-patterns.md`。 --- ## 適用場景 - 實作認證或授權功能 - 處理使用者輸入(表單、掃描結果) - 使用 API Key 或其他機密 - 整合第三方 API(Google Books、Dio 等) - 儲存或傳輸敏感資料 - 管理裝置權限(相機、儲存) - 準備 Release 建置或上架 --- ## 1. 機密管理 **原則**:機密不可出現在原始碼或版本控制中。 ### 檢查清單 - [ ] 無硬編碼 API Key、Token、密碼 - [ ] ��密透過 `--dart-define` 或 `.env` 注入 - [ ] `.env`、`*.keystore`、`key.properties` 已加入 `.gitignore` - [ ] `google-services.json` / `GoogleService-Info.plist` 已加入 `.gitignore` - [ ] Git 歷史中無機密洩漏 ### 核心模式 ```dart // 正確:建置時注入 const apiKey = String.fromEnvironment('API_KEY', defaultValue: ''); // 錯誤:硬編碼 const apiKey = 'sk-proj-xxxxx'; // 禁止 ``` > 詳細範例:`references/flutter-security-patterns.md` 第 1 節 --- ## 2. 輸入驗證 **原則**:所有使用者輸入在處理前必須驗證和清理。 ### 檢查清單 - [ ] 所有表單欄位有 `validator` - [ ] 設定 `maxLength` 限制輸入長度 - [ ] 使用白名單驗證(非黑名單) - [ ] 掃描結果(ISBN barcode)已清理非預期字元 - [ ] 錯誤訊息不洩漏技術細節 ### 核心模式 ```dart // 表單驗證 TextFormField( validator: (value) { if (value == null || value.trim().isEmpty) return '必填'; if (value.length > maxLength) return '超過長度限制'; return null; }, inputFormatters: [ FilteringTextInputFormatter.deny(RegExp(r'[<>{}]')), ], ) ``` > 詳細範例:`references/flutter-security-patterns.md` 第 2 節 --- ## 3. 本地資料安全 **原則**:敏感資料使用加密儲存,一般偏好設定可用明文。 ### 檢查清單 - [ ] 機密資料使用 `flutter_secure_storage`(非 `SharedPreferences`) - [ ] SQLite 查詢使用參數化(`?` 佔位符) - [ ] 無 SQL 字串拼接 - [ ] `SharedPreferences` 中無 Token、密碼、個資 ###