You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2026/04/14 15:27:44 UTC

(tooling-trusted-releases) branch sbp updated: Do not allow first round podling votes to be sent to private lists

This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/sbp by this push:
     new 051757c8 Do not allow first round podling votes to be sent to private lists
051757c8 is described below

commit 051757c867f4d62ae1f87c4c2f1b8ad639f98ff0
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Tue Apr 14 16:25:57 2026 +0100

    Do not allow first round podling votes to be sent to private lists
---
 atr/api/__init__.py         | 10 +++++++++-
 atr/get/voting.py           |  6 +++++-
 atr/post/voting.py          |  6 +++++-
 atr/storage/writers/vote.py | 10 ++++++++--
 atr/tasks/vote.py           |  6 +++++-
 atr/util.py                 |  7 +++++++
 6 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/atr/api/__init__.py b/atr/api/__init__.py
index fcee20f2..c83b445f 100644
--- a/atr/api/__init__.py
+++ b/atr/api/__init__.py
@@ -1606,7 +1606,15 @@ async def vote_start(
     try:
         async with storage.write(asf_uid) as write:
             wacp = await write.as_project_committee_participant(data.project)
-            permitted_recipients = util.permitted_voting_recipients(asf_uid, wacp.committee_key)
+            async with db.session() as read_data:
+                committee = await read_data.committee(key=wacp.committee_key).demand(
+                    storage.AccessError(f"Committee not found: {wacp.committee_key}")
+                )
+            permitted_recipients = util.permitted_podling_first_round_recipients(
+                asf_uid,
+                wacp.committee_key,
+                is_podling=committee.is_podling,
+            )
             if data.email_to not in permitted_recipients:
                 raise exceptions.Forbidden("Invalid mailing list choice")
 
diff --git a/atr/get/voting.py b/atr/get/voting.py
index f4bf5033..138fa2e7 100644
--- a/atr/get/voting.py
+++ b/atr/get/voting.py
@@ -68,7 +68,11 @@ async def selected_revision(
             case (release, committee):
                 pass
 
-        permitted_recipients = util.permitted_voting_recipients(session.uid, committee.key)
+        permitted_recipients = util.permitted_podling_first_round_recipients(
+            session.uid,
+            committee.key,
+            is_podling=committee.is_podling,
+        )
         second_round_recipients = (
             util.permitted_podling_second_round_recipients(session.uid) if committee.is_podling else []
         )
diff --git a/atr/post/voting.py b/atr/post/voting.py
index 0ef950a3..edd04ca0 100644
--- a/atr/post/voting.py
+++ b/atr/post/voting.py
@@ -94,7 +94,11 @@ async def selected_revision(
             case (release, committee):
                 pass
 
-        permitted_recipients = util.permitted_voting_recipients(session.uid, committee.key)
+        permitted_recipients = util.permitted_podling_first_round_recipients(
+            session.uid,
+            committee.key,
+            is_podling=committee.is_podling,
+        )
         all_addrs = [start_voting_form.email_to, *start_voting_form.email_cc, *start_voting_form.email_bcc]
         for addr in all_addrs:
             if addr not in permitted_recipients:
diff --git a/atr/storage/writers/vote.py b/atr/storage/writers/vote.py
index 349eec37..c72aa02a 100644
--- a/atr/storage/writers/vote.py
+++ b/atr/storage/writers/vote.py
@@ -141,7 +141,7 @@ class CommitteeParticipant(FoundationCommitter):
 
         return [email_to], ""
 
-    async def start(
+    async def start(  # noqa: C901
         self,
         email_to: str,
         project_key: safe.ProjectKey,
@@ -166,8 +166,14 @@ class CommitteeParticipant(FoundationCommitter):
                 _project=True,
                 _committee=True,
             ).demand(storage.AccessError("Release not found"))
+        if release.committee is None:
+            raise storage.AccessError("Release has no committee")
         if permitted_recipients is None:
-            permitted_recipients = util.permitted_voting_recipients(asf_uid, self.__committee_key)
+            permitted_recipients = util.permitted_podling_first_round_recipients(
+                asf_uid,
+                release.committee.key,
+                is_podling=release.committee.is_podling,
+            )
         all_addrs = [email_to] + (email_cc or []) + (email_bcc or [])
         for addr in all_addrs:
             if addr not in permitted_recipients:
diff --git a/atr/tasks/vote.py b/atr/tasks/vote.py
index 916b80a9..697cfa13 100644
--- a/atr/tasks/vote.py
+++ b/atr/tasks/vote.py
@@ -105,7 +105,11 @@ async def _initiate_core_logic(task_args: args.Initiate) -> results.Results | No
     # A second round vote may be started by a different user, so the permitted recipients will be different
     # Since we only have to validate before task boundaries, we can skip this for second rounds
     if not is_podling_round_two:
-        permitted_recipients = util.permitted_voting_recipients(task_args.initiator_id, release.committee.key)
+        permitted_recipients = util.permitted_podling_first_round_recipients(
+            task_args.initiator_id,
+            release.committee.key,
+            is_podling=release.committee.is_podling,
+        )
         for addr in all_addrs:
             if addr not in permitted_recipients:
                 log.error(f"Invalid mailing list choice: {addr} not in {permitted_recipients}")
diff --git a/atr/util.py b/atr/util.py
index df2e3d2e..4ba94be7 100644
--- a/atr/util.py
+++ b/atr/util.py
@@ -803,6 +803,13 @@ def permitted_archive_roots(basename_from_filename: str) -> list[str]:
     return [basename_from_filename]
 
 
+def permitted_podling_first_round_recipients(asf_uid: str, committee_key: str, *, is_podling: bool) -> list[str]:
+    recipients = permitted_voting_recipients(asf_uid, committee_key)
+    if not is_podling:
+        return recipients
+    return [recipient for recipient in recipients if (recipient != f"private@{committee_key}.apache.org")]
+
+
 def permitted_podling_second_round_recipients(asf_uid: str) -> list[str]:
     recipients = [INCUBATOR_GENERAL_ADDRESS]
     if config.get().ATR_STATUS == "ALPHA":


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org