Account for hosts with/without ports in origin check
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 25/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- typescript
- 領域
- security
研究方向
首先,使用提供的 NGINX proxy_set_header 設定重現 Origin 與 Host 的比較,然後檢視相關的 issue 6161、6023、6064 和 6014。確定預設連接埠與非預設連接埠的預期處理方式;完成的標準是 websocket Origin 檢查在不削弱其安全性保證的情況下,始終接受有效且相符的設定。
由索引模型根據 Issue 內容生成。
描述
Is there an existing issue for this?
- I have searched the existing issues
OS/Web Information
N/A
Steps to Reproduce
You can simulate with this NGINX config:
proxy_set_header X-Forwarded-Host $host:$server_port;
Expected
If your origin is https://domain.tld and your host is domain.tld:443 the check should pass. Same for http://domain.tld and domain.tld:80.
Also I think NGINX's $host actually does not include ports so it will fail if your config only has $host and if you host on a port other than 443 and 80 since you would get an origin like https://domain.tld:8080 and the host would be domain.tld.
To fix the first we could just check the protocol on the origin and then add/remove 443 or 80.
For the second we could ignore the port altogether since I think the vulnerability does not happen across ports...
But I am not sure we should do anything; maybe the correct course of action is to edit the proxy config so the host and origin headers match. I have looked at other software but they all seem to do exact matches without messing around with the port. We could just edit the documentation to use $http_host.
Actual
The origin and domain are matched exactly so they do not match. Ends up causing the web sockets to fail with 1006.
Logs
No response
Screenshot/Video
No response
Does this issue happen in VS Code or GitHub Codespaces?
- I cannot reproduce this in VS Code.
- I cannot reproduce this in GitHub Codespaces.
Are you accessing code-server over HTTPS?
- I am using HTTPS.
Notes
https://github.com/coder/code-server/issues/6161
Might be causing issues reported in https://github.com/coder/code-server/issues/6023 and https://github.com/coder/code-server/issues/6064 as well.
And possibly https://github.com/coder/code-server/issues/6014
- 主要語言
- TypeScript
- 星號
- 79.4k
- 分支
- 6.9k
- 平均合併
- 2 天 13 小時
- 30 天內合併 PR
- 39
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
coder/code-server 的其他 Issue
-
難度 1/5 1 小時以內 新手友好度 92/100
coder/code-server#8017 · 2 則留言 ·
-
security
難度 2/5 1-3 小時 新手友好度 74/100
coder/code-server#8013 · 4 則留言 ·
-
enhancement
難度 5/5 一週以上 新手友好度 35/100
coder/code-server#7976 · 2 則留言 ·
-
enhancement
難度 5/5 一週以上 新手友好度 35/100
coder/code-server#7962 · 3 則留言 ·
-
bug needs-investigation
難度 4/5 3-5 天 新手友好度 55/100
coder/code-server#7955 · 1 則留言 ·
查看 coder/code-server 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
vercel-labs/just-bash#464 ·
-
looksLikeSlug() is ASCII-only, so non-Latin entity slugs (e.g. Korean) skip exact match and collapse 未關閉
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 2/5 1-3 小時 新手友好度 65/100
-
難度 2/5 1-3 小時 新手友好度 65/100
-
難度 1/5 1 小時以內 新手友好度 90/100
TanStack/tanstack.com#1293 ·