Commit graph

43 commits

Author SHA1 Message Date
senke
b517258ef5 feat(chat): add call signaling types 2026-02-22 03:46:10 +01:00
senke
08bc158ae0 feat(chat-server): add C2.1 WebRTC call signaling (CallOffer, CallAnswer, ICECandidate, CallHangup, CallReject) 2026-02-22 03:42:47 +01:00
senke
a992d394bb fix(chat): ensure WebSocket auth token from query or cookie
- Chat server: accept token from ?token= or access_token cookie (httpOnly)
- Frontend: append token to WS URL when available (TokenStorage)
2026-02-18 12:42:48 +01:00
senke
49a74519dc fix(chat-server): ensure sqlx-data.json available for Docker build
- Remove sqlx-data.json from .dockerignore to allow SQLX_OFFLINE build
- Use repo root as build context for veza-common path dependency
- Add SQLX_OFFLINE=true and COPY sqlx-data.json in Dockerfile
2026-02-18 12:38:16 +01:00
senke
e11984898d chore: consolidate CI, E2E, backend and frontend updates
- CI: workflows updates (cd, ci), remove playwright.yml
- E2E: global-setup, auth/playlists/profile specs
- Remove playwright-report and test-results artifacts from tracking
- Backend: auth, handlers, services, workers, migrations
- Frontend: components, features, vite config
- Add e2e-results.json to gitignore
- Docs: REMEDIATION_PROGRESS, audit archive
- Rust: chat-server, stream-server updates
2026-02-17 16:43:21 +01:00
senke
8fe2c46ee2 fix(stream): replace expect in production signature (stability) 2026-02-16 11:08:11 +01:00
senke
5e5326f26a fix(security): isolate test secrets in chat server config (A02) 2026-02-16 10:18:06 +01:00
senke
efbe6968f9 fix(audit-1.6,1.7): remove hardcoded test secrets, block bypass flags in prod
- 1.6: Replace hardcoded JWT secrets in chat server tests with runtime-generated
  values (env TEST_JWT_SECRET or uuid-based fallback)
- 1.7: Add validateNoBypassFlagsInProduction() in config; fail startup if
  BYPASS_CONTENT_CREATOR_ROLE or CSRF_DISABLED is set in production

Refs: AUDIT_TECHNIQUE_INTEGRAL_2026_02_15.md items 1.6, 1.7
2026-02-15 14:18:23 +01:00
senke
f0023e00b5 fix(audit-1.5): replace critical .unwrap() in Rust production paths
- Add unix_timestamp_secs() helper to avoid SystemTime panics
- Replace SystemTime::now().duration_since(UNIX_EPOCH).unwrap() in stream + chat
- Fix Option::unwrap() in adaptive.rs, encoding_pool, advanced_moderation
- Fix partial_cmp().unwrap() in prometheus_metrics, soundcloud
- Use expect() for lazy_static Regex (compile-time invariant)
- Fix Response::builder().body().unwrap() in simple_stream_server

Refs: AUDIT_TECHNIQUE_INTEGRAL_2026_02_15.md item 1.5
2026-02-15 14:14:29 +01:00
senke
9612041c63 fix(security): correct SQL injection in chat server cleanup_old_messages
- Verify parameterized query (make_interval + $1) is used
- Add input validation for older_than_days (1-3650)
- Harden bulk_insert COPY escaping for backslash in content, message_type, metadata
- Add security tests for cleanup_old_messages
- Add message_store module to lib.rs
- Update AUDIT_TECHNIQUE_INTEGRAL and AUDIT_2

Refs: AUDIT_TECHNIQUE_INTEGRAL_2026_02_15.md item 1.1 (P0)
2026-02-15 12:36:59 +01:00
senke
d286ef5127 chore: add Turborepo for monorepo orchestration
- Add turbo devDependency and packageManager to root
- Create turbo.json with build, test, lint pipeline
- Add package.json to veza-backend-api, veza-chat-server, veza-stream-server
- Extend workspaces to include Go and Rust services
- Migrate CI to use turbo run for build, test, lint
2026-02-14 22:38:32 +01:00
senke
7f7b6547bc chore: consolidate pending changes (Hyperswitch, PostCard, dashboard, stream server, etc.) 2026-02-14 21:45:15 +01:00
senke
20073c47ab feat(chat): make timeouts configurable via environment variables 2026-02-14 18:26:02 +01:00
senke
04c25aa24f Phase 2 stabilisation: code mort, Modal→Dialog, feature flags, tests, router split, Rust legacy
Bloc A - Code mort:
- Suppression Studio (components, views, features)
- Suppression gamification + services mock (projectService, storageService, gamificationService)
- Mise à jour Sidebar, Navbar, locales

Bloc B - Frontend:
- Suppression modal.tsx deprecated, Modal.stories (doublon Dialog)
- Feature flags: PLAYLIST_SEARCH, PLAYLIST_RECOMMENDATIONS, ROLE_MANAGEMENT = true
- Suppression 19 tests orphelins, retrait exclusions vitest.config

Bloc C - Backend:
- Extraction routes_auth.go depuis router.go

Bloc D - Rust:
- Suppression security_legacy.rs (code mort, patterns déjà dans security/)
2026-02-14 17:23:32 +01:00
senke
b5881bc165 fix(chat): resolve compilation errors and clean all warnings
- Replace ChatError::AuthError (nonexistent variant) with InvalidToken
  and ServiceUnavailable in jwt_manager.rs
- Remove unused imports: ExchangeDeclareOptions, ExchangeKind (event_bus),
  StatusCode (request_id), warn (typing_indicator), AsyncCommands (rate_limiter)
- Fix unnecessary mut: delivered_status.rs, read_receipts.rs
- Prefix unused struct fields: _config, _connection (event_bus), _secret (csrf)
- Prefix unused variables: _metadata, parent_message_id: _ (handler.rs),
  user_id: _ (permission.rs)
- Allow dead_code on GetMessagesQuery and exchange_kind_from_str

Chat server now compiles with zero errors and zero warnings.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 23:33:02 +01:00
senke
78db1fa684 fix(security): add SSRF protection, real track access validation, and pagination bounds
- Add IsURLSafe() function to webhook service blocking private IPs,
  localhost, and cloud metadata endpoints (SSRF protection)
- Implement real validate_track_access() in stream server querying DB
  for track visibility, ownership, and purchase status
- Remove dangerous JWT fallback user in chat server that allowed
  deleted users to maintain access with forged credentials
- Add upper limit (100) on pagination in profile, track, and room handlers
- Fix Dockerfile.production healthcheck path to /api/v1/health

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 22:44:03 +01:00
senke
52eab4bdae fix(chat): replace Regex::new().unwrap() with static Lazy in security_legacy.rs
Replace 65+ Regex::new().unwrap() calls with three once_cell::sync::Lazy
static collections:

- DANGEROUS_PATTERNS: 60+ XSS/SQL/command injection regexes
- ROOM_NAME_REGEX: room name character validation
- TOXIC_PATTERNS: 5 toxicity detection regexes

All patterns are compiled once at startup with .ok() filter for safety.
ContentFilter, ToxicityDetector now clone from the statics.

Also adds pub mod security_legacy to lib.rs so the module is compiled
and checked during CI builds.

Addresses audit finding D9: .unwrap() on Regex::new() in legacy code.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 23:27:54 +01:00
senke
d53f3706fa refactor(chat): deduplicate JwtManager algorithm/key/validation setup
Extract build_keys_and_validation() private helper that encapsulates
the 20 lines of algorithm parsing, EncodingKey/DecodingKey creation,
and Validation configuration previously duplicated between new() and
with_revocation_store_only().

- Remove with_revocation_store_only() intermediate function
- with_revocation_store() now calls build_keys_and_validation() directly
- with_pool_and_store() delegates to with_revocation_store()

Addresses audit finding D10: code duplication in JwtManager constructors.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 23:24:39 +01:00
senke
f71df24b2d fix(chat): implement real ContentFilter with XSS/injection pattern detection
Replace the stub filter_content() that always returned true with a real
implementation using compiled regex patterns:

- XSS vectors: <script>, javascript:, onXxx=, <iframe>, <object>, <embed>
- SQL injection: UNION SELECT, DROP TABLE, OR 1=1, ' OR '
- Command injection: eval(), exec()

Patterns compiled once at startup via once_cell::sync::Lazy with safe
.ok() filter (no .unwrap()). Returns false (reject) on pattern match.

Also enhances validate_content() to check dangerous patterns and return
a proper error.

Addresses audit findings D4, A04: ContentFilter stub always returned true.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 23:22:46 +01:00
senke
3a68a5a48e fix(chat): replace .unwrap() with safe alternatives in production code
- request_id.rs:36: UUID.to_string().parse().unwrap() replaced with
  unwrap_or_else fallback to HeaderValue::from_static("unknown")
- prometheus_metrics.rs:357: Response::builder().body().unwrap() replaced
  with unwrap_or_else fallback to a plain error response

Both were panic-capable paths in request handling middleware.

Addresses audit finding D9: .unwrap() in production code.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 23:20:49 +01:00
senke
7c73f538ae fix(deps): upgrade outdated Rust dependencies across services
stream-server (Cargo.toml):
- sqlx 0.7 -> 0.8
- redis 0.25 -> 0.27 (fix query_async generic args in revocation_store.rs)
- bcrypt 0.15 -> 0.17
- thiserror 1.0 -> 2.0
- dashmap 5.5 -> 6.1

veza-common (Cargo.toml):
- sqlx 0.7 -> 0.8 (required to avoid libsqlite3-sys link conflict)
- thiserror 1.0 -> 2.0

chat-server (Cargo.toml):
- sqlx 0.7 -> 0.8 (alignment with veza-common)

Addresses audit findings D2, A06: outdated Rust dependencies.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 23:18:34 +01:00
senke
f8993c7323 fix(deps): upgrade jsonwebtoken 9.2 -> 10.x in chat-server
- Upgrade jsonwebtoken from 9.2 to 10.x with aws_lc_rs crypto backend
- The API (encode, decode, Validation, EncodingKey, DecodingKey, Header,
  Algorithm) remains compatible -- the main v10 change is the crypto
  backend selection via features
- Aligns with veza-stream-server which already uses jsonwebtoken 10

Addresses audit finding: A06 (Vulnerable & Outdated Components).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 22:46:47 +01:00
senke
34b4072d3e feat(chat): implement Redis rate limiting for WebSocket messages
- Create security/rate_limiter.rs with Redis-backed sliding window counter
- Falls back to in-memory HashMap when Redis is unavailable
- Per-action rate limits: messages (30/min), reactions (60/min),
  edits (20/min), deletes (10/min), typing (120/min), joins (10/min),
  searches (15/min)
- Integrate rate limiting into handle_incoming_message in WebSocket handler
- Add RateLimiter to WebSocketState, initialized from REDIS_URL env var
- Rate-limited clients receive an Error message, connection stays open
- Includes unit tests for in-memory fallback path
- Remove TODO stub from EnhancedSecurity::validate_request

Addresses audit findings: A04 (Insecure Design), debt item 3.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 22:45:39 +01:00
senke
368d2a40aa chore(rust): chat server env, veza-common auth, stream server routes/websocket
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 22:19:17 +01:00
senke
38c3cb9fb0 feat(chat): add JWT revocation persistante Redis (P3.1)
- Add JwtRevocationStore trait with InMemoryRevocationStore and RedisRevocationStore
- Wire Redis store when REDIS_URL is set (fallback in-memory if Redis unavailable)
- JWT blacklist persists across restarts when using Redis

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 22:06:25 +01:00
senke
fde65e11dc fix(chat): restore compilation - add reactions module, imports, request_id param
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 22:04:11 +01:00
senke
a5b347ec9c stabilisation commit 2026-01-04 01:44:23 +01:00
senke
1a0d2bb7c9 [T0-002] fix(rust): Corriger erreurs compilation Rust
- Conflit SQLx résolu (alignement sur version 0.7)
- build.rs configurés pour protoc dans chat/stream servers
- API Prometheus migrée vers HistogramOpts
- Traits Display/Debug corrigés (String au lieu de &dyn Display)
- API TOTP corrigée (totp-rs 5.4 avec Secret::Encoded)
- Layers tracing-subscriber corrigés (types conditionnels)
- VezaError/VezaResult exportés dans lib.rs
- TransactionProvider simplifié (retour void au lieu de Box<dyn>)
- VezaConfig contraint Serialize pour to_json()

Files: veza-common/Cargo.toml, veza-common/src/*.rs, veza-chat-server/Cargo.toml, veza-chat-server/build.rs, veza-stream-server/Cargo.toml, veza-stream-server/build.rs, VEZA_ROADMAP.json
Hours: 8 estimated, 3 actual
2026-01-04 01:44:20 +01:00
senke
b6e20cee07 [FIX] PROD-003: Corriger imports use-toast → useToast 2026-01-04 01:44:17 +01:00
senke
601563ddb4 [LOGGING] Fix #24: Standardisation LOG_LEVEL pour tous les services - Support LOG_LEVEL dans Rust et frontend avec fallback 2026-01-04 01:44:16 +01:00
senke
c7521964b1 [LOGGING] Fix #13: Corrélation request_id pour WebSocket dans chat-server - Extraction depuis extensions et utilisation dans spans 2026-01-04 01:44:16 +01:00
senke
a73c36b3e6 [LOGGING] Fix #10: Erreurs silencieuses - Ajout de logs avec contexte pour toutes les erreurs dans core/auth et core/track 2026-01-04 01:44:15 +01:00
senke
d0fe8c8ad7 stabilizing veza-backend-api: phase 1 2025-12-16 11:23:49 -05:00
senke
d33c351ac6 refonte: backend-api go first; phase 1 2025-12-12 21:34:34 -05:00
okinrev
8d6ce72bb2 report generation and future tasks selection 2025-12-08 19:57:54 +01:00
okinrev
8caa2fd7ca STABILISATION: phase 3–5 – API contract, tests & chat-server hardening 2025-12-06 17:21:59 +01:00
okinrev
25e82d1e3d STABILISATION: phase 1 & phase 2 2025-12-06 14:45:07 +01:00
okinrev
7127a11318 fix(chat-server): finalize HTTP auth and startup wiring 2025-12-06 13:25:25 +01:00
okinrev
99f960140a security(chat-server): implement auth middleware and permission checks for HTTP API 2025-12-06 13:18:12 +01:00
okinrev
baf5898534 feat(chat-server): implement graceful shutdown with OS signal handling 2025-12-06 12:02:46 +01:00
okinrev
251f803248 feat(chat-server): implement 60s inactivity heartbeat timeout 2025-12-06 12:00:20 +01:00
okinrev
5ffcd50e0a P0: stabilisation backend/chat/stream + nouvelle base migrations v1
Backend Go:
- Remplacement complet des anciennes migrations par la base V1 alignée sur ORIGIN.
- Durcissement global du parsing JSON (BindAndValidateJSON + RespondWithAppError).
- Sécurisation de config.go, CORS, statuts de santé et monitoring.
- Implémentation des transactions P0 (RBAC, duplication de playlists, social toggles).
- Ajout d’un job worker structuré (emails, analytics, thumbnails) + tests associés.
- Nouvelle doc backend : AUDIT_CONFIG, BACKEND_CONFIG, AUTH_PASSWORD_RESET, JOB_WORKER_*.

Chat server (Rust):
- Refonte du pipeline JWT + sécurité, audit et rate limiting avancé.
- Implémentation complète du cycle de message (read receipts, delivered, edit/delete, typing).
- Nettoyage des panics, gestion d’erreurs robuste, logs structurés.
- Migrations chat alignées sur le schéma UUID et nouvelles features.

Stream server (Rust):
- Refonte du moteur de streaming (encoding pipeline + HLS) et des modules core.
- Transactions P0 pour les jobs et segments, garanties d’atomicité.
- Documentation détaillée de la pipeline (AUDIT_STREAM_*, DESIGN_STREAM_PIPELINE, TRANSACTIONS_P0_IMPLEMENTATION).

Documentation & audits:
- TRIAGE.md et AUDIT_STABILITY.md à jour avec l’état réel des 3 services.
- Cartographie complète des migrations et des transactions (DB_MIGRATIONS_*, DB_TRANSACTION_PLAN, AUDIT_DB_TRANSACTIONS, TRANSACTION_TESTS_PHASE3).
- Scripts de reset et de cleanup pour la lab DB et la V1.

Ce commit fige l’ensemble du travail de stabilisation P0 (UUID, backend, chat et stream) avant les phases suivantes (Coherence Guardian, WS hardening, etc.).
2025-12-06 11:14:38 +01:00
okinrev
38ac12b3ad adding initial chat server (Rust) 2025-12-03 20:33:26 +01:00