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 · 2 則留言 ·
維護者通常 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:infra enhancement
難度 2/5 1-3 小時 新手友好度 74/100
axeslasher/Jelly-Shark#352 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
OneBusAway/onebusaway-ios#1658 ·
維護者通常 1 天內回覆
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
難度 2/5 1-3 小時 新手友好度 78/100
steipete/CodexBar#5048 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
area: build-and-ci S3: minor
難度 2/5 1-3 小時 新手友好度 72/100
manaflow-ai/cmux#40559 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
johnno1962/InjectionNext#178 · 5 則留言 ·