* [pmg-devel] [PATCH pmg-api] schema: fix verification for transport-domain-or-nexthop type
@ 2025-04-24 11:34 Fiona Ebner
2025-04-28 12:23 ` [pmg-devel] applied: " Stoiko Ivanov
0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2025-04-24 11:34 UTC (permalink / raw)
To: pmg-devel
Since pmg_verify_transport_address() is called with $noerr set, it
will not die on failure. Make sure that the verification method does
not quietly accept an invalid value in this case by making sure the
code for failure is also executed in this scenario, i.e. moving it
out of the 'else' branch.
As reported in the community forum [0], this could case issues when a
CIDR is specified instead of an IP or domain name for TLS destination
policy, which is not intended.
[0]: https://forum.proxmox.com/threads/165167/
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PMG/Config.pm | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
index 82bd42e..0a5dff0 100644
--- a/src/PMG/Config.pm
+++ b/src/PMG/Config.pm
@@ -1141,10 +1141,11 @@ sub pmg_verify_transport_domain_or_nexthop {
$nexthop = $1;
}
return $name if pmg_verify_transport_address($nexthop, 1);
- } else {
- return undef if $noerr;
- die "value does not look like a valid domain or next-hop\n";
+ # else fall through, because it is a failure
}
+
+ return undef if $noerr;
+ die "value does not look like a valid domain or next-hop\n";
}
sub read_tls_policy {
--
2.39.5
_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pmg-devel] applied: [PATCH pmg-api] schema: fix verification for transport-domain-or-nexthop type
2025-04-24 11:34 [pmg-devel] [PATCH pmg-api] schema: fix verification for transport-domain-or-nexthop type Fiona Ebner
@ 2025-04-28 12:23 ` Stoiko Ivanov
0 siblings, 0 replies; 2+ messages in thread
From: Stoiko Ivanov @ 2025-04-28 12:23 UTC (permalink / raw)
To: Fiona Ebner; +Cc: pmg-devel
Hi,
Thanks for tackling this and identifying the issue!
gave it a quick spin on my test-setup and applied the patch!
On Thu, 24 Apr 2025 13:34:51 +0200
Fiona Ebner <f.ebner@proxmox.com> wrote:
> Since pmg_verify_transport_address() is called with $noerr set, it
> will not die on failure. Make sure that the verification method does
> not quietly accept an invalid value in this case by making sure the
> code for failure is also executed in this scenario, i.e. moving it
> out of the 'else' branch.
>
> As reported in the community forum [0], this could case issues when a
> CIDR is specified instead of an IP or domain name for TLS destination
> policy, which is not intended.
>
> [0]: https://forum.proxmox.com/threads/165167/
>
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> src/PMG/Config.pm | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
> index 82bd42e..0a5dff0 100644
> --- a/src/PMG/Config.pm
> +++ b/src/PMG/Config.pm
> @@ -1141,10 +1141,11 @@ sub pmg_verify_transport_domain_or_nexthop {
> $nexthop = $1;
> }
> return $name if pmg_verify_transport_address($nexthop, 1);
> - } else {
> - return undef if $noerr;
> - die "value does not look like a valid domain or next-hop\n";
> + # else fall through, because it is a failure
> }
> +
> + return undef if $noerr;
> + die "value does not look like a valid domain or next-hop\n";
> }
>
> sub read_tls_policy {
_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-28 12:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-24 11:34 [pmg-devel] [PATCH pmg-api] schema: fix verification for transport-domain-or-nexthop type Fiona Ebner
2025-04-28 12:23 ` [pmg-devel] applied: " Stoiko Ivanov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal