]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: log: fix lf_expr_postcheck() behavior with default section
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 11 Jun 2024 08:15:36 +0000 (10:15 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 11 Jun 2024 09:00:05 +0000 (11:00 +0200)
commite4f122f3f46ff7b6e28f3599e8ec2006e2caac37
tree5f1c37854125c4880606071b843583f729a9df61
parentcbc8e1394da9acb215463de717dcc8ced798ee88
BUG/MEDIUM: log: fix lf_expr_postcheck() behavior with default section

Since 7a21c3a4ef ("MAJOR: log: implement proper postparsing for logformat
expressions"), logformat expressions stored in a default section are not
postchecked anymore. This is because the REGISTER_POST_PROXY_CHECK() only
evaluates regular proxies. Because of this, proxy options which are
automatically enabled on the proxy depending on the logformat expression
features in use are not set on the default proxy, which means such options
are not passed to the regular proxies that inherit from it (proxies that
and will actually be running the logformat expression during runtime).

Because of that, a logformat expression stored inside a default section
and executed by a regular proxy may not behave properly. Also, since
03ca16f38b ("OPTIM: log: resolve logformat options during postparsing"),
it's even worse because logformat node options postresoving is also
skipped, which may also alter logformat expression encoding feature.

To fix the issue, let's add a special case for default proxies in
parse_logformat_string() and lf_expr_postcheck() so that default proxies
are postchecked on the fly during parsing time in a "relaxed" way as we
cannot assume that the features involved in the logformat expression won't
be compatible with the proxy actually running it since we may have
different types of proxies inheriting from the same default section.

This bug was discovered while trying to address GH #2597.

It should be backported to 3.0 with 7a21c3a4ef and 03ca16f38b.
src/log.c