HomePhabricator
Diffusion Comm 7bd408fc265e

[keyserver] Introduce `siwe_nonces` table

Tags
None
Referenced Files
F287237: 1cf38c.png
Dec 19 2022, 9:31 AM
File Not Attached
F287238: 75d51d.png
Dec 19 2022, 9:31 AM
File Not Attached
Subscribers
None

Description

[keyserver] Introduce siwe_nonces table

Summary:
Context: https://linear.app/comm/issue/ENG-2226/add-nonce-to-cookie-session

This table will hold nonces for the SIWE flow.

Entries will be created on calls to the siwe_nonce endpoint... at which point any "stale" nonces for a given ethereum_address will be clobbered/deleted.

Entries will be checked during calls to siwe_verify (tentative name) to ensure that the ethereum_address and nonce in the signed message match what's in the siwe_nonces table AND that the creation_time is < 30 minutes ago. After the entry is successfully checked it'll be deleted from the siwe_nonces table... we never care about the value of the nonce again.

Entries will also be "swept up" by some sort of "cron" script that runs every so often to clean up expired nonces.

Here's a rough sketch of the design that I'm working off of:

75d51d.png (1×2 px, 1 MB)

Test Plan:
Table created as expected (migration):

1cf38c.png (1×1 px, 155 KB)

Table created as expected (setup db):
TBD

Reviewers: ashoat, tomek

Reviewed By: ashoat

Differential Revision: https://phab.comm.dev/D5883

Details

Provenance
atulAuthored on Dec 19 2022, 9:29 AM
Reviewer
ashoat
Differential Revision
D5883: [keyserver] Introduce `siwe_nonces` table
Parents
rCOMMe989b04eed01: Implement encryption key migration to new accessibility options
Branches
Unknown
Tags
Unknown