[Feature] 远程连接的秘密生命周期:Go 侧答案按 S14 清零,删除连接时处理保留会话的令牌
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 24/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- go, typescript
- Área
- authentication, desktop-dev, security
Línea de trabajo
Start at desktop/internal/workbench/git_auth.go (answerGitAuth) and follow the secret into desktop/internal/core/gitauth.go, core/remote.go, credentials/credentials.go (Store.Get/Set) and remoteconn/answers.go, noting every copy, since encoding/json and cgo/syscall boundaries may duplicate it. For part 2 read remoteconn/kept.go (keptAccount) and the @host/remote-sessions entries, and decide how kept sessions group per saved connection plus the migration from the old keys. Done means no string copies of secrets remain, buffers are zeroed, and deleting a connection clears or prompts for its kept sessions.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem to solve / 要解决的问题
#2231 的 S14 要求秘密用完立即从内存清零:Go 侧用 []byte 持有,用完清零,不转成 string。设置表“连接”一行要求删除连接、清除已记住的秘密后,钥匙串里不留这台机器的秘密。桌面端现在有两处没做到。
1. Go 侧以 string 持有密码和口令,无法清零
desktop/internal/workbench/git_auth.go的answerGitAuth用g.field.Text()从 Viva 的ui.Field取出string。Viva 输入框内部也用字符串保存内容。desktop/internal/core/gitauth.go的Client.GitAuthRespond和desktop/internal/core/remote.go的Client.RemoteAuthRespond参数是*string,再编码成 JSON 交给 Core。desktop/internal/credentials/credentials.go的Store.Get/Store.Set以string读写秘密。“记住密码”(desktop/internal/remoteconn/answers.go)保存的答案以 JSON 的string字段编解码。
Go 的 string 不可改写,在垃圾回收之前,这些副本会一直留在堆上。影响:进程内存转储或交换文件里可能残留密码和私钥口令。
2. 删除已保存的连接后,保留会话的令牌还在钥匙串里
- 保留会话的令牌存在
@host/remote-sessions,键是desktop/internal/remoteconn/kept.go的keptAccount(connectionID)。删除连接时没有清理这些令牌,也没有停止或提示远端仍在运行的保留进程。 - 同一台主机上的容器以
<已保存连接 id>/<容器身份>作为连接 id,钥匙串接口不能按前缀列出条目,删除连接时找不到它们。 - 影响:令牌残留在钥匙串里;远端进程失去入口,用户既接不回也停不掉。
记住的密码不受第 2 点影响:它按已保存连接的 id 存放(容器截掉 / 之后的部分),删除连接时已一并清除。
Proposed solution / 建议方案
1. 秘密全程用 []byte 持有,用完清零
- Viva 的密码输入框提供以
[]byte读取并清空内部缓冲的接口。在 Lithe-IDEA/viva 修改,同时向上游 vivaui/viva 提 PR。 core.Client的应答方法改收[]byte,编码请求时不经过string,发出后清零。credentials.Store增加[]byte版本的读写,macOS 钥匙串和 Windows 凭据管理器的实现读写后清零。remoteconn记住的答案改用不经过string的编码。
风险:encoding/json、cgo 边界和系统 API 可能仍会复制数据。需要逐层确认副本在哪里,做不到清零的地方写进 Agent Note。
2. 删除连接时处理它的保留会话
- 先列出这个连接(包括它上面的容器)的保留会话,询问是否同时停止远端进程,再删除令牌。
- 保留会话改为按所属的已保存连接分组存放,例如每个已保存连接一个条目,里面按容器身份区分,这样删除时能一次找全。
风险:存储格式变化要兼容已有条目,读取旧键后迁移到新格式。
Target platform / 目标平台
Cross-platform / 跨平台
Area / 模块
Remote and WSL / 远程与 WSL
Priority / 优先级
P2 / 后续考虑:目前不着急,可安排到后续版本
Alternatives considered / 已考虑的替代方案
- 依靠垃圾回收释放
string:回收时机不确定,不满足 S14。 - 删除连接时只删除这个连接 id 本身的令牌:容器的令牌仍然残留,只解决一半。
- 删除连接时直接删除令牌、不处理远端进程:远端进程失去入口,用户接不回也停不掉。
Additional context / 补充信息
- 设计依据:#2231 的 S12、S14 和设置表“连接”一行。
- 在 #2231 实现“SSH 身份验证”窗口的“记住密码”勾选时发现。那次改动已做到:只在勾选且登录成功后写入钥匙串,只在主机第一次询问时自动填入,被拒绝就删除,验证码和主机指纹从不记住,删除连接时清除记住的密码。上面两点需要单独设计,所以单独建单。
Checklist / 提交前检查
- I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.8k
- Forks
- 151
- Merge medio
- 3 h 48 min
- PR fusionados (30 d)
- 571
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de 1lck/Lithe-IDEA
-
review: medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
1lck/Lithe-IDEA#2432 ·
Los mantenedores suelen responder en 1 día
-
review: medium
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
1lck/Lithe-IDEA#2431 ·
Los mantenedores suelen responder en 1 día
-
refactor review: high
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
1lck/Lithe-IDEA#2376 ·
Los mantenedores suelen responder en 1 día
-
area:ui enhancement P2 platform:cross-platform refactor review: high
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
1lck/Lithe-IDEA#2365 ·
Los mantenedores suelen responder en 1 día
-
review: medium
Dificultad 3/5 1-2 días Aptitud para principiantes 57/100
1lck/Lithe-IDEA#2434 ·
Los mantenedores suelen responder en 1 día
Todos los issues de 1lck/Lithe-IDEA
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
posit-dev/positron-sas-extension#196 ·
Los mantenedores suelen responder en 1 día
-
bug composer
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
inmanta/web-console#8037 ·
Los mantenedores suelen responder en 1 día
-
Add: AlFajer Palestine FHDAbiertocheck:passed streams:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
bug: v5 dist/types/components.d.ts imports @stencil/core/runtime instead of ./stencil-public-runtimeAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día