public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [PATCH pmg-api] quarantine: link generate call:  restrict link to relay domains
Date: Mon,  8 Jun 2026 16:01:31 +0200	[thread overview]
Message-ID: <20260608140136.687820-1-s.ivanov@proxmox.com> (raw)

both when using the send quarantine link functionality before logging
in, as well as when sending out reports to users, we verify that the
e-mail address is internal (in the sense of being an address inside
one of the relay domains).

while allowing this for all addresses could make sense in certain
use-cases (e.g. making some mail-content available to an external
contact, without sending it via SMTP on the public internet), treat it
as an error for now - relaxing the constraint on the address later is
always possible, restricting it might brake the workflow of some
users.

follows commit:
 2d3a8a50 ("fix #3414: quarantine: add API to get a login link for a mail")

minimally tested with `pmgsh get /quarantine/link -mail` with relayed
and external addresses.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/PMG/API2/Quarantine.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/PMG/API2/Quarantine.pm b/src/PMG/API2/Quarantine.pm
index 6f88ddee..eb31be77 100644
--- a/src/PMG/API2/Quarantine.pm
+++ b/src/PMG/API2/Quarantine.pm
@@ -1723,7 +1723,16 @@ __PACKAGE__->register_method({
 
         my $cfg = PMG::Config->new();
 
-        my ($link) = build_quarantine_link($cfg, $param->{mail});
+        my $domains = PVE::INotify::read_file('domains');
+        my $domainregex = PMG::Utils::domain_regex([keys %$domains]);
+
+        my $receiver = $param->{mail};
+
+        raise_param_exc({
+            mail => "link generation only allowed for address inside relay domains" })
+            if ($receiver !~ $domainregex);
+
+        my ($link) = build_quarantine_link($cfg, $receiver);
 
         return { link => $link };
     },
-- 
2.47.3





                 reply	other threads:[~2026-06-08 14:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260608140136.687820-1-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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