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/08/04 17:32:11 UTC

(tooling-trusted-releases) 01/01: Ensure that submitted download page URLs use ASF subdomains

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

commit 671d6c899c00ef663f4c19750e718c9a5f56b168
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Tue Aug 4 18:31:04 2026 +0100

    Ensure that submitted download page URLs use ASF subdomains
---
 atr/shared/projects.py | 11 ++++++++++-
 atr/util.py            |  4 +++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/atr/shared/projects.py b/atr/shared/projects.py
index 92cafd9c..23357f25 100644
--- a/atr/shared/projects.py
+++ b/atr/shared/projects.py
@@ -343,7 +343,16 @@ class EditMetadataForm(form.Form):
             raise ValueError("A project description is required.")
         return value
 
-    @pydantic.field_validator("homepage", "download_page", mode="after")
+    @pydantic.field_validator("download_page", mode="after")
+    @classmethod
+    def validate_download_page(cls, value: pydantic.HttpUrl | None) -> pydantic.HttpUrl | None:
+        if value is None:
+            raise ValueError("A valid URL is required.")
+        if error := util.download_page_url_error(str(value)):
+            raise ValueError(error)
+        return value
+
+    @pydantic.field_validator("homepage", mode="after")
     @classmethod
     def validate_required_urls(cls, value: pydantic.HttpUrl | None) -> pydantic.HttpUrl | None:
         if value is None:
diff --git a/atr/util.py b/atr/util.py
index 1a9b5020..93af6cb6 100644
--- a/atr/util.py
+++ b/atr/util.py
@@ -731,7 +731,9 @@ def download_page_url_error(url: str) -> str | None:
     try:
         ipaddress.ip_address(parts.hostname)
     except ValueError:
-        return None
+        if parts.hostname.endswith(".apache.org"):
+            return None
+        return "Must be a subdomain of apache.org"
     return "Must not use a literal IP address"
 
 


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