Skip to content

feat: harden proxy against framing desync and idle clients - #8

Merged
miklosn merged 2 commits into
mainfrom
feat/hardening
Nov 4, 2026
Merged

miklosn merged 2 commits into
mainfrom
feat/hardening

Conversation

@miklosn

@miklosn miklosn commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner
  • Reject commands whose terminator does not match their z/n prefix (clamd and the proxy framed them differently, so a zINSTREAM\n put the proxy in raw-forward mode while clamd was not in stream mode); reject unprefixed INSTREAM
  • Close the connection after a blocked command instead of keeping the session open
  • --idle-timeout (default 120s): drop client connections with no traffic
  • --max-connections (default unlimited): cap concurrent clients
  • Always close the backend when the client side ends, and flush backend responses to the client as they arrive

First commit is the failing reproduction test; the fix follows.


This change is Reviewable

Reject commands whose terminator does not match their z/n prefix and
unprefixed INSTREAM, since clamd frames those differently from the proxy
and raw stream data could reach it as commands. Close the session after
a blocked command, add --idle-timeout and --max-connections, always
close the backend when the client side ends, and flush backend
responses to the client as they arrive.
@miklosn
miklosn merged commit cb32077 into main Nov 4, 2026
7 checks passed
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.

1 participant