Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Account for hosts with/without ports in origin check

Đang mở
#6,166 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
security

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện việc so sánh Origin và Host với cấu hình NGINX proxy_set_header được cung cấp, sau đó xem xét các issue liên quan 6161, 6023, 6064 và 6014. Xác định cách xử lý dự kiến đối với các cổng mặc định và không mặc định; công việc được xem là hoàn tất khi kiểm tra Origin của websocket nhất quán chấp nhận các cấu hình khớp hợp lệ mà không làm suy yếu các đảm bảo bảo mật của nó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
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

Ngôn ngữ chính
TypeScript
Star
79.4k
Fork
6.9k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
39

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của coder/code-server

Tất cả issue của coder/code-server

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.