mirror of
https://git.proxmox.com/git/pve-http-server
synced 2025-04-30 13:55:11 +00:00
proxy request: assert that API url starts with a slash
We implicitly assume that to be the case when assembling the target URL, so assert it explicitly as it's user controlled input. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Originally-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
f325788131
commit
42bb4f3725
@ -691,6 +691,14 @@ sub proxy_request {
|
||||
eval {
|
||||
my $target;
|
||||
my $keep_alive = 1;
|
||||
|
||||
# stringify URI object and verify it starts with a slash
|
||||
$uri = "$uri";
|
||||
if ($uri !~ m@^/@) {
|
||||
$self->error($reqstate, 400, "invalid proxy uri");
|
||||
return;
|
||||
}
|
||||
|
||||
if ($host eq 'localhost') {
|
||||
$target = "http://$host:85$uri";
|
||||
# keep alive for localhost is not worth (connection setup is about 0.2ms)
|
||||
|
Loading…
Reference in New Issue
Block a user