You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ar...@apache.org on 2026/03/12 14:40:38 UTC

(tooling-trusted-releases) branch arm updated (baaf563f -> 3f1e8035)

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

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


 discard baaf563f #676 Validate exp and nbp when loading pydantic model for Github token.
     new 3f1e8035 #676 Validate exp and nbp when loading pydantic model for Github token.

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   (baaf563f)
            \
             N -- N -- N   refs/heads/arm (3f1e8035)

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 1 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/models/github.py              | 4 ++--
 tests/unit/test_checks_compare.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)


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


(tooling-trusted-releases) 01/01: #676 Validate exp and nbp when loading pydantic model for Github token.

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

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

commit 3f1e803582f63c430f865a692631a5aa6e26b066
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Thu Mar 12 14:32:51 2026 +0000

    #676 Validate exp and nbp when loading pydantic model for Github token.
---
 atr/models/github.py              | 20 ++++++++++++++++++++
 tests/unit/test_checks_compare.py |  2 +-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/atr/models/github.py b/atr/models/github.py
index d20ac73f..0797d139 100644
--- a/atr/models/github.py
+++ b/atr/models/github.py
@@ -17,6 +17,10 @@
 
 from __future__ import annotations
 
+import time
+
+import pydantic
+
 from . import schema
 
 
@@ -51,3 +55,19 @@ class TrustedPublisherPayload(schema.Subset):
     workflow: str
     workflow_ref: str
     workflow_sha: str
+
+    @pydantic.field_validator("exp")
+    @classmethod
+    def _validate_exp(cls, value: int) -> int:
+        now = int(time.time())
+        if now > value:
+            raise ValueError("Token has expired")
+        return value
+
+    @pydantic.field_validator("nbf")
+    @classmethod
+    def _validate_nbf(cls, value: int | None) -> int | None:
+        now = int(time.time())
+        if value and now < value:
+            raise ValueError("Token not yet valid")
+        return value
diff --git a/tests/unit/test_checks_compare.py b/tests/unit/test_checks_compare.py
index b608241d..4de719a9 100644
--- a/tests/unit/test_checks_compare.py
+++ b/tests/unit/test_checks_compare.py
@@ -871,7 +871,7 @@ def _make_payload(
         "enterprise": "",
         "enterprise_id": "",
         "event_name": "push",
-        "exp": 1,
+        "exp": 99999999999,
         "head_ref": "",
         "iat": 1,
         "iss": "issuer",


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