-
Notifications
You must be signed in to change notification settings - Fork 1k
Improve state mismatch issues in StripeAttest #5627
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
base: master
Are you sure you want to change the base?
Conversation
b45c7d8
to
a499cec
Compare
dfe6012
to
09901b9
Compare
} else { | ||
// Reset and retry | ||
resetKey() | ||
try await self.attest() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The one thing I wasn't totally sure of is if we should re-attest here, since the client has keys that the server doesn't have. Curious what you think @davidme-stripe @tillh-stripe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resetKey()
resets successfullyAttested
to false, so we can probably skip attest()
and just call _assert(isRetry: true)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh duh! Will remove this line
let linkDefaultOptIn = (response["link_default_opt_in"] as? String).flatMap { LinkDefaultOptIn(rawValue: $0) } | ||
let linkEnableDisplayableDefaultValuesInECE = response["link_enable_displayable_default_values_in_ece"] as? Bool ?? false | ||
let linkShowPreferDebitCardHint = response["link_show_prefer_debit_card_hint"] as? Bool ?? false | ||
let attestationStateSyncEnabled = response["link_mobile_attestation_state_sync_enabled"] as? Bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR for this is here https://git.corp.stripe.com/stripe-internal/pay-server/pull/1208789
// Server has attestation but client doesn't know - update client | ||
successfullyAttested = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like a band-aid, since attest
would set successfullyAttested = true
. Do you strongly feel that we need it?
(If you think so, let's also instrument it, so that we know if this ever occurs.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is reasonable, as it will let the client assert when the server thinks it has successfully attested. No super strong opinions on where we go with this though.
I can add logs for the two cases here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added logs here ec4645e
} else { | ||
// Reset and retry | ||
resetKey() | ||
try await self.attest() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resetKey()
resets successfullyAttested
to false, so we can probably skip attest()
and just call _assert(isRetry: true)
.
79b07b2
to
eb64767
Compare
Summary
This makes a few tweaks to the
StripeAttest
client to better handle client and server state mismatches. There are two scenarios this addresses:I'm adding a feature flag
link_mobile_attestation_state_sync_enabled
to control this new behavior, as we don't know yet if it is a risky change.I'm also adding new analytic events for those two scenarios,
Motivation
More details here https://docs.google.com/document/d/1NMQoDpCOv4dvYjMmwfrsezGhc---wKy2eFkeH_DBjAQ/edit?usp=sharing
Testing
Unit tests added
Changelog
N/a