2828if typing .TYPE_CHECKING :
2929 from sqlalchemy .orm import Session
3030
31+ from warehouse .oidc .services import OIDCPublisherService
32+
3133GITHUB_OIDC_ISSUER_URL = "https://token.actions.githubusercontent.com"
3234
3335# This expression matches the workflow filename component of a GitHub
@@ -152,6 +154,18 @@ def _check_sub(
152154 return f"{ org } :{ repo } " .lower () == ground_truth .lower ()
153155
154156
157+ def _check_event_name (
158+ ground_truth : str , signed_claim : str , _all_signed_claims : SignedClaims , ** kwargs
159+ ) -> bool :
160+ # Log the event name
161+ publisher_service : OIDCPublisherService = kwargs ["publisher_service" ]
162+ publisher_service .metrics .increment (
163+ "warehouse.oidc.claim" , tags = ["publisher:GitHub" , f"event_name:{ signed_claim } " ]
164+ )
165+ # Always permit all event names for now
166+ return True
167+
168+
155169class GitHubPublisherMixin :
156170 """
157171 Common functionality for both pending and concrete GitHub OIDC publishers.
@@ -170,6 +184,7 @@ class GitHubPublisherMixin:
170184 "repository_owner_id" : check_claim_binary (str .__eq__ ),
171185 "job_workflow_ref" : _check_job_workflow_ref ,
172186 "jti" : check_existing_jti ,
187+ "event_name" : _check_event_name ,
173188 }
174189
175190 __required_unverifiable_claims__ : set [str ] = {"ref" , "sha" }
@@ -186,7 +201,6 @@ class GitHubPublisherMixin:
186201 "run_attempt" ,
187202 "head_ref" ,
188203 "base_ref" ,
189- "event_name" ,
190204 "ref_type" ,
191205 "repository_id" ,
192206 "workflow" ,
@@ -275,6 +289,11 @@ def jti(self) -> str:
275289 """Placeholder value for JTI."""
276290 return "placeholder"
277291
292+ @property
293+ def event_name (self ) -> str :
294+ """Placeholder value for event_name (not used)"""
295+ return "placeholder"
296+
278297 def publisher_url (self , claims : SignedClaims | None = None ) -> str :
279298 base = self .publisher_base_url
280299 sha = claims .get ("sha" ) if claims else None
0 commit comments