hypercerts-org / hypercerts-org/ePDS

security: backup email verification tokens have no server-side expiry

Open
#38 0 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

bug Product: ePDS Quality: security
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

  1. Add a created_at column (or expires_at) to the backup_email table via a new migration.
  2. Check the timestamp in verifyBackupEmail() and reject tokens older than 24 hours.
  3. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.