Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What:
This PR changes the
GET /auth/mapping
endpoint so that if no username is supplied in the query args, Arborist will fall back to the JWT and get the username from there if present.This related revproxy PR uc-cdis/cloud-automation#1006 exposes
GET /auth/mapping
(and only GET--not POST) but does not pass the username qp to Arborist.This related windmill PR uc-cdis/data-portal#592 hits the endpoint via the proxy.
Why:
We expose
GET /auth/mapping
so that Windmill can hit it and get the logged-in user’s authz info, but we do not pass the username arg (and do not expose POST) to prevent users checking other users’ access. We do not just check the jwt in Arborist because other services need to hit this without a jwt.So now Windmill will be able to hit
GET /auth/mapping
with the user’s jwt,/auth/mapping
will remain secure against users checking other users’ access, and other gen3 services will still be able to hit/auth/mapping
without a jwt.This does lead to the following funny behavior if a logged-in user A tries to see another user B’s auth mapping: 1. user A hits
commons-url/authz/mapping?username=user-B@email.com
; 2. revproxy strips the username arg and hits Arborist’sGET /auth/mapping
endpoint; 3. Arborist sees no username qp, checks the jwt, gets user A’s username, and returns user A’s auth mapping; 4. user A probably thinks that they successfully got user B’s mapping and that it happens to be identical to their own.tldr
commons-url/authz/mapping
with or without username arg—gets 400 user does not existcommons-url/authz/mapping
with or without username arg—gets own access mappingcommons-url/authz/mapping
with method other than GET—gets 403 forbidden by nginxNew Features