hypercerts-org / hypercerts-org/ePDS
security: backup email verification tokens have no server-side expiry
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8
- Forks
- 4
- Avg merge
- 5d 11h
- Merged PRs (30d)
- 3
Description
Problem
The backup email verification flow claims tokens expire in 24 hours (email template in packages/auth-service/src/email/sender.ts:380,384), but the server enforces no expiry.
The backup_email table (packages/shared/src/db.ts:92-100) has no expires_at column, and verifyBackupEmail() (packages/auth-service/src/routes/account-settings.ts:179-180) checks only the SHA-256 hash match — not any timestamp.
A verification link works indefinitely until used.
Proposed Fix
- Add a
created_atcolumn (orexpires_at) to thebackup_emailtable via a new migration. - Check the timestamp in
verifyBackupEmail()and reject tokens older than 24 hours. - Add periodic cleanup of unverified backup emails older than 24 hours.
Severity
Moderate — an old, intercepted verification link could be used long after the user expects it to have expired.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.