跳转到正文
报告库
用途分类 / 其他用途

Flutter Add Integration Test Skill 安全审计

作者说它能做什么(原文)

Configures Flutter Driver for app interaction and converts MCP actions into permanent integration tests. Use when adding integration testing to a project, exploring UI components via MCP, or automating user flows with the integration_test package.

第三方安全检查结论

发现安全风险

已检查文件
1
发现的风险
2
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。未发现风险
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。未发现风险
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。未发现风险
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。发现 1 项风险
中风险

测试控制扩展可能被加入正常应用入口

原文依据:2 处
发现了什么

指令允许直接修改常用的 `lib/main.dart`,并要求在 `runApp()` 前无条件启用 Flutter Driver 扩展。它没有要求用构建模式开关隔离,也没有要求确认生产构建排除该入口。

为什么需要注意

如果团队随后用这个入口生成并分发非测试版本,应用会包含原本只为自动化测试准备的控制接口,扩大可检查和操纵界面的范围。

该指令明确允许修改常用的 `lib/main.dart`,并要求在 `runApp()` 前启用 Flutter Driver 扩展;后续清单再次要求注入该调用。虽然也提供专用 `main_test.dart` 作为选择,但没有要求仅在测试构建中启用。若代理选择正常入口,测试控制接口可能进入非测试构建,扩大应用被自动化控制或检查的范围。用户可要求作者强制使用独立测试入口,并验证发布构建不包含该扩展。

SKILL.md:27来自说明文档打开原文件
   ```2. Enable the Flutter Driver extension in your application entry point (typically `lib/main.dart` or a dedicated `lib/main_test.dart`):   - Import `package:flutter_driver/driver_extension.dart`.   - Call `enableFlutterDriverExtension();` before `runApp()`.3. Add `Key` parameters (e.g., `ValueKey('login_button')`) to critical widgets in the application code to ensure reliable targeting during tests.
查看另外 1 个位置
SKILL.md:75来自说明文档打开原文件
- [ ] **Task Progress: Setup**  - [ ] Add `integration_test` and `flutter_test` to `pubspec.yaml`.  - [ ] Inject `enableFlutterDriverExtension()` into the app entry point.  - [ ] Assign `ValueKey`s to target widgets.- [ ] **Task Progress: Exploration**
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。发现 1 项风险
中风险

自动探索和重复测试可能操作真实账户或后端数据

原文依据:3 处
发现了什么

该 Skill 要求代理通过点击和文本输入来“操纵应用状态”,并将路径固化为可重复执行的端到端测试,但没有把启动目标限定为隔离的测试环境。

为什么需要注意

如果目标应用连接生产服务,测试交互可能重复提交表单、发送消息、创建订单或执行该界面提供的其他真实操作。具体后果取决于被测试流程。

这段证据能说明什么

该 Skill 确实要求通过点击、输入和滚动改变应用状态,并重复运行端到端测试;若测试应用连接真实服务,这些动作可能产生真实业务变更。不过证据没有提到账户、后端、凭据或生产环境,而且交互式启动明确指向 `lib/main_test.dart`。因此真实账户或数据风险取决于项目自身的环境配置,现有来源不足以确认。用户可要求仅使用测试账户、沙箱后端和可重置数据。

这项判断针对展示的代码和适用条件,不表示风险已经实际发生。
SKILL.md:34来自说明文档打开原文件
Use the Dart/Flutter MCP server tools to interactively explore and manipulate the application state before writing static tests.- **Launch**: Execute `launch_app` with `target: "lib/main_test.dart"` to start the application and acquire the DTD URI.- **Inspect**: Execute `get_widget_tree` to discover available `Key`s, `Text` nodes, and widget `Type`s.- **Interact**: Execute `tap`, `enter_text`, and `scroll` to simulate user flows.- **Wait**: Always execute `waitFor` or verify state with `get_health` when navigating or triggering animations.- **Troubleshoot Unmounted Widgets**: If a widget is not found in the tree, it may be lazily loaded in a `SliverList` or `ListView`. Execute `scroll` or `scrollIntoView` to force the widget to mount before interacting with it.
查看另外 2 个位置
SKILL.md:80来自说明文档打开原文件
- [ ] **Task Progress: Exploration**  - [ ] Run `launch_app` via MCP.  - [ ] Map the widget tree using `get_widget_tree`.  - [ ] Validate interaction paths using MCP tools (`tap`, `enter_text`).- [ ] **Task Progress: Authoring**  - [ ] Create `integration_test/app_test.dart`.  - [ ] Write test cases using `WidgetTester` APIs.  - [ ] Create `test_driver/integration_test.dart` with `integrationDriver()`.- [ ] **Task Progress: Execution & Feedback Loop**  - [ ] Run `flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart`.  - [ ] **Feedback Loop**: Review test output -> If `PumpAndSettleTimedOutException` occurs, check for infinite animations -> If widget not found, add `scrollUntilVisible` -> Re-run test until passing.
SKILL.md:87来自说明文档打开原文件
  - [ ] Create `test_driver/integration_test.dart` with `integrationDriver()`.- [ ] **Task Progress: Execution & Feedback Loop**  - [ ] Run `flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart`.  - [ ] **Feedback Loop**: Review test output -> If `PumpAndSettleTimedOutException` occurs, check for infinite animations -> If widget not found, add `scrollUntilVisible` -> Re-run test until passing.

Skill 逻辑拆解

7 个说明模块

该 Skill 会修改 Flutter 项目:添加测试依赖、在应用入口启用 Flutter Driver 扩展,并为界面控件添加可定位的 Key。

查看原文
SKILL.md:22来自说明文档打开原文件
1. Add required development dependencies to `pubspec.yaml`:   ```bash   flutter pub add 'dev:integration_test:{"sdk":"flutter"}'   flutter pub add 'dev:flutter_test:{"sdk":"flutter"}'   ```2. Enable the Flutter Driver extension in your application entry point (typically `lib/main.dart` or a dedicated `lib/main_test.dart`):   - Import `package:flutter_driver/driver_extension.dart`.   - Call `enableFlutterDriverExtension();` before `runApp()`.3. Add `Key` parameters (e.g., `ValueKey('login_button')`) to critical widgets in the application code to ensure reliable targeting during tests.

该 Skill 指示代理启动应用、检查控件树并执行点击、文本输入和滚动,然后把探索出的流程写成持久化集成测试并反复执行。

查看原文
SKILL.md:34来自说明文档打开原文件
Use the Dart/Flutter MCP server tools to interactively explore and manipulate the application state before writing static tests.- **Launch**: Execute `launch_app` with `target: "lib/main_test.dart"` to start the application and acquire the DTD URI.- **Inspect**: Execute `get_widget_tree` to discover available `Key`s, `Text` nodes, and widget `Type`s.- **Interact**: Execute `tap`, `enter_text`, and `scroll` to simulate user flows.- **Wait**: Always execute `waitFor` or verify state with `get_health` when navigating or triggering animations.- **Troubleshoot Unmounted Widgets**: If a widget is not found in the tree, it may be lazily loaded in a `SliverList` or `ListView`. Execute `scroll` or `scrollIntoView` to force the widget to mount before interacting with it.
SKILL.md:83来自说明文档打开原文件
  - [ ] Validate interaction paths using MCP tools (`tap`, `enter_text`).- [ ] **Task Progress: Authoring**  - [ ] Create `integration_test/app_test.dart`.  - [ ] Write test cases using `WidgetTester` APIs.  - [ ] Create `test_driver/integration_test.dart` with `integrationDriver()`.- [ ] **Task Progress: Execution & Feedback Loop**  - [ ] Run `flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart`.  - [ ] **Feedback Loop**: Review test output -> If `PumpAndSettleTimedOutException` occurs, check for infinite animations -> If widget not found, add `scrollUntilVisible` -> Re-run test until passing.

该 Skill 还提供在本机、Chrome、无头 Web 和 Firebase Test Lab 上执行测试的命令;Firebase 流程要求构建并上传应用与测试 APK。

查看原文
SKILL.md:61来自说明文档打开原文件
**Conditional Execution Targets:**- **If testing on Chrome:** Launch `chromedriver --port=4444` in a separate terminal, then run:  `flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart -d chrome`- **If testing headless web:** Run with `-d web-server`.- **If testing on Android (Local):** Run `flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart`.- **If testing on Firebase Test Lab (Android):**   1. Build debug APK: `flutter build apk --debug`  2. Build test APK: `./gradlew app:assembleAndroidTest`  3. Upload both APKs to the Firebase Test Lab console.
从这里开始 · 工作说明SKILL.md
flutter-add-integration-test
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。
文件与检查记录1 个文件

检查范围与遗漏

逐文件查看涉及的内容

下方列出本次涉及的原文范围;纳入检查不代表已查清所有问题。

  • SKILL.md已纳入全文

这份报告只针对上方版本。我们看了拿到的代码和说明文件,没有实际运行 Skill,也没有检查它另外安装的软件包。因此,这不是“保证安全”的承诺;换了版本或使用环境,结果也可能不同。

  • SKILL.md工作说明

代码和说明中提到的操作

运行命令
SKILL.md:23来自说明文档打开原文件
1. Add required development dependencies to `pubspec.yaml`:   ```bash   flutter pub add 'dev:integration_test:{"sdk":"flutter"}'
读取了多少行
164
文件校验值(用于核对版本)
c6ba5fe9b4bf05a89f4c04d5026bb4bd021a32e1d4f1b16339d5a58c88cfa731