Page MenuHomePhabricator

[identity] Add types for Ed25519-signed nonce challenge
ClosedPublic

Authored by bartek on Feb 14 2024, 4:43 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 12:33 PM
Unknown Object (File)
Thu, Nov 7, 2:01 AM
Unknown Object (File)
Fri, Nov 1, 11:37 PM
Unknown Object (File)
Oct 15 2024, 6:36 PM
Unknown Object (File)
Oct 15 2024, 6:36 PM
Unknown Object (File)
Oct 15 2024, 6:36 PM
Unknown Object (File)
Oct 15 2024, 6:36 PM
Unknown Object (File)
Oct 15 2024, 4:42 PM
Subscribers

Details

Summary

For the "Existing Device Login" (5.3.6), we want to introduce the challenge-response approach to protect from replay attacks.
We agreed to re-use nonces from the GenerateNonce RPC which is currently used for wallet login/registration.

This diff introduces types for verifying if the nonce is properly signed by the client using Olm account (ed25519).
The code is similiar to what we do for verifying keyserver messages for reserved usernames.

Test Plan

Added unit test, the data comes from D11037 test plan

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Feb 14 2024, 4:56 AM
varun requested changes to this revision.Feb 15 2024, 9:02 PM
varun added inline comments.
services/identity/src/grpc_utils.rs
29

the whitepaper says the challenge message should contain a nonce and timestamp. wondering why there's no timestamp in this struct

47–63

i wonder if we should try to dedup this given how similar it is to validate_and_decode_message (can defer this if you'd prefer)

This revision now requires changes to proceed.Feb 15 2024, 9:02 PM
bartek added inline comments.
services/identity/src/grpc_utils.rs
29

We do timestamp verification server-side, I'm reusing the wallet login nonces mechanics here - the timestamp is stored in the identity-nonces table and verified if not expired

varun added inline comments.
services/identity/src/grpc_utils.rs
47–63

lmk what you think about this

This revision is now accepted and ready to land.Feb 15 2024, 9:57 PM
services/identity/src/grpc_utils.rs
47–63

Yeah I'll try to dedupe this

services/identity/src/grpc_utils.rs
47–63

Turns out that refactor of validate_and_decode_message is too significant for this diff, I'll put up a follow-up