Add typed request-cookie parsing and Set-Cookie rendering
Maintainer thường phản hồi trong vòng 1 ngày
@lukewilliamboswell đang làm issue này rồi.
Từ ngày 31/7/2026.
- #207 của @lukewilliamboswell — đang mở
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Bắt đầu bằng cách xác định quyền truy cập vào request header được request.headers() sử dụng và biểu diễn response header cho các trường Set-Cookie riêng biệt. Định nghĩa module Cookie thuần túy xoay quanh các API parse_request và set_header được minh họa, sau đó thêm các test được liệt kê cho việc phân tích, xác thực, tiền tố, SameSite, xóa và header trùng lặp. Hoàn tất khi tất cả tiêu chí chấp nhận đều đạt mà không thay đổi host ABI.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Add a pure Cookie module for:
- Parsing all
Cookierequest header fields while preserving duplicates. - Strictly rendering one
Set-Cookieheader from typed attributes. - Rendering a deletion cookie with matching
PathandDomain.
Illustrative API:
cookies = Cookie.parse_request(request.headers())?
header = Cookie.set_header({
name: "session",
value: session_id,
path: Present("/"),
domain: Absent,
max_age_seconds: Present(3600),
secure: True,
http_only: True,
same_site: Present(Lax),
})?
Why this belongs in the platform
Cookies are a conventional HTTP primitive needed by sessions, authentication, CSRF protection, and browser-facing applications. Hand-building cookie strings is error-prone because Set-Cookie has unusual header semantics and security-sensitive attribute combinations.
The current cookie specification permits multiple Set-Cookie fields and forbids combining them with commas. Servers must also tolerate multiple request Cookie fields, particularly because HTTP/2 and HTTP/3 intermediaries may split them.
Required contract
- Parse every case-insensitive
Cookieheader field. - Preserve cookie order and duplicate names as a
List, not a dictionary. - Treat names as case-sensitive.
- Provide an explicit
get_uniquehelper that reports duplicates instead of silently choosing one. - Validate names and values against the cookie grammar and reject control characters or header injection.
- Do not implicitly percent-encode, Base64-encode, or reinterpret values.
- Render each cookie as its own
Set-Cookieheader. - Support
Path,Domain,Max-Age,Secure,HttpOnly, andSameSite. - Reject
SameSite=NonewithoutSecure. - Enforce the
__Secure-and__Host-prefix requirements. - A deletion helper must accept the original
PathandDomainscope and emit an empty value withMax-Age=0. - Header resource use remains bounded by the server's existing header limits.
Expires, Partitioned, cookie priority, and browser cookie-jar behavior can be follow-ups. Max-Age provides the initial persistent-expiry and deletion contract without introducing a general calendar API.
Tests
Include multiple header fields, duplicate names, case-sensitive names, whitespace, empty values, invalid bytes, commas, CR/LF injection, prefix rules, SameSite=None, and multiple independent Set-Cookie response headers.
Non-goals
- A browser cookie jar with domain/path matching
- Signed or encrypted cookies
- Sessions or authentication
- Public-suffix-list processing
- Automatic mutation of every request or response
- Selecting one duplicate cookie based on serialization order
Acceptance criteria
- Applications can parse all request cookie fields without losing duplicates.
- Applications can render security-sensitive cookie attributes through typed values.
- Multiple response cookies remain multiple
Set-Cookiefields. - Invalid values and unsafe attribute combinations produce typed errors.
- The implementation is pure Roc and requires no host ABI change.
References
- Ngôn ngữ chính
- HTML
- Star
- 110
- Fork
- 25
- Merge trung bình
- 18 giờ 28 phút
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của roc-lang/basic-webserver
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
roc-lang/basic-webserver#277 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
roc-lang/basic-webserver#274 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
roc-lang/basic-webserver#273 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
roc-lang/basic-webserver#272 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
roc-lang/basic-webserver#265 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của roc-lang/basic-webserver
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
OHDSI/Data2Evidence#3815 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
e2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
redhat-developer/rhdh-plugin-export-overlays#4995 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fidelity
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Azure SAS signing uses local time instead of UTC, shifting validity window on non-UTC hostsCó thể đã có người làm @huanghaoyuanhhy đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
zilliztech/milvus-backup#1418 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] download repeatedly fetches unchanged gzip responses due to compressed/decoded size mismatchCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
stanfordnlp/dspy#11000 ·
Maintainer thường phản hồi trong vòng 1 ngày