Skip to content

Commit 820f0b9

Browse files
Record why received trailers are not marked with trailer! in a SECURITY: comment.
1 parent b6bf5b6 commit 820f0b9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎lib/async/http/protocol/http2/stream.rb‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def add_header(key, value, trailer: false)
5757
end
5858

5959
# Process trailing headers received after the body.
60+
#
61+
# SECURITY: Received trailers are added to the same headers object as the initial headers and are not marked with `Headers#trailer!`. This is not a smuggling vector: `add(..., trailer: true)` rejects any field whose policy does not permit it as a trailer, so a field such as `content-length` cannot arrive here, and position in the message does not change what a permitted field means. Marking them would make a buffering proxy re-send them as trailers and drop them from non-chunked responses. Whether the `Generic` fallback policy should permit unknown fields as trailers is tracked in socketry/protocol-http#127.
6062
# @parameter headers [Array] The trailing header key-value pairs.
6163
# @parameter end_stream [Boolean] Whether the stream ends after these headers.
6264
def receive_trailing_headers(headers, end_stream)

0 commit comments

Comments
 (0)