Skip to content

Audit fixes: security hardening, Room migrations, CI/CD, codecs, debt cleanup#1

Merged
khalilbenaz merged 3 commits into
mainfrom
improve/audit-fixes
Jun 3, 2026
Merged

Audit fixes: security hardening, Room migrations, CI/CD, codecs, debt cleanup#1
khalilbenaz merged 3 commits into
mainfrom
improve/audit-fixes

Conversation

@khalilbenaz

Copy link
Copy Markdown
Owner

Résumé

Audit complet multi-agents (5 sous-systèmes + sécurité/bugs/release) puis implémentation en deux phases. 61 fichiers, ~1500 lignes.

Sécurité (cloudflare-config/worker.js)

  • PBKDF2-SHA256 (100k itérations, format versionné) remplace le SHA-256 simple — compat legacy avec re-hash transparent au login ; min password 4→8
  • protectReads opt-in par MAC : GET /api/config/:mac peut exiger ?password= (toggle dashboard) — lectures anonymes préservées par défaut
  • Fail-closed sur secret de session manquant, comparaisons constant-time, CSRF sur le POST raw-JSON, backoff exponentiel du lockout, headers Referrer-Policy/nosniff

Bugs critiques (android-native)

  • Room : exportSchema=true + fallback destructif limité aux v1-9 — fini le wipe DB (favoris/historique) à chaque bump de schéma
  • Resume VOD réparé (race async), statut recording cancelled/error correct, runBlocking retiré du player (ANR), HlsRecorder dédupliqué par media-sequence, updater vérifie le .sha256 publié

CI/CD + versioning

  • VERSION = source unique (gradle dérive versionName/versionCode)
  • ci.yml (web tsc+vitest · android compile+tests · workers syntax) ; release.yml (gate tag==VERSION, secrets ULTRA_*, publie APK + sha256)

Web / Electron

  • Credentials Xtream plus jamais persistés dans les URLs (reconstruites au play) — les exports backup ne fuitent plus
  • ErrorBoundary TV-friendly, proxy default-deny, sniff gzip EPG ; 18 tests vitest
  • Electron : fork castlabs v33.4.11+wvcus (HEVC/AC3/Widevine), validation scheme openExternal, fallback crash/load, script dev réparé

Divers

  • StalkerClient : session cachée 5 min (plus de handshake à chaque zap) ; android-app marqué DEPRECATED ; Retrofit retiré

Vérification

  • ✅ web : tsc --noEmit clean, vitest 18/18
  • ✅ workers : node --check OK
  • ✅ review adversariale par package (workflow multi-agents)
  • ⚠️ Kotlin non compilé localement (pas d'Android SDK sur la machine) — le job CI android de cette PR fait foi

🤖 Generated with Claude Code

Khalil Benazzouz and others added 3 commits June 3, 2026 10:34
…ding bugs, web + electron robustness

cloudflare-config/worker.js:
- opt-in protectReads per MAC: GET /api/config/:mac requires ?password= when enabled (dashboard toggle, session+CSRF)
- fail-closed session secret (500 if SESSION_SECRET/ADMIN_PASSWORD missing)
- constant-time compares for session/CSRF/password/token checks
- exponential login lockout backoff, JSON.parse lockout guard
- CSRF on raw-JSON POST /api/config/:mac
- Referrer-Policy + nosniff headers; CRASH_TOKEN documented

android-native:
- Room: exportSchema=true, schemaLocation, destructive fallback limited to v1-9 (no more DB wipe on future bumps)
- fix VOD resume race (prepareResume now suspend, seekTo gets real value)
- RecordingWorker: cancelled no longer overwritten by done; retryable vs terminal failures ("error" status, surfaced in UI)
- replace runBlocking in PlayerScreen composition with produceState (ANR)
- HlsRecorder: dedupe by media-sequence index (sliding playlist gaps + unbounded memory)
- ReminderReceiver: goAsync + scoped job instead of GlobalScope
- UpdateChecker: verify .sha256 sibling asset when published; drop dead versionCodeNormalised

web:
- fix series whitelist bug (dead vodCats overwrite) — extracted filterCategories helpers + tests
- top-level ErrorBoundary with TV-friendly fallback wired to diag buffer
- proxy worker default-deny (ALLOWED_HOSTS mandatory)
- EPG gzip magic-byte sniff + tests (vitest 9/9, tsc clean)

electron:
- validate URL scheme before shell.openExternal (http/https only)
- did-fail-load / render-process-gone / unresponsive fallback page
- scope header rewriting to http(s), document webSecurity tradeoff
- dev script sets SV_DEV via cross-env

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…web credential hygiene, debt cleanup

cloudflare-config/worker.js:
- PBKDF2-SHA256 (100k iters, versioned pbkdf2$<iters>$<hex> format) replaces single-pass SHA-256
- backward compat: legacy hashes verified then transparently re-hashed on login
- min password length 4 -> 8 (signup, change, UI hints, README)

CI/CD + versioning:
- VERSION file as single source; build.gradle.kts derives versionName + versionCode (10029)
- .github/workflows/ci.yml: web (tsc+vitest), android (compile+unit tests), workers (node --check)
- .github/workflows/release.yml: tag==VERSION gate, ULTRA_* secrets with debug fallback, publishes UltraTV-debug.apk + .sha256

electron:
- switch to castlabs fork pinned via GitHub tag v33.4.11+wvcus (HEVC/AC3/EAC3/Widevine); npm registry alias doesn't work (404) and semver ignores +wvcus metadata
- electron/README.md (codecs, EVS signing notes, icon generation); build/ buildResources un-ignored

web:
- stop persisting Xtream credentials in stored stream URLs; URLs rebuilt at play time from provider record (backup exports no longer leak credentials); 9 new URL-builder tests (vitest 18/18, tsc clean)
- remove dead proxy code (proxiedStreamUrl, getProxy, LEGACY_DEFAULTS)

android-native:
- StalkerClient: session token cached per provider (5 min TTL, invalidated on auth failure) — no more handshake on every zap
- RemoteLog URL/token moved to BuildConfig fields (gradle prop/env overridable)
- Search result opens the channel via the same player route as Live
- remove unused Retrofit deps; drop redundant usesCleartextTraffic manifest flag

android-app: marked DEPRECATED (README), dead Firebase wiring + boilerplate tests removed

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…dlew

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@khalilbenaz khalilbenaz merged commit 5985aa0 into main Jun 3, 2026
3 checks passed
@khalilbenaz khalilbenaz deleted the improve/audit-fixes branch June 3, 2026 14:53
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.

1 participant