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

Protect UserEntity.privateData update with ETag/If-Match headers #57

Merged
merged 8 commits into from
Jul 29, 2024

Conversation

emlun
Copy link
Member

@emlun emlun commented Jul 24, 2024

This depends on the corresponding frontend PR:

Follow-up to #56, this is a step towards "phase 1" of wwWallet/wallet-ecosystem#62: enabling the private data to be updated on the server side.

This helps prevent data loss if a user has two concurrent sessions and one attempts to overwrite changes made by the other. Each client must now keep track of the X-Private-Data-ETag value returned when the client most recently updated its local copy of the private data, and send that value as the X-Private-Data-If-Match header when performing an update. If the header is missing or does not match the current server state, the update is rejected.

These headers are meant to imitate the general-purpose ETag and If-Match headers, but named with a prefix to indicate that they only apply to the private data field when used in requests that also retrieve or handle other fields.

Instead of collapsing all possible errors down to just `DB_ERR`.
This helps prevent data loss if a user has two concurrent sessions and
one attempts to overwrite changes made by the other. Each client must
now keep track of the `X-Private-Data-ETag` value returned when the
client most recently updated its local copy of the private data, and
send that value as the `X-Private-Data-If-Match` header when
performing an update. If the header is missing or does not match the
current server state, the update is rejected.

These headers are meant to imitate the general-purpose `ETag` and
`If-Match` headers, but named with a prefix to indicate that they only
apply to the private data field when used in requests that also
retrieve or handle other fields.
@emlun emlun requested a review from kkmanos July 24, 2024 17:47
Base automatically changed from encrypt-asymmetric to master July 29, 2024 13:57
@emlun emlun merged commit 07192d8 into master Jul 29, 2024
4 checks passed
@emlun emlun deleted the update-privatedata-etag branch July 29, 2024 15:05
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