]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: acl: add extra diagnostics about suspicious string patterns
authorWilly Tarreau <w@1wt.eu>
Sat, 3 Feb 2024 10:55:26 +0000 (11:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 3 Feb 2024 11:08:11 +0000 (12:08 +0100)
commit52cc45dfa5bb9db69697a2dc98d6fcc3216addb9
treebef781b0194726326e8c857f8e42969578429ba2
parent75d64c0d4c9c3efb0e0c9048175231887460e8af
MINOR: acl: add extra diagnostics about suspicious string patterns

As noticed in this thread, some bogus configurations are not always easy
to spot: https://www.mail-archive.com/haproxy@formilux.org/msg44558.html
Here it was about config keywords being used in ACL patterns where strings
were expected, hence they're always valid.

Since we have the diag mode (-dD) we can perform some extra checks when
it's used, and emit them to suggest the user there might be an issue.

Here we detect a few common words (logic such as "and"/"or"/"||" etc),
C++/JS comments mistakenly used to try to isolate final args, and words
that have the exact name of a sample fetch or an ACL keyword. These checks
are only done in diag mode of course.
src/acl.c