Skip to content

[Backend] Resolve #66 and #73 auth/privacy flows - #186

Open
victor-2017 wants to merge 1 commit into
Hamplard-Hub:mainfrom
victor-2017:fix/66-73-auth-privacy-flows
Open

[Backend] Resolve #66 and #73 auth/privacy flows#186
victor-2017 wants to merge 1 commit into
Hamplard-Hub:mainfrom
victor-2017:fix/66-73-auth-privacy-flows

Conversation

@victor-2017

Copy link
Copy Markdown

Closes #66
Closes #73

Summary

#66 Email verification

  • Signed JWT verification tokens with purpose claim to prevent cross-use
  • Request, confirm, and status endpoints
  • Rate limiting on resend requests
  • Email delivery via existing Nodemailer infrastructure
  • emailVerifiedAt field on User model
  • Verified status exposed via user profile endpoint

#73 GDPR data export

  • Authenticated export request endpoint with job creation
  • Job status tracking (PENDING / PROCESSING / COMPLETED / FAILED)
  • Identity validation via JWT-authenticated context — never trusts client-supplied user IDs
  • Cross-module personal data compilation across 20+ models
  • Secure downloadable JSON export with path traversal protection
  • Ownership enforcement on status and download endpoints
  • Failed job handling without leaking internals

Security

  • JWT secrets are configuration-driven (env vars, not hardcoded)
  • Verification tokens carry purpose claim to prevent cross-purpose reuse
  • Export ownership verified via authenticated identity, not client params
  • Path traversal protection on download endpoint
  • Rate limiting on verification email resend
  • No passwords, hashes, or credentials included in exports
  • Internal error details not exposed to users

Tests

  • 24 new tests covering email verification and data export
  • All 150 tests passing (1 pre-existing failure in uploads module unrelated to changes)

Validation

  • npx prisma validate — schema valid
  • npx prisma generate — client generated
  • npm test — all tests pass
  • npm run build — compiles (17 pre-existing errors in reviews/uploads modules, none from new files)

Closes Hamplard-Hub#66
Closes Hamplard-Hub#73

## Email Verification (Hamplard-Hub#66)
- Signed JWT verification tokens with purpose claim
- Verification request, confirmation, and status endpoints
- Rate limiting on resend requests
- Email delivery via existing Nodemailer infrastructure
- emailVerifiedAt field on User model
- Verified status exposed via profile endpoint

## GDPR Data Export (Hamplard-Hub#73)
- Authenticated export request endpoint with job creation
- Job status tracking (PENDING/PROCESSING/COMPLETED/FAILED)
- Identity validation via JWT-authenticated context
- Cross-module personal data compilation (enrollments, certificates,
  assignments, notifications, exams, reviews, comments, refunds,
  disputes, KYC, invoices, coupons, referrals, gamification, SMS)
- Secure downloadable JSON export with path traversal protection
- Ownership enforcement on status and download endpoints
- Failed job handling without leaking internals

## Database
- Added emailVerifiedAt to User model
- Added DataExportJob model with status tracking
- Created migration for schema changes

## Tests
- 24 tests covering email verification and data export
- Token validation, rate limiting, authorization, ownership checks
- All 150 tests passing
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@victor-2017 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backend] Create GDPR data export API [Backend] Create email verification flow

1 participant