Skip to content

types.proto: Bring back RecoveryAttemptLockExpires field as deprecated#37618

Closed
jentfoo wants to merge 1 commit intomasterfrom
jent/revert-RecoveryAttemptLockExpires-proto-removal
Closed

types.proto: Bring back RecoveryAttemptLockExpires field as deprecated#37618
jentfoo wants to merge 1 commit intomasterfrom
jent/revert-RecoveryAttemptLockExpires-proto-removal

Conversation

@jentfoo
Copy link
Copy Markdown
Contributor

@jentfoo jentfoo commented Jan 31, 2024

Raised from @codingllama here:

The removal of this field is making UpdateAndSwapUser fail.

If the stored user had the "recovery_attempt_lock_expires" field set, then the comparison always fails. That is because when we read and unmarshal the user the unknown field gets dropped, but the actual CompareAndSwap operation compares using the storage blobs instead.

This PR does the short term fix by reverting this field change but marking the field as deprecated.

The removal of this field is making UpdateAndSwapUser fail.

If the stored user had the "recovery_attempt_lock_expires" field set, then the comparison always fails. That is because when we read and unmarshal the user the unknown field gets dropped, but the actual CompareAndSwap operation compares using the storage blobs instead.
@jentfoo jentfoo added no-changelog Indicates that a PR does not require a changelog entry backport/branch/v15 labels Jan 31, 2024
@jentfoo jentfoo self-assigned this Jan 31, 2024
@github-actions github-actions Bot requested a review from klizhentas January 31, 2024 22:24
@jentfoo
Copy link
Copy Markdown
Contributor Author

jentfoo commented Jan 31, 2024

@codingllama and @zmb3 the lint failure makes it look like we can't simply bring this field back. Will this be API compatible?

@codingllama
Copy link
Copy Markdown
Contributor

@codingllama and @zmb3 the lint failure makes it look like we can't simply bring this field back. Will this be API compatible?

I don't see why restoring the field would be a breaking change, neither for proto or JSON. @espadolini, any ideas?

@espadolini
Copy link
Copy Markdown
Contributor

It's ok, it's just that the backwards compatibility checker can't know that it's ok, and we never added a way to bypass it for a given PR (and I'm not sure of how we could do that for the check in the merge queue, actually).

Couldn't we fix the function instead? The correct way to do compare-and-swap with object is to load the item, unmarshal it according to the current understanding of the type by the auth, compare the object with the expected object, then do a conditional update with the new item (in pre-condupdate days, compare-and-swap the new item with the one that was fetched). It's always been slightly wrong to assume that the marshaling would never change.

@rosstimothy
Copy link
Copy Markdown
Contributor

Couldn't we fix the function instead? The correct way to do compare-and-swap with object is to load the item, unmarshal it according to the current understanding of the type by the auth, compare the object with the expected object, then do a conditional update with the new item (in pre-condupdate days, compare-and-swap the new item with the one that was fetched). It's always been slightly wrong to assume that the marshaling would never change.

+1 to using conditional update instead of compare and swap in this scenario

@espadolini
Copy link
Copy Markdown
Contributor

espadolini commented Feb 1, 2024

Prior art:

@codingllama
Copy link
Copy Markdown
Contributor

Yeah, fixing the CAS was one of my suggestions. This is just a simpler/quicker fix while we get that done.

@jentfoo
Copy link
Copy Markdown
Contributor Author

jentfoo commented Feb 1, 2024

I am on PTO today and tomorrow, and next week the security team has a lot of ISO audit work ahead. Given that, I was just trying to get a quick fix out

@codingllama
Copy link
Copy Markdown
Contributor

I am on PTO today and tomorrow, and next week the security team has a lot of ISO audit work ahead. Given that, I was just trying to get a quick fix out

Enjoy your PTO, Mike. I'll take a look at the CompareAndSwap changes.

@rosstimothy
Copy link
Copy Markdown
Contributor

#37660 addresses the issue by fixing the CAS operation

@rosstimothy
Copy link
Copy Markdown
Contributor

Closing now that #37660 has been merged

@rosstimothy rosstimothy closed this Feb 2, 2024
@jentfoo jentfoo deleted the jent/revert-RecoveryAttemptLockExpires-proto-removal branch April 5, 2024 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-for-v15 no-changelog Indicates that a PR does not require a changelog entry size/sm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants