html formatter: encode href attributes

these contain untrusted data, so treat them accordingly.

Reported-by: Li, Jian Tao <li.jiantao@starlabs.sg>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
(cherry picked from commit 6781735008)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2022-05-17 14:48:27 +02:00 committed by Thomas Lamprecht
parent cdaec513e0
commit 00661f1223

View File

@ -91,7 +91,7 @@ sub render_page {
text => 'Home'}};
foreach my $comp (@pcomp) {
$href .= "/$comp";
$href .= "/".encode_entities($comp);
push @$items, { tag => 'li', cn => {
tag => 'a',
href => $href,
@ -214,7 +214,7 @@ PVE::APIServer::Formatter::register_formatter($portal_format, sub {
push @$items, {
tag => 'a',
class => 'list-group-item',
href => "$path/$value",
href => "$path/".encode_entities($value),
cn => [
{
tag => 'h4',