Skip to content
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

Fix the anonymization script issue for access grants #10926

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

danieljames-dj
Copy link
Member

This PR is to fix the issue where the anonymization script UI breaks as it was trying to access application of access_grants (code link).

I am not sure if this fix will work, I couldn't test it in local as I don't have any idea how to populate access grants.

@danieljames-dj
Copy link
Member Author

@thewca-bot deploy staging

@danieljames-dj
Copy link
Member Author

I tested in staging and this is working as expected.

Copy link
Member

@gregorbg gregorbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is fine, just one genuine question that I would like to understand 🙃

@@ -1502,7 +1502,22 @@ def location
end

def anonymization_checks_with_message_args
access_grants = oauth_access_grants&.select { |access_grant| !access_grant.revoked_at.nil? }
access_grants = oauth_access_grants
.select { |access_grant| !access_grant.revoked_at.nil? }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: Why do you limit this to access grants where revoked_at is NOT nil?
This means you will only see grants which have revoked_at present, i.e. ones which have already been revoked.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On that note, the select can be a tad bit easier to parse if you use access_grant.revoked_at.present? because you can skip the ! in that case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you limit this to access grants where revoked_at is NOT nil?

TBH I don't know. This was evolved from some long discussions which I'm not aware of. I checked Jacob's initial doc but according to that doc, only the applications where resource_owner_id is the user needs to be cleared - but that actually doesn't come under 'anonymization of the user'. So at some point it was changed to every oauth_access_grants.

The select came in after one of your comments: #6086 (comment) and I don't have much context on it.

IMO, this should be access_grants without select. By any chance do you remember any context on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh. To be honest I don't remember that I originally gave this comment to Jacob. Was really surprised to see my own reviews there 😅😅

My guess (and I really mean guess here!) is that you only need to care about grants which have already been revoked, because the user requesting Anon might not be aware of them anymore.
All currently active grants (ie those where revoked_at is nil) can be taken care of by the user themselves.

With that being said, the approach with filtering for not-nil obviously worked fine for many years. So it might be worth checking on WRT-internal channels if anybody knows anything about this procedure.
If necessary, you can also try reaching out to Jacob in retirement and see if he still remembers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... the select can be a tad bit easier to parse ...

I just figured out oauth_access_grants.where.not(revoked_at: nil) might also be a good option. I'm not sure if it'll work fine in staging. I'll test in staging once and confirm.

Re decision on whether we need all access grants or just the ones with revoked_at value as nil or just the ones with revoked_at value as not nil - I will check with the WRT and if change is required, I'll make it in a later PR. Is it fine to approve this PR as it is now so that it will allow WRT to anonymize in case some request arise? Currently the UI is breaking when access_grants is available for a user.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it'll work fine in staging. I'll test in staging once and confirm.

I've now confirmed that this code is working fine in staging.

@danieljames-dj
Copy link
Member Author

@thewca-bot deploy staging

@danieljames-dj
Copy link
Member Author

@thewca-bot deploy staging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants