Skip to content

Fix parsing of legacy url_rewrite_program responses#2420

Closed
rmetrich wants to merge 1 commit into
squid-cache:masterfrom
rmetrich:crash
Closed

Fix parsing of legacy url_rewrite_program responses#2420
rmetrich wants to merge 1 commit into
squid-cache:masterfrom
rmetrich:crash

Conversation

@rmetrich
Copy link
Copy Markdown
Contributor

@rmetrich rmetrich commented May 18, 2026

Legacy helper responses start with a URL instead of OK rewrite_url=...
and such. 2016 commit ddc77a2 introduced two bugs when handling legacy
responses:

  • Response parsing code triggered MemBuf assertions when 0-terminating
    the parsing buffer for certain URLs. The bug affected legacy helper
    responses with and without space characters.

  • Squid code attempted to accept/use helper-returned URLs with embedded
    space character(s), despite a WARNING implying that the post-space
    characters are not going to become a part of the new URL.

@squid-anubis squid-anubis added the M-failed-description https://github.com/measurement-factory/anubis#pull-request-labels label May 18, 2026
@squid-anubis

This comment was marked as resolved.

@rousskov rousskov changed the title Fixed assertion failure when using legacy 'url_rewrite_program' helper Fixed parsing of legacy url_rewrite_program responses May 18, 2026
@squid-anubis squid-anubis removed the M-failed-description https://github.com/measurement-factory/anubis#pull-request-labels label May 18, 2026
Copy link
Copy Markdown
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.

Thank you for fixing this code!

I added a couple of polishing requests. Please also add yourself to CONTRIBUTORS, preferably using details matching your GitHub account; you can use the diff in the upcoming CI test failure as a guidance for CONTRIBUTORS modification.

I adjusted PR title to satisfy formatting requirements. I rewrote PR description to remove debugging, remove excessive/dangerous details, and to satisfy formatting requirements. Please adjust further if needed!

P.S. We should probably followup with the complete removal of legacy helper support in master/v8, but that requires non-trivial work, and the proposed surgical fix is the best next step.

Comment thread src/redirect.cc
Comment thread src/redirect.cc Outdated
@rousskov
Copy link
Copy Markdown
Contributor

rousskov commented May 18, 2026

Please also add yourself to CONTRIBUTORS, preferably using details matching your GitHub account; you can use the diff in the upcoming CI test failure as a guidance for CONTRIBUTORS modification.

The test actually succeeded despite GitHub marking your pull request with "First-time contributor". Apparently, this happens when there are non-ASCII characters in the otherwise missing entry. See the test log for details. Please add your entry using ASCII characters.

P.S. I apologize that we are not accepting non-ASCII CONTRIBUTORS entries at this time. This is a known problem, and we will eventually address it.

Comment thread src/redirect.cc Outdated
@rousskov
Copy link
Copy Markdown
Contributor

BTW, there is no need to squash PR branch commits. Our merge bot will do that automatically...

Legacy helper responses start with a URL instead of OK rewrite_url=...
and such. 2016 commit ddc77a2 introduced two bugs when handling legacy
responses:

- Response parsing code triggered MemBuf assertions when 0-terminating
  the parsing buffer for certain URLs. The bug affected legacy helper
  responses with and without space characters.

- Squid code attempted to accept/use helper-returned URLs with embedded
  space character(s), despite a WARNING implying that the post-space
  characters are not going to become a part of the new URL.

Signed-off-by: Renaud Metrich <rmetrich@redhat.com>
Co-authored-by: Alex Rousskov <rousskov@measurement-factory.com>
Copy link
Copy Markdown
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.

Thank you for polishing this up! No further action is needed at this time. If there are no new change requests from others, then this PR will be automatically merged in zero to ten days (depending on whether others approve it as well).

@rousskov rousskov added M-cleared-for-merge https://github.com/measurement-factory/anubis#pull-request-labels S-could-use-an-approval An approval may speed this PR merger (but is not required) labels May 18, 2026
@kinkie kinkie added the backport-to-v7 maintainer has approved these changes for v7 backporting label May 18, 2026
@yadij yadij changed the title Fixed parsing of legacy url_rewrite_program responses Fix parsing of legacy url_rewrite_program responses May 20, 2026
Copy link
Copy Markdown
Contributor

@yadij yadij left a comment

Choose a reason for hiding this comment

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

Thank you for this fix.

@yadij yadij removed the S-could-use-an-approval An approval may speed this PR merger (but is not required) label May 20, 2026
squid-anubis pushed a commit that referenced this pull request May 20, 2026
Legacy helper responses start with a URL instead of `OK rewrite_url=...`
and such. 2016 commit ddc77a2 introduced two bugs when handling legacy
responses:

* Response parsing code triggered MemBuf assertions when 0-terminating
  the parsing buffer for certain URLs. The bug affected legacy helper
  responses with and without space characters.

* Squid code attempted to accept/use helper-returned URLs with embedded
  space character(s), despite a WARNING implying that the post-space
  characters are not going to become a part of the new URL.
@squid-anubis squid-anubis added the M-waiting-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels label May 20, 2026
@squid-anubis squid-anubis added M-merged https://github.com/measurement-factory/anubis#pull-request-labels and removed M-waiting-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels M-cleared-for-merge https://github.com/measurement-factory/anubis#pull-request-labels labels May 21, 2026
@squidadm squidadm removed the backport-to-v7 maintainer has approved these changes for v7 backporting label May 21, 2026
@squidadm
Copy link
Copy Markdown
Collaborator

queued for backport to v7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M-merged https://github.com/measurement-factory/anubis#pull-request-labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants