Skip to content

Revert "Return Macaroon alongside User in `MacaroonSecurityPolicy… #15588

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

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

di
Copy link
Member

@di di commented Mar 13, 2024

….identity` (#15581)"

This reverts commit 862a451.

I believe this is the cause of #15586 and possibly pypi/support#3740.

cc @facutuesca @woodruffw

@di di requested a review from a team as a code owner March 13, 2024 22:37
@di di enabled auto-merge (squash) March 13, 2024 22:41
@di di merged commit 5eba9cb into pypi:main Mar 13, 2024
@di di deleted the revert/15581 branch March 13, 2024 22:42
@di
Copy link
Member Author

di commented Mar 13, 2024

Looks like this is failing here, when creating a new project:

if not request.user:
raise _exc_with_message(
HTTPBadRequest,
(
"Non-user identities cannot create new projects. "
"This was probably caused by successfully using a pending "
"publisher but specifying the project name incorrectly (either "
"in the publisher or in your project's metadata). Please ensure "
"that both match. "
"See: https://docs.pypi.org/trusted-publishers/troubleshooting/"
),
)

@di
Copy link
Member Author

di commented Mar 13, 2024

And here when uploading a new release to an existing project:

if not isinstance(request.identity, User):
return Failure("token with user restriction without a user")

@di
Copy link
Member Author

di commented Mar 13, 2024

(Both with account-wide API tokens)

@webknjaz
Copy link
Member

xref pypa/gh-action-pypi-publish#222

@woodruffw
Copy link
Member

Thanks for the ping, sorry for the headache here. I totally forgot about those instance checks; will look into a more complete patch now.

(And thanks @webknjaz for triaging on your end!)

woodruffw added a commit to woodruffw-forks/warehouse that referenced this pull request Mar 14, 2024
@woodruffw
Copy link
Member

Opened #15590 as a draft for this, looking at tests now 🙂

di pushed a commit that referenced this pull request Mar 20, 2024
* Revert "Revert "Return `Macaroon` alongside `User` in `MacaroonSecurityPolicy.identity` (#15581)" (#15588)"

This reverts commit 5eba9cb.

* warehouse: add UserTokenContext checks

* warehouse: reformat, circular import

* tests: coverage

* tests: reformat

* warehouse: remove UserTokenContext.id

Eliminate the line that needed it.

* accounts/utils: lintage

* test_legacy: backstop behavior

Signed-off-by: William Woodruff <[email protected]>

* tests/unit: lintage

---------

Signed-off-by: William Woodruff <[email protected]>
javanlacerda pushed a commit to javanlacerda/warehouse that referenced this pull request Mar 25, 2024
* Revert "Revert "Return `Macaroon` alongside `User` in `MacaroonSecurityPolicy.identity` (pypi#15581)" (pypi#15588)"

This reverts commit 5eba9cb.

* warehouse: add UserTokenContext checks

* warehouse: reformat, circular import

* tests: coverage

* tests: reformat

* warehouse: remove UserTokenContext.id

Eliminate the line that needed it.

* accounts/utils: lintage

* test_legacy: backstop behavior

Signed-off-by: William Woodruff <[email protected]>

* tests/unit: lintage

---------

Signed-off-by: William Woodruff <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants