Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oidc: move reusable_worfklow_used field to the correct event #16935

Merged
merged 4 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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