Skip to content

Commit

Permalink
feat: lower risk of undoing user changes when getting credentials
Browse files Browse the repository at this point in the history
Using a plain "user.save()" runs the risk of undoing recent changes made by
other parts of the application. So we change this to use "update_fields" to
only change the field we are interested in, in this case tools_access_role_arn
that is used when a user access AWS resources directly.

This does not address a reported issue, just something I noticed.
  • Loading branch information
michalc committed Nov 29, 2024
1 parent 3ebd062 commit 8f35da2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dataworkspace/dataworkspace/apps/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ def create_tools_access_iam_role(user_id, user_email_address, access_point_id):

# Cache the role_arn so it can be retrieved in the future without calling AWS
user.profile.tools_access_role_arn = role_arn
user.save()
user.profile.save(update_fields=['tools_access_role_arn'])

return role_arn, s3_prefixes

Expand Down

0 comments on commit 8f35da2

Please sign in to comment.