SachinyadavAug20 opened a new pull request, #77366:
URL: https://github.com/apache/airflow/pull/77366
closes: #77364
In `AwsAuthManager.deserialize_user()`, `token.pop("sub")` was mutating the
caller's input dictionary in-place by removing the `"sub"` key. If
`deserialize_user()` is called multiple times on the same claims dictionary, or
if the decoded JWT dictionary is accessed by downstream authentication handlers
or middleware, the in-place mutation causes unexpected `KeyError: 'sub'` or
stripped claims.
This change aligns `AwsAuthManager.deserialize_user()` with
`SimpleAuthManager` and `KeycloakAuthManager` by accessing `"sub"`
non-destructively:
- Use `user_id=token["sub"]` instead of `token.pop("sub")`.
- Add unit tests for both `deserialize_user` and `serialize_user` in
`test_aws_auth_manager.py`, asserting that the input dictionary is not modified
in-place.
Was generative AI tooling used to co-author this PR?
Yes (Antigravity)
Generated-by: Antigravity following the guidelines
--
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]