skills/security-review/SKILL.md
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.
npx skillsauth add tarrragon/claude security-reviewInstall 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.
Flutter/Dart 專案的安全審查快速指引。本 Skill 提供安全檢查清單和核心原則,詳細程式碼範例請參考 references/flutter-security-patterns.md。
原則:機密不可出現在原始碼或版本控制中。
--dart-define 或 .env 注入.env、*.keystore、key.properties 已加入 .gitignoregoogle-services.json / GoogleService-Info.plist 已加入 .gitignore// 正確:建置時注入
const apiKey = String.fromEnvironment('API_KEY', defaultValue: '');
// 錯誤:硬編碼
const apiKey = 'sk-proj-xxxxx'; // 禁止
詳細範例:
references/flutter-security-patterns.md第 1 節
原則:所有使用者輸入在處理前必須驗證和清理。
validatormaxLength 限制輸入長度// 表單驗證
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 節
原則:敏感資料使用加密儲存,一般偏好設定可用明文。
flutter_secure_storage(非 SharedPreferences)? 佔位符)SharedPreferences 中無 Token、密碼、個資// 正確:參數化查詢
await db.rawQuery('SELECT * FROM books WHERE title LIKE ?', ['%$query%']);
// 錯誤:字串拼接(SQL 注入)
await db.rawQuery("SELECT * FROM books WHERE title LIKE '%$query%'");
| 資料類型 | 儲存方式 |
|---------|---------|
| Token、密碼、API Key | flutter_secure_storage |
| 使用者偏好(主題、語言) | SharedPreferences |
| 結構化業務資料 | sqflite(參數化查詢) |
| 暫存檔案 | path_provider 暫存目錄 |
詳細範例:
references/flutter-security-patterns.md第 3 節
原則:所有網路通訊使用 HTTPS,驗證回應結構。
connectTimeout、receiveTimeout)// Dio 安全配置
final dio = Dio(BaseOptions(
baseUrl: 'https://api.example.com', // HTTPS only
connectTimeout: const Duration(seconds: 10),
receiveTimeout: const Duration(seconds: 15),
));
// 攔截器注入 Token
dio.interceptors.add(InterceptorsWrapper(
onRequest: (options, handler) async {
final token = await storage.readToken();
if (token != null) {
options.headers['Authorization'] = 'Bearer $token';
}
handler.next(options);
},
));
詳細範例:
references/flutter-security-patterns.md第 4 節
原則:僅請求必要權限,在需要時才請求,並說明用途。
Info.plist 每個權限有用途說明字串// 按需請求,處理各種狀態
Future<bool> requestCameraPermission() async {
final status = await Permission.camera.status;
if (status.isGranted) return true;
if (status.isDenied) {
final result = await Permission.camera.request();
return result.isGranted;
}
if (status.isPermanentlyDenied) {
await openAppSettings();
return false;
}
return false;
}
詳細範例:
references/flutter-security-patterns.md第 5 節
原則:Token 安全儲存,過期自動處理,敏感操作前驗證狀態。
flutter_secure_storage 儲存詳細範例:
references/flutter-security-patterns.md第 6 節
原則:定期檢查依賴漏洞,鎖定版本確保可重現建置。
flutter pub audit 無已知漏洞flutter pub outdated 定期執行pubspec.lock 已提交到版本控制^ 語法)--enforce-lockfile 確保一致性flutter pub audit # 檢查已知漏洞
flutter pub outdated # 檢查過時套件
flutter pub upgrade # 更新依賴
詳細範例:
references/flutter-security-patterns.md第 7 節
原則:日誌不含敏感資料,錯誤訊息不洩漏技術細節。
kDebugMode 判斷)// 正確:Release 模式下不輸出日誌
if (kDebugMode) {
debugPrint('API Error: ${error.runtimeType}');
}
// 正確:使用 ErrorHandler 轉換錯誤訊息
final userMessage = ErrorHandler.getUserMessage(exception);
// 錯誤:直接暴露技術細節
// showError('Database error: $sqlException at line 42');
詳細範例:
references/flutter-security-patterns.md第 8 節
Release 建置或上架前,逐項確認:
flutter pub audit 無漏洞references/flutter-security-patterns.mdLast Updated: 2026-03-02 Version: 1.0.0
development
Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
development
Claude Code release notes 框架影響評估工具。比對 last-reviewed 版本篩出新版本,逐項分類(對框架有幫助 / 需評估 / 無影響 / 不適用),對採用項引導建 ANA + WRAP + spawn 落地。Use when: 執行 /release-notes 看到新版本、定期檢查 CC 更新、評估新功能對專案框架的影響時。Triggers: release notes, release-notes, CC 更新, claude code 更新, 版本更新評估, 新功能評估, 框架影響評估。
development
Assertion design judgment framework for flaky and design-quality issues. Use when writing tests, reviewing assertions, diagnosing flaky tests, or deciding if a timing/float/cache assertion is appropriate. Do NOT use for API syntax or refactoring.
tools
Chrome Extension 實機測試與 debug 工作流,以 chrome-devtools-mcp 為核心工具。Use when: (1) 完成功能後實機驗證 / manual test / 試看看 / 跑看看 / verify feature, (2) extension debug / popup 不作動 / content script 不注入 / service worker 報錯 / background 出問題, (3) 安裝 unpacked extension / load unpacked / 載入未封裝, (4) 看 console / 看 network / 看 log / view console / inspect requests, (5) 功能更新後重新載入 extension / rebuild reload / reload extension。涵蓋 Manifest V3 service worker / content script / popup / options page 的 chrome-devtools-mcp 工具呼叫流程。不取代 Puppeteer / Playwright 自動化 E2E(CI 用),定位為開發期手動驗證與 LLM-assisted debug。