-
Notifications
You must be signed in to change notification settings - Fork 84
Memory-hard KDF for hashing API keys at rest (Argon2id) #222
Copy link
Copy link
Closed
Labels
GrantFox OSSIssue tracked in GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Campaign: Official Campaign | FWC26area:backendBackend (NestJS) areaBackend (NestJS) areakind:securitySecurity hardeningSecurity hardening
Description
Activity
Metadata
Metadata
Assignees
Labels
GrantFox OSSIssue tracked in GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Campaign: Official Campaign | FWC26area:backendBackend (NestJS) areaBackend (NestJS) areakind:securitySecurity hardeningSecurity hardening
Problem Statement. The current keyHash is described as SHA-256 in spec. SHA-256 of an
API key is fast — exactly what an attacker brute-forcing a leaked hash wants.
Why it matters. Even with a long random key, a stolen keyHash can be reversed by
someone who controls the database.
Technical Context. Existing
keyHashcolumn allows arbitrary length. Argon2idproduces a 32-byte hash with a parameter-aware string that can fit.
Expected Outcome. API keys are hashed with
argon2id, parameters encoded inside thehash output so verification doesn't need a config match.
Acceptance Criteria.
argon2-cffi'sPasswordHasherverify.Implementation Notes. Pick parameters (m=64 MiB, t=3, p=1) carefully; benchmark
against the existing verify latency budget.
Files or modules likely to be affected.
src/api-keys/*,src/common/guards/api-key.guard.ts,requirements.txt/package.json(argon2,argon2-cffi).Difficulty. Medium
Estimated effort. S
Smart-Contract Safety — Issues 15–28
Backlog item #14 from `docs/maintainer-issue-backlog.md.