Skip to content

Fix model connection credential reveal and save flow - #1421

Closed
javaht wants to merge 2 commits into
apache:mainfrom
javaht:main
Closed

Fix model connection credential reveal and save flow#1421
javaht wants to merge 2 commits into
apache:mainfrom
javaht:main

Conversation

@javaht

@javaht javaht commented Jul 23, 2026

Copy link
Copy Markdown

修改内容

  • 修复已保存模型密钥无法通过眼睛按钮查看的问题

    • 默认仍保持隐藏
    • 仅在用户主动点击显示按钮时读取当前 API key
    • OAuth token 不开放读取,仍保留在主进程
  • 调整模型连接高级设置的保存逻辑

    • 模型勾选不再立即自动保存
    • 将“保存服务地址”改为“保存”
    • 点击保存时一次提交启用模型列表和服务地址
  • 改进保存后的交互反馈

    • 保存成功后自动关闭连接详情页
    • 右下角显示“连接名称 已保存”提示
    • 保存或刷新失败时保留页面和未提交内容,方便继续修改
  • 补充配套改动

    • 更新中英文文案和安全边界说明
    • 更新 Storybook mock
    • 增加 API key 读取边界、统一保存及成功反馈的回归测试
9c1718dea37164bbd601321fcd083b90 b470a146bf01b7b2c96199b81fc7c8be 图一图二是前后对比 9ed07669457cf26c6a4684d799ec4ce0

@Astro-Han Astro-Han 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.

The credential reveal is blocked by the inline security finding.

[P2] The new tests inspect source strings instead of exercising IPC and renderer behavior. connection-credential-ipc-hardening-contract.test.ts explicitly requires credentialStore.getSecret() in a renderer-facing handler, so the test locks in the boundary violation rather than catching it. After removing the reveal path, add behavior-level coverage that invokes the registered IPC handler and verifies that no main-to-renderer result contains cleartext. The reveal and save states also need a component or E2E test instead of source-shape assertions.

Please revise before merging.

slug = normalizeConnectionSlugForIpc(slug, 'connection slug');
const connection = await connectionStore.get(slug);
if (!connection || !providerAuthSupportsApiKey(connection.providerType)) return null;
return credentialStore.getSecret(slug, 'api_key');

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.

[P1] Keep API keys on the main side of IPC

This returns the stored API key from main to the renderer. SECURITY.md sections 2.3 and 4 treat the renderer as semi-trusted and require cleartext secrets to travel only from renderer to main. A compromised renderer can list connection slugs, call this handler for each API-key provider, and read the saved credentials. Keep the stored value in main, expose only masked or presence state, and accept a replacement value from the renderer when the user saves.

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