Skip to content

fix: validate CHAT_CLIENT_IP_HEADER as HTTP field-name at boot (fixes #745) - #864

Closed
RobGenins wants to merge 2 commits into
flop-labs:mainfrom
RobGenins:fix/client-ip-header-v2
Closed

RobGenins wants to merge 2 commits into
flop-labs:mainfrom
RobGenins:fix/client-ip-header-v2

Conversation

@RobGenins

@RobGenins RobGenins commented Sep 16, 2026

Copy link
Copy Markdown

CHAT_CLIENT_IP_HEADER was lowercased and stripped but not validated as an HTTP field-name. A non-ASCII value passed config parsing and booted, then crashed every rate-limited route with UnicodeEncodeError at Latin-1 header lookup.

Changes (v2, replacing closed #837 and superseding #857):

  • Validate that non-empty CHAT_CLIENT_IP_HEADER matches the HTTP token grammar (RFC 9110 section 5.1) via .isascii() and a token regex.
  • Empty string remains the documented opt-out
  • Regression test for non-ASCII, colon, space, comma, and valid header values

Also fixes #789 (sz.py docstring omits src/limit.py from the core file set).

All 779 tests pass, 1 skipped.

Fixes: #745, #789

Hermes Agent added 2 commits September 16, 2026 14:03
fix: correct README to reference IDLE_SECONDS instead of nonexistent CHAT_IDLE_SECONDS (fixes flop-labs#779)
…lop-labs#745)

- Validate that a non-empty CHAT_CLIENT_IP_HEADER is ASCII-only and
  follows RFC 9110 §5.1 token grammar (no colons, spaces, commas, etc.)
- Empty string remains the documented opt-out
- Fresh-interpreter regression tests for non-ASCII (é, ☃), colon,
  space, comma, and valid values (cf-connecting-ip, x-forwarded-for)
@github-actions

Copy link
Copy Markdown

Open pull requests citing the same issues:

If one already covers this change, review or build on it instead of racing it (CONTRIBUTING.md "Overlapping work").

@Minh3132 Minh3132 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an unrelated, already-owned fix bundled into this head that is not named in the PR scope. Besides the CHAT_CLIENT_IP_HEADER validation and the explicitly declared #789 sz.py docstring change, the diff also rewrites README's CHAT_STILLBORN_SECONDS row from the nonexistent CHAT_IDLE_SECONDS reference to the 7-day IDLE_SECONDS window. That is the exact #779 documentation defect, and it already has its own open focused PR (#848).

This matters beyond tidiness: CONTRIBUTING says to keep each PR focused, avoid unrelated changes, and review/build on existing overlapping work rather than racing it. Because #864 neither cites #779/#848 nor explains why it needs that README hunk, queue-guard cannot flag the overlap; merging this head would silently consume another open PR's issue while the title/body say this PR fixes #745/#789.

Please drop the README CHAT_STILLBORN_SECONDS hunk from this branch (or, if there is a real dependency on #779, explicitly declare and justify that overlap). The header-name validation itself does not depend on the stillborn-window documentation.

@RobGenins

Copy link
Copy Markdown
Author

Rebased and cleaned: dropped unrelated README hunk and bazel-v0.14 reversion from branch. Replaced by fresh PR.

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.

sz.py docstring omits src/limit.py from the core file set Non-ASCII CHAT_CLIENT_IP_HEADER boots successfully, then rate-limited routes return 500

2 participants