Skip to content

domain_fronter: reject truncated Content-Length relay responses - #48

Merged
therealaleph merged 1 commit into
therealaleph:mainfrom
freeinternet865:fix/truncated-content-length-relay-responses
Apr 23, 2026
Merged

therealaleph merged 1 commit into
therealaleph:mainfrom
freeinternet865:fix/truncated-content-length-relay-responses

Conversation

@freeinternet865

@freeinternet865 freeinternet865 commented Apr 23, 2026 •

Copy link
Copy Markdown
Contributor

read_http_response() handled Content-Length bodies by breaking out of the
read loop on EOF and returning whatever bytes had been collected so far.
That allowed a truncated upstream relay response to be treated as a complete
HTTP response.

Return FronterError::BadResponse("connection closed before full response body")
when the stream closes before the declared Content-Length has been read.

The test suite now covers a response that declares Content-Length: 5 but
only sends 3 body bytes.


Edited and written by GPT.

read_http_response() handled Content-Length bodies by breaking out of the
read loop on EOF and returning whatever bytes had been collected so far.
That allowed a truncated upstream relay response to be treated as a complete
HTTP response.

Return FronterError::BadResponse("connection closed before full response body")
when the stream closes before the declared Content-Length has been read.

The test suite now covers a response that declares Content-Length: 5 but
only sends 3 body bytes.
@freeinternet865 freeinternet865 changed the title Reject truncated Content-Length relay responses domain_fronter: reject truncated Content-Length relay responses Apr 23, 2026
@therealaleph
therealaleph merged commit 9a229a8 into therealaleph:main Apr 23, 2026
therealaleph added a commit that referenced this pull request Apr 23, 2026
…only (#60)

Contains the three safety fixes from PRs #48/#49/#50 and the Persian
README RTL polishing from #58, all squashed into main. Merge details
already in their individual PR comments; summary:

  #48: reject truncated Content-Length relay responses (previously
       silently accepted whatever bytes arrived before EOF)
  #49: reject truncated or malformed (missing CRLF) chunked-encoding
       relay responses (same class of silent-acceptance bug)
  #50: restrict the SNI-rewrite tunnel dispatch to port 443. Plain
       HTTP (:80) targets that happened to match google.com / hosts
       override were being steered into the TLS tunnel and blocking
       waiting for a ClientHello that would never arrive.
  #58: trailing-whitespace line-breaks on Persian bullet lists in
       README so the RTL rendering doesn't collapse consecutive
       items into a single paragraph.

Test suite grew from 54 to 58 passing (three new negative tests for
the relay-reader correctness fixes + one SNI-rewrite port filter).

Telegram CI notify default switched to file-plus-link:
  - script gains a `--with-changelog` flag; default OFF
  - workflow only passes it when `vars.TELEGRAM_INCLUDE_CHANGELOG=true`
  - every routine release now posts just the APK + short caption
    (title + SHA-256 + repo URL + release URL) with no long body

To include bullets for a given release again:
  gh variable set TELEGRAM_INCLUDE_CHANGELOG --body true
The existing `vars.TELEGRAM_NOTIFY_ENABLED` job-level gate remains —
changelog toggle is orthogonal to enable/disable.

Also closes PR #55 without merging; ads/analytics domains were being
lumped under a YouTube-specific toggle, and the PR committed per-
machine \`.cargo/config.toml\` + zig-cc cross-compile helpers that
would have broken CI on actual Windows / macOS runners.
@freeinternet865
freeinternet865 deleted the fix/truncated-content-length-relay-responses branch April 23, 2026 13:41
therealaleph pushed a commit that referenced this pull request Apr 25, 2026
read_http_response() handled Content-Length bodies by breaking out of the
read loop on EOF and returning whatever bytes had been collected so far.
That allowed a truncated upstream relay response to be treated as a complete
HTTP response.

Return FronterError::BadResponse("connection closed before full response body")
when the stream closes before the declared Content-Length has been read.

The test suite now covers a response that declares Content-Length: 5 but
only sends 3 body bytes.

Co-authored-by: freeinternet865 <[email protected]>
therealaleph added a commit that referenced this pull request Apr 25, 2026
…only (#60)

Contains the three safety fixes from PRs #48/#49/#50 and the Persian
README RTL polishing from #58, all squashed into main. Merge details
already in their individual PR comments; summary:

  #48: reject truncated Content-Length relay responses (previously
       silently accepted whatever bytes arrived before EOF)
  #49: reject truncated or malformed (missing CRLF) chunked-encoding
       relay responses (same class of silent-acceptance bug)
  #50: restrict the SNI-rewrite tunnel dispatch to port 443. Plain
       HTTP (:80) targets that happened to match google.com / hosts
       override were being steered into the TLS tunnel and blocking
       waiting for a ClientHello that would never arrive.
  #58: trailing-whitespace line-breaks on Persian bullet lists in
       README so the RTL rendering doesn't collapse consecutive
       items into a single paragraph.

Test suite grew from 54 to 58 passing (three new negative tests for
the relay-reader correctness fixes + one SNI-rewrite port filter).

Telegram CI notify default switched to file-plus-link:
  - script gains a `--with-changelog` flag; default OFF
  - workflow only passes it when `vars.TELEGRAM_INCLUDE_CHANGELOG=true`
  - every routine release now posts just the APK + short caption
    (title + SHA-256 + repo URL + release URL) with no long body

To include bullets for a given release again:
  gh variable set TELEGRAM_INCLUDE_CHANGELOG --body true
The existing `vars.TELEGRAM_NOTIFY_ENABLED` job-level gate remains —
changelog toggle is orthogonal to enable/disable.

Also closes PR #55 without merging; ads/analytics domains were being
lumped under a YouTube-specific toggle, and the PR committed per-
machine \`.cargo/config.toml\` + zig-cc cross-compile helpers that
would have broken CI on actual Windows / macOS runners.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants