Skip to content

Bug 5487: only trim SP and HTAB around field-value #2036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yadij
Copy link
Contributor

@yadij yadij commented Mar 22, 2025

No description provided.

@rousskov rousskov self-requested a review March 22, 2025 21:10
@yadij yadij added the backport-to-v7 maintainer has approved these changes for v7 backporting label Mar 23, 2025
Copy link
Contributor

@rousskov rousskov left a comment

Choose a reason for hiding this comment

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

AFAICT, this PR does not address the essence of Bug 5487 because Squid still misinterprets non-WSP whitespace after framing-sensitive Content-Length values: Such whitespace is going to be removed by ContentLengthInterpreter::checkList()-called strListGetItem() that still uses xisspace() for trimming. The bug report uses Transfer-Encoding rather than Content-Length as an example, but Content-Length is an arguably worse attack vector because it is an end-to-end header!

There are other places in Squid code where xisspace() is used while parsing HTTP header values, including authentication-related header values. It could be argued that whatever happens inside a value is outside this PR scope, but strListGetItem() mentioned above right-trims the the last list item (among others), so it will remove non-WSP whitespace at the end of a header field value -- something this PR claims to prevent.

I see two reasonable ways to make progress:

  1. Keep this PR code intact. Edit PR description to (a) explicitly state that Squid may still trim non-SP/HTAB characters around (and inside) HTTP field values and (b) explain why we are content with such incomplete/inconsistent whitespace treatment.
  2. Adjust PR to ban xisspace() and equivalent from all known HTTP header field parsing code, including strListGetItem() and HttpHeader::getAuthToken().

@squid-anubis squid-anubis added M-failed-other https://github.com/measurement-factory/anubis#pull-request-labels and removed M-failed-other https://github.com/measurement-factory/anubis#pull-request-labels labels May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-v7 maintainer has approved these changes for v7 backporting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants