Skip to content

Commit 5086724

Browse files
committed
2026-04-21
1 parent c36106a commit 5086724

16 files changed

Lines changed: 544 additions & 41 deletions

File tree

squid-dev/2026-April.txt

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,3 +1496,128 @@ Alex.
14961496
> https://lists.squid-cache.org/listinfo/squid-dev
14971497

14981498

1499+
From rousskov at measurement-factory.com Mon Apr 20 18:59:14 2026
1500+
From: rousskov at measurement-factory.com (Alex Rousskov)
1501+
Date: Mon, 20 Apr 2026 14:59:14 -0400
1502+
Subject: [squid-dev] Issue with acl note (without -m) splitting helper
1503+
tokens containing commas
1504+
In-Reply-To: <CADJd0Y1M=Z9VY6spPMcR1SoFgrfDKuWdbWM=6=A=CEoS+oi+Og@mail.gmail.com>
1505+
References: <CADJd0Y1M=Z9VY6spPMcR1SoFgrfDKuWdbWM=6=A=CEoS+oi+Og@mail.gmail.com>
1506+
Message-ID: <10e9ebca-6fa4-48a9-9082-1c03eb97a792@measurement-factory.com>
1507+
1508+
On 2026-04-17 09:08, Andrey K wrote:
1509+
1510+
> While working with annotations, I?ve noticed an inconsistency in how acl
1511+
> note (without the -m option) handles tokens received from helpers when
1512+
> they contain a comma.
1513+
1514+
I think it is important to note that there are several distinct players
1515+
here, including:
1516+
1517+
1. What annotations the helper sends to Squid.
1518+
1519+
2. How helper response parser converts received helper response into
1520+
transaction annotations.
1521+
1522+
3. How the "note" ACL code interprets transaction annotations.
1523+
These annotations may come from sources other than a helper.
1524+
1525+
1526+
> According to the documentation, an ACL like this:
1527+
> ? ? acl staff note group Staff:accountants,lawyers,security
1528+
> should match a helper response such as:
1529+
> ? ? group="Staff:accountants,lawyers,security"
1530+
1531+
The above implies that helper response parser should not split group=X
1532+
response fields (using comma as a delimiter). Do we document that
1533+
anywhere? Did our helper response parser ever split such fields in the past?
1534+
1535+
BTW, 2015 commit 76ee67ac used a very similar example. AFAICT by looking
1536+
at that code, we did not apply value delimiters by default back then
1537+
(i.e. when ACL_F_SUBSTRING a.k.a. "-m" flag was not set). The bug was
1538+
introduced in 2017 commit 4eac3407 that replaced a possibly-nil
1539+
`flags.delimiters()` with a never-nil `&delimiters.value`.
1540+
1541+
The following comment suggests that we missed the fact that using the
1542+
[default-initialized] value "without checking whether the option is
1543+
enabled()" is a bug -- the corresponding "trick" never fully worked:
1544+
1545+
```C++
1546+
// TODO: Some callers use .value without checking whether the option is
1547+
// enabled(), accessing the (default-initialized or customized) default
1548+
// value that way. This trick will stop working if we add valued options
1549+
// that can be disabled (e.g., --with-foo=x --without-foo).
1550+
```
1551+
1552+
1553+
> However, this is not the case. The helper's response is split into
1554+
> tokens using a comma as the default delimiter. As a result, only ACLs
1555+
> like the following will match:
1556+
> ? ? acl staff note group lawyers
1557+
>
1558+
> This behavior occurs because in Acl::NoteCheck::matchNotes(), a comma is
1559+
> passed as the default delimiter to the expandListEntries() function
1560+
1561+
Agreed.
1562+
1563+
1564+
> I would like to propose two changes:
1565+
> 1. Removing the default comma delimiter.
1566+
1567+
... and check enabled() before using the stored value, fixing the bug
1568+
introduced in 2017 commit 4eac3407.
1569+
1570+
1571+
> I am prepared to submit a simple PR to exclude this comma to fix the
1572+
> incorrect matching of strings containing commas.
1573+
> However, I realize this might be a breaking change for users who
1574+
> currently rely on this implicit splitting behavior.
1575+
1576+
Yes. We should disclose the bug fix in Squid release notes.
1577+
1578+
We can also add code to warn admins (via a cache.log WARNING message)
1579+
when a "note" ACL configured without "-m" looks at an annotation value
1580+
containing a comma, but that requires more work.
1581+
1582+
1583+
> 2. Supporting custom delimiters in helper responses.
1584+
> I also propose a PR to support a format where tag values can be passed
1585+
> as a list with a custom delimiter:
1586+
> ? ? <key>=<delimiter>"<value1><delimiter><value2>..."
1587+
> For example:
1588+
> ? ? group=,"group1,group2,group3"
1589+
> ? ? clt_con_tag=;"tag1;tag2;tag3"
1590+
> In this PR, the helper response would be tokenized based on the
1591+
> specified custom delimiter, while still supporting delimiter escaping
1592+
> with a backslash (\).
1593+
1594+
I do not think this hack will work well as is, without syntax
1595+
modifications because Squid already uses double quotes specially in this
1596+
context. Overloading quotation meaning would be confusing/wrong.
1597+
1598+
Overall, I am not excited about this hack, but let's start with these
1599+
questions about its scope:
1600+
1601+
* Can the same effect be achieved today by sending a helper response
1602+
containing multiple same-name annotations? For example:
1603+
1604+
group=group1 group=group2 group=group3
1605+
1606+
* If the "note" ACL bug is fixed, do we still need to allow helper to
1607+
use custom value delimiters?
1608+
1609+
* What would Squid do today if it receives a `group=,"a,b"` annotation
1610+
from a helper? AFAICT from looking at
1611+
Helper::Reply::parseResponseKeys(), Squid would silently treat the
1612+
leading comma delimiter as the first character of the received
1613+
annotation value and keep double quotes, right?
1614+
1615+
* Squid does not treat backslashes in annotation values specially today,
1616+
does it? If present, they become part of the annotation key or value, right?
1617+
1618+
1619+
1620+
HTH,
1621+
1622+
Alex.
1623+

squid-dev/2026-April/010018.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
</style>
1414
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
15-
<LINK REL="Previous" HREF="010021.html">
15+
<LINK REL="Previous" HREF="010022.html">
1616
<LINK REL="Next" HREF="010020.html">
1717
</HEAD>
1818
<BODY BGCOLOR="#ffffff">
@@ -23,7 +23,7 @@ <H1>[squid-dev] NO_SPECIAL_HANDLING define for HTTP methods</H1>
2323
</A><BR>
2424
<I>Sun Apr 19 21:35:02 UTC 2026</I>
2525
<P><UL>
26-
<LI>Previous message (by thread): <A HREF="010021.html">[squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas
26+
<LI>Previous message (by thread): <A HREF="010022.html">[squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas
2727
</A></li>
2828
<LI>Next message (by thread): <A HREF="010020.html">[squid-dev] NO_SPECIAL_HANDLING define for HTTP methods
2929
</A></li>
@@ -49,11 +49,12 @@ <H1>[squid-dev] NO_SPECIAL_HANDLING define for HTTP methods</H1>
4949

5050

5151

52+
5253
<!--endarticle-->
5354
<HR>
5455
<P><UL>
5556
<!--threads-->
56-
<LI>Previous message (by thread): <A HREF="010021.html">[squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas
57+
<LI>Previous message (by thread): <A HREF="010022.html">[squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas
5758
</A></li>
5859
<LI>Next message (by thread): <A HREF="010020.html">[squid-dev] NO_SPECIAL_HANDLING define for HTTP methods
5960
</A></li>

squid-dev/2026-April/010020.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ <H1>[squid-dev] NO_SPECIAL_HANDLING define for HTTP methods</H1>
5454
</PRE>
5555

5656

57+
5758
<!--endarticle-->
5859
<HR>
5960
<P><UL>

squid-dev/2026-April/010021.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</style>
1414
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
1515
<LINK REL="Previous" HREF="010019.html">
16-
<LINK REL="Next" HREF="010018.html">
16+
<LINK REL="Next" HREF="010022.html">
1717
</HEAD>
1818
<BODY BGCOLOR="#ffffff">
1919
<H1>[squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas</H1>
@@ -25,7 +25,7 @@ <H1>[squid-dev] Issue with acl note (without -m) splitting helper tokens contain
2525
<P><UL>
2626
<LI>Previous message (by thread): <A HREF="010019.html">[squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas
2727
</A></li>
28-
<LI>Next message (by thread): <A HREF="010018.html">[squid-dev] NO_SPECIAL_HANDLING define for HTTP methods
28+
<LI>Next message (by thread): <A HREF="010022.html">[squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas
2929
</A></li>
3030
<LI> <B>Messages sorted by:</B>
3131
<a href="date.html#10021">[ date ]</a>
@@ -140,13 +140,14 @@ <H1>[squid-dev] Issue with acl note (without -m) splitting helper tokens contain
140140
</I>
141141
</PRE>
142142

143+
143144
<!--endarticle-->
144145
<HR>
145146
<P><UL>
146147
<!--threads-->
147148
<LI>Previous message (by thread): <A HREF="010019.html">[squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas
148149
</A></li>
149-
<LI>Next message (by thread): <A HREF="010018.html">[squid-dev] NO_SPECIAL_HANDLING define for HTTP methods
150+
<LI>Next message (by thread): <A HREF="010022.html">[squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas
150151
</A></li>
151152
<LI> <B>Messages sorted by:</B>
152153
<a href="date.html#10021">[ date ]</a>

squid-dev/2026-April/010022.html

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2+
<HTML>
3+
<HEAD>
4+
<TITLE> [squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas
5+
</TITLE>
6+
<LINK REL="Index" HREF="index.html" >
7+
<LINK REL="made" HREF="mailto:squid-dev%40lists.squid-cache.org?Subject=Re%3A%20%5Bsquid-dev%5D%20Issue%20with%20acl%20note%20%28without%20-m%29%20splitting%20helper%0A%20tokens%20containing%20commas&In-Reply-To=%3C10e9ebca-6fa4-48a9-9082-1c03eb97a792%40measurement-factory.com%3E">
8+
<META NAME="robots" CONTENT="index,nofollow">
9+
<style type="text/css">
10+
pre {
11+
white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */
12+
}
13+
</style>
14+
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
15+
<LINK REL="Previous" HREF="010021.html">
16+
<LINK REL="Next" HREF="010018.html">
17+
</HEAD>
18+
<BODY BGCOLOR="#ffffff">
19+
<H1>[squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas</H1>
20+
<B>Alex Rousskov</B>
21+
<A HREF="mailto:squid-dev%40lists.squid-cache.org?Subject=Re%3A%20%5Bsquid-dev%5D%20Issue%20with%20acl%20note%20%28without%20-m%29%20splitting%20helper%0A%20tokens%20containing%20commas&In-Reply-To=%3C10e9ebca-6fa4-48a9-9082-1c03eb97a792%40measurement-factory.com%3E"
22+
TITLE="[squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas">rousskov at measurement-factory.com
23+
</A><BR>
24+
<I>Mon Apr 20 18:59:14 UTC 2026</I>
25+
<P><UL>
26+
<LI>Previous message (by thread): <A HREF="010021.html">[squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas
27+
</A></li>
28+
<LI>Next message (by thread): <A HREF="010018.html">[squid-dev] NO_SPECIAL_HANDLING define for HTTP methods
29+
</A></li>
30+
<LI> <B>Messages sorted by:</B>
31+
<a href="date.html#10022">[ date ]</a>
32+
<a href="thread.html#10022">[ thread ]</a>
33+
<a href="subject.html#10022">[ subject ]</a>
34+
<a href="author.html#10022">[ author ]</a>
35+
</LI>
36+
</UL>
37+
<HR>
38+
<!--beginarticle-->
39+
<PRE>On 2026-04-17 09:08, Andrey K wrote:
40+
41+
&gt;<i> While working with annotations, I&#8217;ve noticed an inconsistency in how acl
42+
</I>&gt;<i> note (without the -m option) handles tokens received from helpers when
43+
</I>&gt;<i> they contain a comma.
44+
</I>
45+
I think it is important to note that there are several distinct players
46+
here, including:
47+
48+
1. What annotations the helper sends to Squid.
49+
50+
2. How helper response parser converts received helper response into
51+
transaction annotations.
52+
53+
3. How the &quot;note&quot; ACL code interprets transaction annotations.
54+
These annotations may come from sources other than a helper.
55+
56+
57+
&gt;<i> According to the documentation, an ACL like this:
58+
</I>&gt;<i> &#160; &#160; acl staff note group Staff:accountants,lawyers,security
59+
</I>&gt;<i> should match a helper response such as:
60+
</I>&gt;<i> &#160; &#160; group=&quot;Staff:accountants,lawyers,security&quot;
61+
</I>
62+
The above implies that helper response parser should not split group=X
63+
response fields (using comma as a delimiter). Do we document that
64+
anywhere? Did our helper response parser ever split such fields in the past?
65+
66+
BTW, 2015 commit 76ee67ac used a very similar example. AFAICT by looking
67+
at that code, we did not apply value delimiters by default back then
68+
(i.e. when ACL_F_SUBSTRING a.k.a. &quot;-m&quot; flag was not set). The bug was
69+
introduced in 2017 commit 4eac3407 that replaced a possibly-nil
70+
`flags.delimiters()` with a never-nil `&amp;delimiters.value`.
71+
72+
The following comment suggests that we missed the fact that using the
73+
[default-initialized] value &quot;without checking whether the option is
74+
enabled()&quot; is a bug -- the corresponding &quot;trick&quot; never fully worked:
75+
76+
```C++
77+
// TODO: Some callers use .value without checking whether the option is
78+
// enabled(), accessing the (default-initialized or customized) default
79+
// value that way. This trick will stop working if we add valued options
80+
// that can be disabled (e.g., --with-foo=x --without-foo).
81+
```
82+
83+
84+
&gt;<i> However, this is not the case. The helper's response is split into
85+
</I>&gt;<i> tokens using a comma as the default delimiter. As a result, only ACLs
86+
</I>&gt;<i> like the following will match:
87+
</I>&gt;<i> &#160; &#160; acl staff note group lawyers
88+
</I>&gt;<i>
89+
</I>&gt;<i> This behavior occurs because in Acl::NoteCheck::matchNotes(), a comma is
90+
</I>&gt;<i> passed as the default delimiter to the expandListEntries() function
91+
</I>
92+
Agreed.
93+
94+
95+
&gt;<i> I would like to propose two changes:
96+
</I>&gt;<i> 1. Removing the default comma delimiter.
97+
</I>
98+
... and check enabled() before using the stored value, fixing the bug
99+
introduced in 2017 commit 4eac3407.
100+
101+
102+
&gt;<i> I am prepared to submit a simple PR to exclude this comma to fix the
103+
</I>&gt;<i> incorrect matching of strings containing commas.
104+
</I>&gt;<i> However, I realize this might be a breaking change for users who
105+
</I>&gt;<i> currently rely on this implicit splitting behavior.
106+
</I>
107+
Yes. We should disclose the bug fix in Squid release notes.
108+
109+
We can also add code to warn admins (via a cache.log WARNING message)
110+
when a &quot;note&quot; ACL configured without &quot;-m&quot; looks at an annotation value
111+
containing a comma, but that requires more work.
112+
113+
114+
&gt;<i> 2. Supporting custom delimiters in helper responses.
115+
</I>&gt;<i> I also propose a PR to support a format where tag values can be passed
116+
</I>&gt;<i> as a list with a custom delimiter:
117+
</I>&gt;<i> &#160; &#160; &lt;key&gt;=&lt;delimiter&gt;&quot;&lt;value1&gt;&lt;delimiter&gt;&lt;value2&gt;...&quot;
118+
</I>&gt;<i> For example:
119+
</I>&gt;<i> &#160; &#160; group=,&quot;group1,group2,group3&quot;
120+
</I>&gt;<i> &#160; &#160; clt_con_tag=;&quot;tag1;tag2;tag3&quot;
121+
</I>&gt;<i> In this PR, the helper response would be tokenized based on the
122+
</I>&gt;<i> specified custom delimiter, while still supporting delimiter escaping
123+
</I>&gt;<i> with a backslash (\).
124+
</I>
125+
I do not think this hack will work well as is, without syntax
126+
modifications because Squid already uses double quotes specially in this
127+
context. Overloading quotation meaning would be confusing/wrong.
128+
129+
Overall, I am not excited about this hack, but let's start with these
130+
questions about its scope:
131+
132+
* Can the same effect be achieved today by sending a helper response
133+
containing multiple same-name annotations? For example:
134+
135+
group=group1 group=group2 group=group3
136+
137+
* If the &quot;note&quot; ACL bug is fixed, do we still need to allow helper to
138+
use custom value delimiters?
139+
140+
* What would Squid do today if it receives a `group=,&quot;a,b&quot;` annotation
141+
from a helper? AFAICT from looking at
142+
Helper::Reply::parseResponseKeys(), Squid would silently treat the
143+
leading comma delimiter as the first character of the received
144+
annotation value and keep double quotes, right?
145+
146+
* Squid does not treat backslashes in annotation values specially today,
147+
does it? If present, they become part of the annotation key or value, right?
148+
149+
150+
151+
HTH,
152+
153+
Alex.
154+
</PRE>
155+
156+
<!--endarticle-->
157+
<HR>
158+
<P><UL>
159+
<!--threads-->
160+
<LI>Previous message (by thread): <A HREF="010021.html">[squid-dev] Issue with acl note (without -m) splitting helper tokens containing commas
161+
</A></li>
162+
<LI>Next message (by thread): <A HREF="010018.html">[squid-dev] NO_SPECIAL_HANDLING define for HTTP methods
163+
</A></li>
164+
<LI> <B>Messages sorted by:</B>
165+
<a href="date.html#10022">[ date ]</a>
166+
<a href="thread.html#10022">[ thread ]</a>
167+
<a href="subject.html#10022">[ subject ]</a>
168+
<a href="author.html#10022">[ author ]</a>
169+
</LI>
170+
</UL>
171+
172+
<hr>
173+
<a href="https://lists.squid-cache.org/listinfo/squid-dev">More information about the squid-dev
174+
mailing list</a><br>
175+
</body></html>

0 commit comments

Comments
 (0)