Skip to content

feat: 适配interface协议中的加密字段 - #328

Merged
MistEO merged 2 commits into
MistEO:mainfrom
overflow65537:feat/input-password-field
Aug 27, 2026
Merged

feat: 适配interface协议中的加密字段#328
MistEO merged 2 commits into
MistEO:mainfrom
overflow65537:feat/input-password-field

Conversation

@overflow65537

@overflow65537 overflow65537 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Sourcery 摘要

新增对加密接口密码字段的端到端处理,同时防止其通过 UI、日志、遥测数据和配置导出被泄露。

新功能:

  • 支持标记为密码的接口输入,使用掩码 UI 字段并加密持久化值。
  • 在任务配置导出和导入过程中保留加密的密码值。

错误修复:

  • 防止密码值暴露在任务预览、运行时日志和遥测数据中。

增强功能:

  • 恢复密码值以供运行时使用,同时将旧版明文配置值迁移至加密存储。
  • 在任务执行期间的流水线覆盖项日志中隐藏密码值。
  • 统一密码选项的机密信息混淆处理与现有 CDK 配置加密机制。
Original summary in English

Sourcery 摘要

保护接口协议中的密码字段,使其在存储和配置交换过程中加密,并在所有用户可见输出中脱敏。

新功能:

  • 支持接口协议中的密码输入字段,并在界面中以密码框显示。
  • 支持密码值在配置持久化、任务配置导出和导入过程中的加密传递。

错误修复:

  • 防止密码值出现在任务预览、运行日志、任务执行日志和遥测摘要中。

增强功能:

  • 在运行时恢复加密密码值,并兼容迁移旧版明文配置。
  • 统一密码字段与现有 CDK 配置的机密信息处理机制。
Original summary in English

Sourcery 总结

保护接口协议中的密码字段,使其在存储、配置交换和用户可见输出中保持安全。

新功能:

  • 支持接口协议中的密码输入字段,并在界面中以密码框显示。
  • 支持密码值在配置持久化及任务配置导出、导入过程中的加密保存与传递。

错误修复:

  • 防止密码值出现在任务预览、运行日志和遥测摘要中。

改进:

  • 运行时自动恢复加密密码值,并兼容迁移旧版明文配置。
  • 统一密码字段与现有 CDK 配置的机密信息处理机制。
Original summary in English

Summary by Sourcery

保护接口协议中的密码字段,使其在存储、配置交换和用户可见输出中保持安全。

New Features:

  • 支持接口协议中的密码输入字段,并在界面中以密码框显示。
  • 支持密码值在配置持久化及任务配置导出、导入过程中的加密保存与传递。

Bug Fixes:

  • 防止密码值出现在任务预览、运行日志和遥测摘要中。

Enhancements:

  • 运行时自动恢复加密密码值,并兼容迁移旧版明文配置。
  • 统一密码字段与现有 CDK 配置的机密信息处理机制。

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

您好——我发现了 2 个问题

AI 代理提示词
请处理本次代码审查中的评论:

## 个别评论

### 评论 1
<location path="src/services/maaService.ts" line_range="20" />
<code_context>
   InstanceRuntimeInfo,
 } from '@/types/maa';
 import { loggers } from '@/utils/logger';
+import { redactSecretsInText } from '@/utils/passwordOptionValues';
+import { redactSecretsInText } from '@/utils/passwordOptionValues';
 import { isTauri } from '@/utils/paths';
</code_context>
<issue_to_address>
**issue (bug_risk):** 该模块从同一路径两次导入 `redactSecretsInText`,因此 TypeScript 会报告重复导入/声明错误,前端构建无法通过编译。

**建议修复:** 删除其中一个重复的导入。
</issue_to_address>

### 评论 2
<location path="src/utils/tabExportImport.ts" line_range="264-267" />
<code_context>
   projectName: string,
   hint?: string,
   footer?: string,
+  allOptions?: Record<string, OptionDefinition>,
 ): Promise<string> {
   const payload: TabExportPayload = {
</code_context>
<issue_to_address>
**🚨 issue (security):** 新的加密参数是可选的,而现有的 `TabBar` 导出调用点没有传入该参数。因此,这些导出会采用 `: t.optionValues` 回退值,并将运行时的明文密码值写入导出的配置中。

**触发条件:** 通过 TabBar 剪贴板或文件导出菜单导出密码选项时。

**建议修复:** 在 TabBar 的 `exportWithToast``exportFileWithToast` 调用中传入 `projectInterface?.option`,或者让导出 API 强制要求传入选项定义。
</issue_to_address>

Sourcery 对开源项目免费——如果您喜欢我们的审查结果,请考虑分享它们 ✨
帮助我变得更有用!请在每条评论上点击 👍 或 👎,我会利用反馈来改进审查结果。
Original comment in English

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/services/maaService.ts" line_range="20" />
<code_context>
   InstanceRuntimeInfo,
 } from '@/types/maa';
 import { loggers } from '@/utils/logger';
+import { redactSecretsInText } from '@/utils/passwordOptionValues';
+import { redactSecretsInText } from '@/utils/passwordOptionValues';
 import { isTauri } from '@/utils/paths';
</code_context>
<issue_to_address>
**issue (bug_risk):** The module imports `redactSecretsInText` twice from the same path, so TypeScript reports a duplicate import/declaration error and the frontend build does not compile.

**Suggested fix:** Remove one of the duplicate imports.
</issue_to_address>

### Comment 2
<location path="src/utils/tabExportImport.ts" line_range="264-267" />
<code_context>
   projectName: string,
   hint?: string,
   footer?: string,
+  allOptions?: Record<string, OptionDefinition>,
 ): Promise<string> {
   const payload: TabExportPayload = {
</code_context>
<issue_to_address>
**🚨 issue (security):** The new encryption parameter is optional, and the existing `TabBar` export call sites do not pass it. Those exports therefore take the `: t.optionValues` fallback and place the runtime plaintext password values into the exported configuration.

**Triggers:** When a password option is exported through the TabBar clipboard or file-export menu.

**Suggested fix:** Pass `projectInterface?.option` to the TabBar `exportWithToast` and `exportFileWithToast` calls, or make the export APIs require the option definitions.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/services/maaService.ts Outdated
Comment thread src/utils/tabExportImport.ts
@MistEO

MistEO commented Aug 26, 2026

Copy link
Copy Markdown
Owner

冲突了康康

@overflow65537
overflow65537 force-pushed the feat/input-password-field branch from 3e04fea to 1d47abe Compare August 26, 2026 13:31
@MistEO
MistEO merged commit d86f048 into MistEO:main Aug 27, 2026
9 checks passed
@MistEO MistEO changed the title feat:适配interface协议中的加密字段 feat: 适配interface协议中的加密字段 Aug 27, 2026
@overflow65537
overflow65537 deleted the feat/input-password-field branch August 27, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants