Commit graph

194 commits

Author SHA1 Message Date
senke
e63a0f2720 [FIX] Generate unique slug for user registration
- Implement slug uniqueness check before creating user
- Add numeric suffix if slug already exists (e.g., username1, username2)
- Fallback to timestamp-based slug if too many collisions
- Prevents database constraint violations for duplicate slugs
- Matches the logic used in OAuth service for consistency
2026-01-04 01:44:13 +01:00
senke
1011ddd4a3 [FIX] Initialize required User fields explicitly during registration
- Set Role to 'user' explicitly
- Set IsActive to true explicitly
- Set IsVerified to false explicitly
- Prevents database constraint errors when creating new users
- Ensures all required fields are set even if database defaults are missing
2026-01-04 01:44:13 +01:00
senke
231c11b808 [FIX] Improve validation error messages for better user experience
- Add user-friendly error messages for password, email, and username validation
- Translate technical validation errors to clear French messages
- Specifically handle 'min' validation for password (12 chars) and username (3 chars)
- Handle 'eqfield' validation for password confirmation
- Handle 'email' validation for email format
- Handle 'required' validation for all fields
- Improves error messages shown to users during registration
2026-01-04 01:44:13 +01:00
senke
71a00e8da6 [FIX] Disable endpoint rate limiting in development mode
- Disable RegisterRateLimit when APP_ENV=development
- Add development mode check in endpoint_limiter.go
- Prevents rate limit errors during development and testing
- Endpoint rate limiting still active in production/staging
- Fixes 429 errors when creating accounts in development
2026-01-04 01:44:13 +01:00
senke
dbbbabe76b [FIX] Disable rate limiting completely in development mode
- Disable rate limiting when APP_ENV=development
- Add development mode check in router.go
- Prevents rate limit errors during development and testing
- Rate limiting still active in production/staging
- Exclude critical routes as backup measure
2026-01-04 01:44:13 +01:00
senke
08b8412f8a [FIX] Exclude critical routes from rate limiting
- Exclude auth routes (/register, /login, /refresh) from rate limiting
- Exclude CSRF token endpoint from rate limiting
- Exclude health check endpoints from rate limiting
- Exclude Swagger/docs endpoints from rate limiting
- Prevents rate limit errors during registration and login
- Applied to both SimpleRateLimiter and RateLimiter (Redis)
2026-01-04 01:44:13 +01:00
senke
f47bdbc099 [FIX] Increase rate limit for development to prevent errors during registration
- Increase IP rate limit from 100 to 200 requests per minute
- Increase IP burst from 10 to 20
- Increase SimpleRateLimiter limit from 100 to 200
- Allows frontend to make multiple requests during initial load (CSRF, state hydration, etc.)
- Can be overridden via RATE_LIMIT_IP_PER_MINUTE and RATE_LIMIT_LIMIT env vars
2026-01-04 01:44:13 +01:00
senke
3f30ccec42 [FIX] Fix rate limit retry loop and Swagger /docs route
Frontend fixes:
- Stop retrying 429 rate limit errors to prevent infinite loops
- Show user-friendly error message for rate limit with retry-after duration
- Remove 429 from retryable status codes
- Clean up rate limit error handling logic

Backend fixes:
- Fix Swagger /docs route to use same handler as /swagger/*any
- Remove redirect that was causing 404 errors
2026-01-04 01:44:13 +01:00
senke
93a0ad0da8 [FIX] Fix frontend black page and Swagger /docs route
Frontend fixes:
- Fix 'require is not defined' error in stateHydration.ts
  Replace require('react') with ES6 import statement
- Fix DataCloneError in broadcastSync.ts
  Serialize state before sending via BroadcastChannel (functions can't be cloned)

Backend fixes:
- Fix Swagger /docs route not found
  Redirect /docs to /swagger/index.html for better compatibility
2026-01-04 01:44:13 +01:00
senke
00a4a09f2c [FIX] Fix Gin route conflict for user routes
- Change :userId to :id in avatar routes for consistency
- Fixes panic: ':userId' conflicts with existing wildcard ':id'
- All routes now use consistent :id parameter
2026-01-04 01:44:13 +01:00
senke
db7ad3dd7a [FIX] Fix migration errors for missing tables
- Add table existence checks before adding constraints/triggers
- Fix playback_analytics references (table doesn't exist)
- Fix playlist_versions references (table doesn't exist)
- Fix follows.deleted_at reference (column doesn't exist)
- Fix marketplace_products/orders triggers (tables don't exist)
- All migrations now pass successfully
2026-01-04 01:44:13 +01:00
senke
1a4f1f27d4 [FIX] Fix migration SQL syntax and add troubleshooting guide
- Fix 050_data_validation_constraints.sql: Replace IF NOT EXISTS with DO blocks
- PostgreSQL doesn't support IF NOT EXISTS with ADD CONSTRAINT
- Add quick troubleshooting guide (DEPANNAGE_RAPIDE.md)
- Note: .env file is gitignored (as expected)
2026-01-04 01:44:13 +01:00
senke
2ce90f67c9 [INT-DOC-001] Generate OpenAPI/Swagger documentation (already configured, added /docs alias) 2025-12-26 09:32:56 +01:00
senke
0441c2adf6 [INT-AUTH-001] Ensure CSRF protection active in production 2025-12-25 22:28:46 +01:00
senke
e6ff9a65f6 [INT-CORS-002] Add preflight request handling validation 2025-12-25 22:27:05 +01:00
senke
24cf8f0b9d [FE-TEST-001] fe-test: Add unit tests for API services
- Created comprehensive unit tests for marketplaceService (11 tests)
- Created comprehensive unit tests for profileService (12 tests)
- Created comprehensive unit tests for avatarService (9 tests)
- Created comprehensive unit tests for 2fa-service (8 tests)
- All 40 tests pass successfully
- Tests cover success cases, error handling, edge cases, and validation scenarios

Files modified:
- apps/web/src/services/marketplaceService.test.ts (new)
- apps/web/src/features/profile/services/profileService.test.ts (new)
- apps/web/src/features/profile/services/avatarService.test.ts (new)
- apps/web/src/services/2fa-service.test.ts (new)
- VEZA_COMPLETE_MVP_TODOLIST.json
2025-12-25 15:55:53 +01:00
senke
dfbbc7dfa8 [INT-021] int: Add API monitoring and alerting
- Created APIMonitoringMiddleware to track API failures (5xx errors), slow requests, and timeouts
- Created HealthCheckMonitoring middleware for health check endpoints
- Integrated MonitoringAlertingService into router with automatic initialization
- Service starts monitoring in background with default alert rules
- Provides comprehensive monitoring and alerting for API health and failures
- Monitoring activates when PROMETHEUS_URL is configured

Files modified:
- veza-backend-api/internal/middleware/monitoring.go (new)
- veza-backend-api/internal/api/router.go
- VEZA_COMPLETE_MVP_TODOLIST.json
2025-12-25 15:53:13 +01:00
senke
cf58f3d00d [INT-020] int: Add API endpoint deprecation strategy
- Created DeprecationInfo structure for managing deprecation metadata
- Enhanced DeprecationWarning middleware with custom deprecation information support
- Added standardized deprecation headers (Deprecated, Sunset, Link per RFC 8594)
- Added X-API-* custom headers for compatibility
- Created MarkEndpointDeprecated helper for easy endpoint deprecation
- System provides clear warnings, sunset dates, and migration guidance

Files modified:
- veza-backend-api/internal/middleware/general.go
- VEZA_COMPLETE_MVP_TODOLIST.json
2025-12-25 15:51:14 +01:00
senke
3fb15f86e3 [INT-019] int: Add environment variable validation
- Created ValidateRequiredEnvironmentVariables function
- Validates required vars (JWT_SECRET, DATABASE_URL) in all environments
- Production-specific validations: CORS_ALLOWED_ORIGINS required, no wildcard, no DEBUG log level, RabbitMQ URL if enabled
- Integrated validation at startup in NewConfig() to fail-fast if required variables are missing
- Provides clear error messages for missing or invalid environment variables

Files modified:
- veza-backend-api/internal/config/config.go
- VEZA_COMPLETE_MVP_TODOLIST.json
2025-12-25 15:49:59 +01:00
senke
60349069f2 [INT-018] int: Add CORS configuration validation
- Enhanced ValidateCORSConfiguration to accept environment parameter
- Enforce strict validation in production (fail-fast on wildcard or empty CORS)
- In production, startup fails if CORS is misconfigured
- In development/staging, warnings are logged but startup continues
- Updated router to use environment-aware validation

Files modified:
- veza-backend-api/internal/middleware/cors.go
- veza-backend-api/internal/api/router.go
- VEZA_COMPLETE_MVP_TODOLIST.json
2025-12-25 15:48:48 +01:00
senke
27517ae916 [INT-017] int: Add session management integration
- Fixed GetSessions handler to identify current session by comparing token hash
- Added session creation during token refresh to ensure sessions are tracked
- Sessions are now correctly identified as current in the frontend
- Updated Refresh handler to accept sessionService parameter

Files modified:
- veza-backend-api/internal/handlers/session.go
- veza-backend-api/internal/handlers/auth.go
- veza-backend-api/internal/api/router.go
- VEZA_COMPLETE_MVP_TODOLIST.json
2025-12-25 15:47:33 +01:00
senke
7004d57ee0 [INT-016] int: Add authentication token refresh flow
- Added proactive token refresh mechanism (5 minutes before expiration)
- Implemented JWT decoding to check token expiration
- Added seamless refresh integration with login/logout flows
- Improved error handling and cleanup
- Integrated with auth store and API client

Files modified:
- apps/web/src/services/tokenRefresh.ts
- apps/web/src/services/api/auth.ts
- apps/web/src/stores/auth.ts
- VEZA_COMPLETE_MVP_TODOLIST.json
2025-12-25 15:45:30 +01:00
senke
72ad9da0a2 [INT-015] int: Add file upload format standardization 2025-12-25 15:40:01 +01:00
senke
3206b1ccb2 [INT-014] int: Add WebSocket message format standardization 2025-12-25 15:35:38 +01:00
senke
469e0f3136 [INT-013] int: Add API rate limiting communication 2025-12-25 15:30:01 +01:00
senke
0bd12aa91d [INT-011] int: Add API versioning strategy 2025-12-25 15:25:33 +01:00
senke
74f9531c50 [INT-010] int: Add API documentation (OpenAPI/Swagger) 2025-12-25 15:23:19 +01:00
senke
9a3c72a2da [INT-009] int: Add API contract tests 2025-12-25 15:18:44 +01:00
senke
4a53bba2f9 [INT-008] int: Standardize date/time formats 2025-12-25 15:16:38 +01:00
senke
e043b87101 [INT-007] int: Standardize pagination format 2025-12-25 15:14:26 +01:00
senke
eda4eef238 [INT-006] int: Standardize error response format 2025-12-25 15:11:24 +01:00
senke
1ebbb06315 [FE-PAGE-015] fe-page: Add Analytics page 2025-12-25 11:25:06 +01:00
senke
77fa6c483c [DOC-007] doc: Write contributing guide 2025-12-25 11:06:54 +01:00
senke
f3475ca04f [DOC-006] doc: Write troubleshooting guide 2025-12-25 11:02:37 +01:00
senke
34a11721e0 [DOC-005] doc: Write user guide 2025-12-25 10:56:24 +01:00
senke
c4f19754a8 [DOC-004] doc: Write architecture documentation 2025-12-25 02:57:10 +01:00
senke
ee3ad8e2f5 [DOC-003] doc: Write development setup guide 2025-12-25 02:54:47 +01:00
senke
58bf432f41 [DOC-002] doc: Write deployment guide 2025-12-25 02:52:14 +01:00
senke
aef5bcbdb4 [DOC-001] doc: Write API documentation 2025-12-25 02:48:06 +01:00
senke
0ee7232592 [BE-TEST-025] test: Add tests for marketplace flow 2025-12-25 02:39:56 +01:00
senke
33841c9337 [BE-TEST-024] test: Add tests for analytics endpoints 2025-12-25 02:36:50 +01:00
senke
83ded8ab05 [BE-TEST-023] test: Add tests for search functionality 2025-12-25 02:34:17 +01:00
senke
e4946db347 [BE-TEST-022] be-test: Add tests for 2FA flow
- Created comprehensive 2FA flow test suite
- Tests cover 2FA setup (secret generation, QR code, recovery codes)
- Tests cover verification and activation with TOTP codes
- Tests cover login flow with 2FA requirement
- Tests cover status checking and TOTP code validation
- Tests cover complete end-to-end flow (setup -> verify -> login)
- Tests handle SQLite compatibility (GORM for EnableTwoFactor)
- Tests verify error cases (already enabled, invalid codes)
- Tests verify recovery codes generation

Phase: PHASE-5
Priority: P2
Progress: 143/267 (53.56%)
2025-12-25 02:21:16 +01:00
senke
b3735c9e16 [BE-TEST-021] be-test: Add tests for webhook delivery
- Created comprehensive webhook delivery and retry test suite
- Tests cover webhook delivery success with proper headers
- Tests cover retry logic for network errors with exponential backoff
- Tests cover max retries exceeded scenario
- Tests cover signature verification (HMAC-SHA256)
- Tests cover worker retry logic
- Tests for TriggerEvent skipped for SQLite (PostgreSQL array operators not supported)
- Tests verify webhook payload structure and headers (X-Veza-Signature, X-Veza-Event, X-Veza-Timestamp)

Phase: PHASE-5
Priority: P2
Progress: 142/267 (53.18%)
2025-12-25 02:13:27 +01:00
senke
eea79884b9 [BE-TEST-020] be-test: Add tests for filtering and sorting
- Created comprehensive filtering and sorting test suite
- Tests cover tracks endpoints: filtering by user_id, genre, format, combined filters
- Tests cover tracks endpoints: sorting by created_at (asc/desc), title, default sort
- Tests cover users endpoints: filtering by role, is_active, is_verified, search
- Tests cover users endpoints: sorting by created_at, username
- Tests cover playlists endpoints: filtering by user_id
- Tests verify invalid sort fields and orders are handled gracefully
- Tests verify combined filtering and sorting work together
- Note: User search test skipped for SQLite (does not support ILIKE operator)

Phase: PHASE-5
Priority: P2
Progress: 141/267 (52.81%)
2025-12-25 02:09:45 +01:00
senke
096da76c09 [BE-TEST-019] be-test: Add tests for pagination
- Created comprehensive pagination test suite for all list endpoints
- Tests cover tracks, users, and playlists endpoints
- Tests verify default pagination (page=1, limit=20)
- Tests verify custom pagination parameters
- Tests verify invalid parameter validation and correction
- Tests verify pagination metadata (total, total_pages, has_next, has_prev)
- Tests verify navigation between pages
- Tests verify edge cases (empty query, large page numbers, max limit)
- Tests verify total count accuracy
- Tests verify consistency across all endpoints

Phase: PHASE-5
Priority: P2
Progress: 140/267 (52.43%)
2025-12-25 02:05:58 +01:00
senke
1f574bec10 [BE-TEST-018] be-test: Add tests for error handling
- Created comprehensive error handling test suite
- Tests verify error response format standardization
- Tests cover all error types (validation, not found, unauthorized, forbidden, internal, database, conflict, rate limit, quota)
- Tests verify error recovery and retry logic
- Tests verify validation error details
- Tests verify HTTP status code mapping
- Tests verify error response consistency

Phase: PHASE-5
Priority: P2
Progress: 139/267 (52.06%)
2025-12-25 02:02:54 +01:00
senke
f8aa42df20 [BE-TEST-017] be-test: Add security tests for authorization
- Created comprehensive authorization test suite
- Tests verify unauthorized access is blocked (401/403)
- Tests cover: no token, invalid token, expired token
- Tests verify role-based access control (admin, creator, regular user)
- Tests verify ownership checks and admin override
- Tests verify token version mismatch protection

Phase: PHASE-5
Priority: P2
Progress: 138/267 (51.69%)
2025-12-25 02:00:56 +01:00
senke
6e4a3578c9 [BE-TEST-016] be-test: Add security tests for injection attacks
- Created comprehensive security test suite for SQL injection, XSS, and command injection
- Added 30+ SQL injection test payloads
- Added 50+ XSS test payloads
- Added 30+ command injection test payloads
- Tests verify GORM parameterized queries protection
- Tests verify input sanitization utilities
- Added README documentation for security tests

Phase: PHASE-5
Priority: P2
Progress: 137/267 (51.31%)
2025-12-25 01:57:59 +01:00
senke
f71d6add4b [BE-TEST-015] be-test: Add load tests for upload endpoints
- Created k6 load test script for concurrent and chunked uploads
- Added Go performance tests for upload endpoints
- Updated README with usage instructions for upload load tests
- Tests cover simple upload, chunked upload (initiate/chunk/complete), and batch upload
- Performance thresholds defined for upload operations

Phase: PHASE-5
Priority: P2
Progress: 136/267 (50.94%)
2025-12-25 01:55:22 +01:00