MEDIUM: vars: make the ifexist variant of set-var only apply to the proc scope
authorWilly Tarreau <w@1wt.eu>
Tue, 7 Sep 2021 12:24:07 +0000 (14:24 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 8 Sep 2021 09:47:06 +0000 (11:47 +0200)
commit7978c5c42204adb9fa0d9c57c9288c579691482a
treebb40f5d64e1d0de0981d840d9830996cbb534566
parentf1cb0ebe3e8761e0fa8a622e270259351bd56fad
MEDIUM: vars: make the ifexist variant of set-var only apply to the proc scope

When setting variables, there are currently two variants, one which will
always create the variable, and another one, "ifexist", which will only
create or update a variable if a similarly named variable in any scope
already existed before.

The goal was to limit the risk of injecting random names in the proc
scope, but it was achieved by making use of the somewhat limited name
indexing model, which explains the scope-agnostic restriction.

With this change, we're moving the check downwards in the chain, at the
variable level, and only variables under the scope "proc" will be subject
to the restriction. A new set of VF_* flags was added to adjust how
variables are set, and VF_UPDATEONLY is used to mention this restriction.

In this exact state of affairs, this is not completely exact, as if a
similar name was not known in any scope, the variable will continue to
be rejected like before, but this will change soon.
doc/SPOE.txt
doc/lua-api/index.rst
include/haproxy/vars-t.h
src/vars.c