Skip to content

[CRITICAL][KYC] Remove the fallback signing key from document access tokens #173

Description

@Obiajulu-gif

Summary

KYC signed URLs fall back to a public constant if all preferred secrets are absent. Any attacker who knows the source can forge document tokens in a misconfigured deployment.

Repository evidence

  • lib/security/kyc-signed-urls.ts resolves JWT_SECRET, then AUTH_SESSION_SECRET, then KYC_DOCUMENT_ENCRYPTION_KEY, then the literal fallback-signing-key.
  • The resulting HMAC authorizes /api/kyc-documents/:id access.

Scope

  • Require a dedicated document-token signing key with minimum entropy in production.
  • Separate signing-key rotation from encryption keys and retain explicit verification key IDs.
  • Fail startup/preflight instead of issuing tokens under a fallback.

Acceptance criteria

  • No constant or unrelated encryption key is used for document-token signing.
  • Misconfigured production cannot issue or verify signed document URLs.
  • Rotation preserves only the intended overlap window.

Tests

  • Missing/weak-key production tests and two-version rotation tests.
  • Forgery regression using the former fallback literal.

Non-goals

  • Changing document encryption format.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions