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/05/06 16:24:51 UTC

(tooling-trusted-releases) branch altera updated (ce4a17fd -> 326f646b)

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

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


 discard ce4a17fd Warn when OpenPGP keys are uploaded for a different or unknown user
 discard 300197d0 Fix problems associated with manual vote mode
     add f9a074b9 Add the request ID to error messages
     add ef9c4393 Allow https URLs in Apache License 2.0 text, per ASF policy
     new 51f624d5 Fix problems associated with manual vote mode
     new 326f646b Warn when OpenPGP keys are uploaded for a different or unknown user

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (ce4a17fd)
            \
             N -- N -- N   refs/heads/altera (326f646b)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 atr/blueprints/api.py             |  1 +
 atr/docs/checks.md                |  2 +-
 atr/errors.py                     |  3 ++
 atr/get/root.py                   |  8 ++++-
 atr/log.py                        | 14 +++++++++
 atr/server.py                     | 66 ++++++++++++++++++++++++++++++---------
 atr/tasks/checks/license.py       | 14 +++++++--
 atr/templates/error.html          | 12 +++++--
 atr/templates/notfound.html       | 12 +++++--
 tests/unit/test_checks_license.py | 13 ++++++++
 10 files changed, 120 insertions(+), 25 deletions(-)


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


(tooling-trusted-releases) 02/02: Warn when OpenPGP keys are uploaded for a different or unknown user

Posted by sb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 326f646b6b80b6da61d9e8747d0ec693d119b59d
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Wed May 6 16:17:35 2026 +0100

    Warn when OpenPGP keys are uploaded for a different or unknown user
---
 atr/post/keys.py             | 30 ++++++++++++++++++++
 tests/unit/test_keys_post.py | 66 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+)

diff --git a/atr/post/keys.py b/atr/post/keys.py
index 601dc256..a822f6fa 100644
--- a/atr/post/keys.py
+++ b/atr/post/keys.py
@@ -91,6 +91,7 @@ async def add(
                 await quart.flash(str(p), "warning")
             else:
                 await quart.flash(f"OpenPGP key {fingerprint_upper} added successfully.", "success")
+            await _flash_openpgp_key_uid_warning(key.key_model, session.asf_uid)
 
     except PrivateKeyUploadError:
         await quart.flash(util.PRIVATE_KEY_UPLOAD_WARNING, "error")
@@ -336,6 +337,35 @@ async def _fetch_keys_from_url(keys_url: str) -> str:
         raise base.ASFQuartException(f"Network error while fetching keys: {e}", errorcode=503)
 
 
+async def _flash_openpgp_key_uid_warning(key_model: sql.PublicSigningKey, current_asf_uid: str) -> None:
+    warning = _openpgp_key_uid_warning(key_model, current_asf_uid)
+    if warning is not None:
+        await quart.flash(str(warning), "warning")
+
+
+def _openpgp_key_uid_warning(key_model: sql.PublicSigningKey, current_asf_uid: str) -> htm.Element | None:
+    fingerprint_upper = key_model.fingerprint.upper()
+    if key_model.apache_uid is None:
+        details_url = util.as_url(get.keys.details, fingerprint=key_model.fingerprint)
+        return htm.p[
+            f"OpenPGP key {fingerprint_upper} was uploaded and associated, but ATR could not determine an ASF UID "
+            "from the key user IDs. ",
+            htm.a(href=details_url)["Review key details"],
+            ".",
+        ]
+
+    if key_model.apache_uid.lower() != current_asf_uid.lower():
+        details_url = util.as_url(get.keys.details, fingerprint=key_model.fingerprint)
+        return htm.p[
+            f"OpenPGP key {fingerprint_upper} was uploaded and associated, but it appears to belong to ASF UID "
+            f"{key_model.apache_uid}, not {current_asf_uid}. ",
+            htm.a(href=details_url)["Review key details"],
+            ".",
+        ]
+
+    return None
+
+
 async def _process_keys(keys_text: str, selected_committee: str) -> str:
     """Process keys text and associate with committee."""
     if util.contains_private_key_text(keys_text):
diff --git a/tests/unit/test_keys_post.py b/tests/unit/test_keys_post.py
new file mode 100644
index 00000000..cd5c2054
--- /dev/null
+++ b/tests/unit/test_keys_post.py
@@ -0,0 +1,66 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import datetime
+
+import pytest
+
+import atr.models.sql as sql
+import atr.post.keys as keys
+
+
+def test_openpgp_key_uid_warning_allows_matching_asf_uid() -> None:
+    warning = keys._openpgp_key_uid_warning(_public_key(apache_uid="alice"), "Alice")
+
+    assert warning is None
+
+
+def test_openpgp_key_uid_warning_flags_missing_asf_uid(monkeypatch: pytest.MonkeyPatch) -> None:
+    monkeypatch.setattr(keys.util, "as_url", lambda *_args, **_kwargs: "/keys/details/fp")
+
+    warning = keys._openpgp_key_uid_warning(_public_key(apache_uid=None), "alice")
+
+    assert warning is not None
+    warning_html = str(warning)
+    assert "could not determine an ASF UID" in warning_html
+    assert "/keys/details/fp" in warning_html
+
+
+def test_openpgp_key_uid_warning_flags_other_asf_uid(monkeypatch: pytest.MonkeyPatch) -> None:
+    monkeypatch.setattr(keys.util, "as_url", lambda *_args, **_kwargs: "/keys/details/fp")
+
+    warning = keys._openpgp_key_uid_warning(_public_key(apache_uid="bob"), "alice")
+
+    assert warning is not None
+    warning_html = str(warning)
+    assert "appears to belong to ASF UID bob, not alice" in warning_html
+    assert "/keys/details/fp" in warning_html
+
+
+def _public_key(apache_uid: str | None) -> sql.PublicSigningKey:
+    return sql.PublicSigningKey(
+        fingerprint="fp",
+        algorithm=1,
+        length=4096,
+        created=datetime.datetime.now(datetime.UTC),
+        latest_self_signature=None,
+        expires=None,
+        primary_declared_uid="Alice <al...@example.org>",
+        secondary_declared_uids=[],
+        apache_uid=apache_uid,
+        ascii_armored_key="-----BEGIN PGP PUBLIC KEY BLOCK-----\nbody\n-----END PGP PUBLIC KEY BLOCK-----\n",
+    )


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


(tooling-trusted-releases) 01/02: Fix problems associated with manual vote mode

Posted by sb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 51f624d57b7d171a31c8e4dad91c4cd1f449d475
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Wed May 6 15:46:30 2026 +0100

    Fix problems associated with manual vote mode
---
 atr/get/manual.py                  |  4 ++-
 atr/get/vote.py                    | 13 +++++++
 tests/unit/test_vote_rendering.py  | 74 ++++++++++++++++++++++++++++++++++++++
 tests/unit/test_vote_resolution.py |  4 +++
 4 files changed, 94 insertions(+), 1 deletion(-)

diff --git a/atr/get/manual.py b/atr/get/manual.py
index 63b2e8c3..0ec5d8bf 100644
--- a/atr/get/manual.py
+++ b/atr/get/manual.py
@@ -162,7 +162,9 @@ async def _render_resolve_page(release: sql.Release) -> htm.Element:
     page.p[
         "This is a manual vote resolution. "
         "Provide the vote thread URL and the URL of the thread where you posted the result. "
-        "For a cancellation, provide the URL of the thread where you sent the cancellation notice."
+        "For a cancellation, provide the URL of the thread where you sent the cancellation notice. "
+        "ATR uses these URLs only to verify that both threads belong to the same mailing list, "
+        "and does not store them."
     ]
 
     await form.render_block(
diff --git a/atr/get/vote.py b/atr/get/vote.py
index 34c4b280..ed0aa8c0 100644
--- a/atr/get/vote.py
+++ b/atr/get/vote.py
@@ -589,6 +589,10 @@ async def _render_section_vote(
     if release.committee is None:
         raise ValueError("Release has no committee")
 
+    if release.effective_vote_mode == sql.VoteMode.MANUAL:
+        _render_vote_manual(page)
+        return
+
     vote_recipient = _vote_recipient(release, latest_vote_task)
     if user_category == UserCategory.UNAUTHENTICATED:
         _render_vote_unauthenticated(page, release, archive_url, vote_recipient)
@@ -716,6 +720,15 @@ def _render_vote_delivery(
         page.p["Your vote will be sent to ", htpy.code[vote_recipient], "."]
 
 
+def _render_vote_manual(page: htm.Block) -> None:
+    page.div(".alert.alert-info", role="alert")[
+        htpy.i(".bi.bi-info-circle.me-2"),
+        "This release uses manual voting. The vote thread is hosted on the project mailing list, ",
+        "and ATR cannot record votes or display the thread for it. ",
+        "To participate, reply to the vote thread directly on the mailing list.",
+    ]
+
+
 def _render_vote_unauthenticated(
     page: htm.Block,
     release: sql.Release,
diff --git a/tests/unit/test_vote_rendering.py b/tests/unit/test_vote_rendering.py
index 87ade232..e0a5b09d 100644
--- a/tests/unit/test_vote_rendering.py
+++ b/tests/unit/test_vote_rendering.py
@@ -28,6 +28,7 @@ import sqlmodel
 
 import atr.db as db
 import atr.db.interaction as interaction
+import atr.get.projects as projects
 import atr.get.vote as vote
 import atr.htm as htm
 import atr.models.results as results
@@ -272,6 +273,55 @@ async def test_latest_ballot_for_voter_uses_highest_id_not_timestamp(sqlite_sess
     assert found.receipt_message_id == "highest-id@apache.org"
 
 
+@pytest.mark.asyncio
+async def test_manual_mode_authenticated_renders_notice_and_no_cast_form(
+    render_app: quart.Quart, monkeypatch: pytest.MonkeyPatch
+) -> None:
+    await _patch_render_dependencies(monkeypatch)
+
+    async with render_app.test_request_context("/vote/project/1.0.0"):
+        page = htm.Block()
+        await vote._render_section_vote(
+            page,
+            _release(sql.VoteMode.MANUAL),
+            _session(),
+            vote.UserCategory.PMC_MEMBER_RM,
+            None,
+            None,
+        )
+
+    html = str(page.collect())
+    assert "This release uses manual voting." in html
+    assert "reply to the vote thread directly" in html
+    assert "<textarea" not in html
+    assert 'name="vote_seq"' not in html
+    assert 'name="decision"' not in html
+    assert "Submit vote" not in html
+
+
+@pytest.mark.asyncio
+async def test_manual_mode_unauthenticated_renders_notice_without_archive_message(
+    render_app: quart.Quart, monkeypatch: pytest.MonkeyPatch
+) -> None:
+    await _patch_render_dependencies(monkeypatch)
+
+    async with render_app.test_request_context("/vote/project/1.0.0"):
+        page = htm.Block()
+        await vote._render_section_vote(
+            page,
+            _release(sql.VoteMode.MANUAL),
+            None,
+            vote.UserCategory.UNAUTHENTICATED,
+            None,
+            None,
+        )
+
+    html = str(page.collect())
+    assert "This release uses manual voting." in html
+    assert "The vote thread archive is not yet available" not in html
+    assert "Log in to vote" not in html
+
+
 def test_message_id_source_archive_url_encodes_message_id_and_listid() -> None:
     url = shared.vote.message_id_source_archive_url(
         "CAA9ykM+bMPNk=BOF@apache.org",
@@ -284,6 +334,30 @@ def test_message_id_source_archive_url_encodes_message_id_and_listid() -> None:
     )
 
 
+def test_non_podling_vote_mode_radios_includes_manual() -> None:
+    project = SimpleNamespace(
+        committee=SimpleNamespace(is_podling=False),
+        policy_vote_mode=sql.VoteMode.EMAIL,
+    )
+
+    html = str(projects._vote_mode_radios(project))
+
+    assert 'value="manual"' in html
+
+
+def test_podling_vote_mode_radios_omits_manual() -> None:
+    project = SimpleNamespace(
+        committee=SimpleNamespace(is_podling=True),
+        policy_vote_mode=sql.VoteMode.EMAIL,
+    )
+
+    html = str(projects._vote_mode_radios(project))
+
+    assert 'value="email"' in html
+    assert 'value="trusted"' in html
+    assert 'value="manual"' not in html
+
+
 @pytest.mark.asyncio
 async def test_trusted_rendering_with_current_vote_seq_none_does_not_query_ballots(
     render_app: quart.Quart, monkeypatch: pytest.MonkeyPatch
diff --git a/tests/unit/test_vote_resolution.py b/tests/unit/test_vote_resolution.py
index 21d3a1f9..a87a521d 100644
--- a/tests/unit/test_vote_resolution.py
+++ b/tests/unit/test_vote_resolution.py
@@ -308,6 +308,9 @@ async def test_manual_passed_creates_preview_revision() -> None:
     assert release.vote_resolved is not None
     assert success == "Vote marked as passed"
     write_as.revision.create_revision_with_quarantine.assert_awaited_once()
+    revision_call = write_as.revision.create_revision_with_quarantine.await_args
+    assert revision_call is not None
+    assert revision_call.kwargs["allowed_phases"] == frozenset({sql.ReleasePhase.RELEASE_PREVIEW})
 
 
 @pytest.mark.asyncio
@@ -339,6 +342,7 @@ async def test_manual_resolve_page_explains_cancellation_notice_url(
     assert "manual vote resolution" in html
     assert "where you posted the result" in html
     assert "cancellation notice" in html
+    assert "does not store them" in html
 
 
 @pytest.mark.asyncio


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