Fix model connection credential reveal and save flow - #1421
Conversation
Astro-Han
left a comment
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
[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.
修改内容
修复已保存模型密钥无法通过眼睛按钮查看的问题
调整模型连接高级设置的保存逻辑
改进保存后的交互反馈
补充配套改动