Skip to content

Forbid token auth on /me endpoint #3518

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 2 commits into from
Apr 14, 2021

Conversation

jtgeibel
Copy link
Member

This prohibits access to the /api/v1/me endpoint via an API token. I'd like to merge and deploy this before moving forward on rust-lang/simpleinfra#43, which would expose this endpoint. (Previous lockdown work was done in #3470.)

The second commit ensure that the user is only authenticated on the search endpoint when querying for followed crates.

r? @pietroalbini

I believe we previously had to do authentication at the start of the
endpoint because the database connection was obtained early and there
are lifetime issues around using the `req` value while holding a
database connection.

This avoids authenticating the user (and possibly updating last_used_at
for API tokens) unless the search query requires it.
@Turbo87
Copy link
Member

Turbo87 commented Apr 13, 2021

Are we sure that cargo is not using /me?

@Turbo87 Turbo87 added A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear labels Apr 13, 2021
@pietroalbini
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 14, 2021

📌 Commit 5e4f286 has been approved by pietroalbini

@bors
Copy link
Contributor

bors commented Apr 14, 2021

⌛ Testing commit 5e4f286 with merge e3b38fc...

@bors
Copy link
Contributor

bors commented Apr 14, 2021

☀️ Test successful - checks-actions
Approved by: pietroalbini
Pushing e3b38fc to master...

@bors bors merged commit e3b38fc into rust-lang:master Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants