HomePhabricator
Diffusion Comm 0eaf5cf64463

[keyserver] Clean up stale (>30min old) SIWE nonces

Tags
None
Referenced Files
F299823: 67504a.png
Dec 21 2022, 10:29 PM
File Not Attached
F299822: 03a698.png
Dec 21 2022, 10:29 PM
File Not Attached
Subscribers
None

Description

[keyserver] Clean up stale (>30min old) SIWE nonces

Summary:
We decided that SIWE nonces should be valid for 30 minutes. In this diff we clean up stale nonces that are no longer valid from the siwe_nonces table every 24 hours as part of a cron job.

But doesn't that mean that a nonce could be valid for far longer than 30 minutes?

We're also going to be checking the creation_time of the nonce on every request to ensure that it's <30 minutes old. This is more to reduce clutter in the siwe_nonces table.

Test Plan:

  1. Changed the lifetime to a minute and modified cron job schedule to force a run and observed that all the rows in siwe_nonces were removed (they were all stale):

03a698.png (452×1 px, 86 KB)

  1. Changed the lifetime to a minute and modified cron job schedule to force a run and added a bunch of nonces <1m old and ensured that only the stale rows in siwe_nonces were removed:

67504a.png (306×1 px, 60 KB)

Reviewers: ashoat, tomek

Reviewed By: ashoat

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

Details

Provenance
atulAuthored on Dec 21 2022, 10:25 PM
Reviewer
ashoat
Differential Revision
D5979: [keyserver] Clean up stale (>30min old) SIWE nonces
Parents
rCOMM9355453a76a5: [keyserver] Listen on all addresses in dev mode
Branches
Unknown
Tags
Unknown