]> git.proxmox.com Git - pve-http-server.git/commit
decode_urlencoded: cope with undefined values
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 9 Jul 2019 12:04:42 +0000 (14:04 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 9 Jul 2019 12:25:30 +0000 (14:25 +0200)
commit4a09623bbdb4306ca00685a0f80ce6f05fa42f3b
treeb43a3e594616d43487425a15d3018e1e4afed176
parent88628fd1414cc87c782083734a80b39aa4b806cc
decode_urlencoded: cope with undefined values

Avoids syslog/journal warning like:
>  Use of uninitialized value $v in substitution (s///) at
>  /usr/share/perl5/PVE/APIServer/AnyEvent.pm line 648.

If one passes a "value-less" GET argument to a request, e.g.,
GET /?debug

Besides the fact that this allows us to even use such arguments it
also is a general improvement against a slight "syslog DOS attack",
because anybody can pass such parameters to the '/' page, and all
proxmox daemons providing a API/UI using libpve-http-server-perl
allow to do such requests unauthenticated (which itself is OK, as
else one could not show the login window at all). As each of such
request produces two log lines in the syslog/journal it's far from
ideal.

A simple reproducer of the possible outcome can be seen with the
following shell script using curl:

> PVEURL='127.0.0.1'
> ARGS='?a'; # send multiple args at once to amplify the per-connection cost
> for c in {a..z}; do for i in {0..9}; do ARGS="$ARGS&$c$i"; done; done
> while true; do curl --insecure --silent --output /dev/null "https://$PVEURL:8006$ARGS"; done

Not really bad, but not nice either, as logging is not too cheap this
has some resource usage cost and noise in the syslog is never nice.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/APIServer/AnyEvent.pm