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

LG-14673: Add SP info to fraud review events #11390

Merged
merged 7 commits into from
Nov 4, 2024

Conversation

matthinz
Copy link
Member

🎫 Ticket

Link to the relevant ticket:
LG-14673

🛠 Summary of changes

When an operator executes the review-pass or review-reject scripts, they log an analytics event. This PR updates those analytics events to be attributed to the SP that was associated with the initial profile creation.

📜 Testing Plan

Provide a checklist of steps to confirm the changes.

  • Start from an SP and go through IdV. Intend to commit fraud so that you get caught and put into the fraud review queue.
  • Reject your fraud review request: bin/action-account review-reject $(bin/rails runner 'puts User.last.uuid')
  • Verify that the "Fraud: Profile review rejected" event logged includes the properties.service_provider key, set to the SP you were originally going through IdV for.
  • Repeat this process, but this time approve your fraud review request: bin/action-account review-pass $(bin/rails runner 'puts User.last.uuid'
  • Verify that the "Fraud: Profile review passed" event logged includes the properties.service_provider key, set to the SP you were originally going through IdV for.

changelog: Internal, Fraud review, Attribute fraud review analytics events to SPs.
Update Analytics to always attempt to log SP, even when there is no associated request.
@matthinz matthinz requested a review from a team October 23, 2024 23:10
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -21,6 +21,7 @@ def track_event(event, attributes = {})
event_properties: attributes.except(:user_id).compact,
new_event: first_event_this_session?,
path: request&.path,
service_provider: sp,
Copy link
Contributor

Choose a reason for hiding this comment

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

I had to triple check, but I forgot what the type of sp was as an attribute, since we're here, WDYT of adding type documentation to the initialzer for this class like

# @param sp [String] issuer string for the service provider for this analytics event

Copy link
Contributor

Choose a reason for hiding this comment

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

On that note, would it be worthwhile to rename the sp param to sp_issuer or just issuer?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I agree with that... probably not going to do in this PR but standardizing usage of sp vs issuer vs sp_issuer across the codebase would be great. I think I'd be in favor of:

sp = A ServiceProvider instance
sp_issuer = sp.issuer, an issuer string

If include_missing is specified and there are no missing users, don't log an event for them
@matthinz matthinz force-pushed the matthinz/14673-fraud-sp-info branch from f765520 to 330161e Compare October 23, 2024 23:50
Include service_provider in analytics_attributes now that it does not depend on request being non-nil.
profile_fraud_review_pending_at: profile_fraud_review_pending_at,
profile_age_in_seconds: profile_age_in_seconds,
profile_fraud_review_pending_at:,
profile_age_in_seconds: profile&.profile_age_in_seconds,
Copy link
Contributor

Choose a reason for hiding this comment

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

(suggestion, non-blocking): I think it is worthwhile keeping the profile attr wrapping methods to streamline reading as profile attributes are inconsistently accessed with safe navigation (see line 281 where we don't use safe navigation).

@matthinz matthinz merged commit 4f69bb2 into main Nov 4, 2024
2 checks passed
@matthinz matthinz deleted the matthinz/14673-fraud-sp-info branch November 4, 2024 19:55
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.

3 participants