craig-rueda commented on a change in pull request #18651:
URL: https://github.com/apache/superset/pull/18651#discussion_r804922530
##########
File path: superset/security/manager.py
##########
@@ -1337,13 +1341,22 @@ def get_guest_user_from_request(self, req: Request) ->
Optional[GuestUser]:
return None
try:
+ aud = (
+ current_app.config["GUEST_TOKEN_JWT_DECODE_AUDIENCE"] or
get_url_host()
+ )
token = self.parse_jwt_guest_token(raw_token)
if token.get("user") is None:
raise ValueError("Guest token does not contain a user claim")
if token.get("resources") is None:
raise ValueError("Guest token does not contain a resources
claim")
if token.get("rls_rules") is None:
raise ValueError("Guest token does not contain an rls_rules
claim")
+ if token.get("aud") is None:
+ raise ValueError("Guest token does not contain an aud claim")
+ if token.get("aud") != aud:
+ raise ValueError("Guest token does not match the aud claim")
+ if token.get("type") != "guest":
Review comment:
Pls add some tests where the supplied token isn't a "guest" token, and
where the `aud` doesn't match
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]