Skip to content

Commit

Permalink
oidc: move reusable_worfklow_used field to the correct event (pypi#16935
Browse files Browse the repository at this point in the history
)

Co-authored-by: Mike Fiedler <miketheman@gmail.com>
  • Loading branch information
woodruffw and miketheman authored Oct 22, 2024
1 parent d1c002e commit 7405bda
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion tests/unit/forklift/test_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3401,7 +3401,6 @@ def test_upload_succeeds_creates_release(
if not test_with_user
else None
),
"reusable_worfklow_used": False, # This is tested in oidc.test_views
"uploaded_via_trusted_publisher": not test_with_user,
}

Expand Down
1 change: 1 addition & 0 deletions tests/unit/oidc/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ def find_service(iface, **kw):
"expires": 900,
"publisher_name": "GitHub",
"publisher_url": "https://fake/url",
"reusable_workflow_used": False,
},
)
]
Expand Down
8 changes: 0 additions & 8 deletions warehouse/forklift/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
from warehouse.forklift.forms import UploadForm, _filetype_extension_mapping
from warehouse.macaroons.models import Macaroon
from warehouse.metrics import IMetricsService
from warehouse.oidc.views import is_from_reusable_workflow
from warehouse.packaging.interfaces import IFileStorage, IProjectService
from warehouse.packaging.metadata_verification import verify_email, verify_url
from warehouse.packaging.models import (
Expand Down Expand Up @@ -897,13 +896,6 @@ def file_upload(request):
if request.oidc_publisher
else None
),
"reusable_worfklow_used": (
is_from_reusable_workflow(
request.oidc_publisher, request.oidc_claims
)
if request.oidc_publisher
else False
),
"uploaded_via_trusted_publisher": bool(request.oidc_publisher),
},
)
Expand Down
1 change: 1 addition & 0 deletions warehouse/oidc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ def mint_token(
"expires": expires_at,
"publisher_name": publisher.publisher_name,
"publisher_url": publisher.publisher_url(),
"reusable_workflow_used": is_from_reusable_workflow(publisher, claims),
},
)

Expand Down

0 comments on commit 7405bda

Please sign in to comment.