Skip to content

ICP: Fix HttpRequest lifetime for ICP v3 queries#2387

Merged
yadij merged 1 commit intosquid-cache:v7from
kinkie:v7-backport-2377
Mar 12, 2026
Merged

ICP: Fix HttpRequest lifetime for ICP v3 queries#2387
yadij merged 1 commit intosquid-cache:v7from
kinkie:v7-backport-2377

Conversation

@kinkie
Copy link
Contributor

@kinkie kinkie commented Mar 11, 2026

ACLFilledChecklist correctly locks and unlocks HttpRequest. Thus, when
given an unlocked request object, an on-stack checklist destroys it.
Upon icpAccessAllowed() return, Squid uses the destroyed request object.

This bug was probably introduced in 2003 commit 8000a96 that started
automatically unlocking requests in ACLChecklist destructor. However,
the bug did not affect allowed ICP v3 queries until 2007 commit f72fb56
started using the request object for them. 2005 commit 319bf5a fixed
an equivalent ICP v2 bug for denied queries but missed the ICP v3 case.

The scope, age, and effect of this bug imply that Squid v3+ deployments
receive no ICP v3 queries since 2007 (or earlier). Squid itself does not
send ICP v3 messages, responding with ICP v2 replies to ICP v3 queries.
TODO: Consider dropping ICP v3 support.

Also moved icpAccessAllowed() inside icpGetRequest() to deduplicate code
and reduce the risk of allowing a request without consulting icp_access.

ACLFilledChecklist correctly locks and unlocks HttpRequest. Thus, when
given an unlocked request object, an on-stack checklist destroys it.
Upon icpAccessAllowed() return, Squid uses the destroyed request object.

This bug was probably introduced in 2003 commit 8000a96 that started
automatically unlocking requests in ACLChecklist destructor. However,
the bug did not affect allowed ICP v3 queries until 2007 commit f72fb56
started _using_ the request object for them. 2005 commit 319bf5a fixed
an equivalent ICP v2 bug for denied queries but missed the ICP v3 case.

The scope, age, and effect of this bug imply that Squid v3+ deployments
receive no ICP v3 queries since 2007 (or earlier). Squid itself does not
send ICP v3 messages, responding with ICP v2 replies to ICP v3 queries.
TODO: Consider dropping ICP v3 support.

Also moved icpAccessAllowed() inside icpGetRequest() to deduplicate code
and reduce the risk of allowing a request without consulting icp_access.
@squid-anubis squid-anubis added the M-failed-description https://github.com/measurement-factory/anubis#pull-request-labels label Mar 11, 2026
@squid-anubis

This comment was marked as resolved.

@squid-anubis

This comment was marked as resolved.

@squid-anubis

This comment was marked as resolved.

@rousskov rousskov changed the title ICP: Fix HttpRequest lifetime for ICP v3 queries (#2377) ICP: Fix HttpRequest lifetime for ICP v3 queries Mar 11, 2026
@squid-anubis squid-anubis removed the M-failed-description https://github.com/measurement-factory/anubis#pull-request-labels label Mar 11, 2026
@rousskov
Copy link
Contributor

rousskov commented Mar 11, 2026

I copied original commit 49f47cc message into PR title/description.

@kinkie
Copy link
Contributor Author

kinkie commented Mar 12, 2026

I copied original commit 49f47cc message into PR title/description.

Thanks. For some reason my editor kept messing up formatting

@kinkie
Copy link
Contributor Author

kinkie commented Mar 12, 2026

waiting for approval, can't merge without

@squid-anubis squid-anubis added the M-failed-other https://github.com/measurement-factory/anubis#pull-request-labels label Mar 12, 2026
@yadij yadij merged commit 703e07d into squid-cache:v7 Mar 12, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants