Securely pass a Coder session token to the (System) Network Extension
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 重构
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- macos, swift
调研方向
首先追踪 issue 中描述的 NETunnelProviderProtocol.providerConfiguration 路径以及 NEPacketTunnelProvider.startTunnel 入口点。审查 Keychain 和 XPC 方案,然后将完成定义为:在不将会话令牌存储在 providerConfiguration 中的情况下安全地传递它。
由索引模型根据 Issue 内容生成。
描述
The Network Extension requires a session token for a Coder deployment in order to function. This is (and should be) stored in the macOS Keychain.
When registering the network extension as a system VPN, a NETunnelProviderProtocol can be configured and passed to the network extension when it's started (via NEPacketTunnelProvider.startTunnel). NETunnelProviderProtocol.serverAddress allows us to pass the access URL of the deployment.
NETunnelProviderProtocol.passwordReference is described as:
a persistent reference to a keychain item with the kSecClassGenericPassword class.
This field doesn't take into account the fact that the Network Extension might be a System Extension (as opposed to an app extension, used when submitting the application to the macOS/iOS App Store).
For reference, the WireGuard macOS app uses an app extension, running as the user, not root. It's able to pass a keychain reference to that app extension after modifying the item's keychain ACL.
In our case, there's a few problems:
- Whilst Keychain Access Groups exist to share keychain items between multiple sandboxed applications, they require all apps use the data protection keychain (as opposed to the file-based keychain).
Programs that run outside of the user context (such as our NE, running as root), cannot use the data protection keychain. [1] [2] - File-based keychains are accessible from both users and the network-extensions. However, the sandboxed application is only capable of writing to the user keychain, and the network extension is only capable of reading from the system keychain. The application would need elevated permissions to write to the system keychain, and use
passwordReferenceto pass a keychainpersistentRef. [3] [4]
The dev forum solution appears to be to send the credentials over some IPC, which would definitely be XPC in our case ([3], [4]). However, sending the session token over XPC in our case might lead to an annoying implementation: when the VPN is started it first must wait for yet another message containing the session token.
Instead, the current (hacked) solution involves just storing the session token within the NETunnelProviderProtocol.providerConfiguration dictionary. I believe the only difference between this and XPC is that this configuration is written to disk. We currently store Coder CLI tokens on disk too right now, though it'd be good to improve both situations in the future.
- 主要语言
- Swift
- 星标
- 29
- 派生
- 9
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
coder/coder-desktop-macos 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 45/100
coder/coder-desktop-macos#285 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 45/100
coder/coder-desktop-macos#230 · 2 个 reaction ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
coder/coder-desktop-macos#221 ·
维护者通常 1 天内回复
-
documentation
难度 2/5 半天 新手友好度 48/100
coder/coder-desktop-macos#220 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 30/100
coder/coder-desktop-macos#212 · 1 条评论 ·
维护者通常 1 天内回复
查看 coder/coder-desktop-macos 的全部 Issue
相似的 Issue
-
area:shell order:5 status:ready type:bug
难度 1/5 1 小时以内 新手友好度 85/100
krystianslowik/arkt#899 ·
维护者通常 1 天内回复
-
help wanted roadmap tests
难度 2/5 1-3 小时 新手友好度 68/100
-
🐞 bug 💠 component 🔍 triage v4 🧰 library
难度 1/5 1 小时以内 新手友好度 72/100
Orange-OpenSource/ouds-ios#1875 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 78/100
521xueweihan/HelloGitHub#4295 ·
-
难度 2/5 1-3 小时 新手友好度 78/100