Files
Kecalek_python/TODO.md
2026-03-14 12:43:56 +01:00

132 lines
6.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TODO
## Zbývající bezpečnostní nálezy
### HIGH
- [ ] **H9: Self-encryption key** — statický/deterministický klíč z identity key (by-design pro cross-device čtení, architektonické omezení — žádná forward secrecy pro self-copies)
### MEDIUM
- [ ] **M7: MySQL TLS**`db.get_connection()` nepředává SSL parametry. Na vzdáleném serveru jdou DB credentials v plaintextu. Přidat `ssl_ca`, `ssl_cert`, `ssl_key`.
### LOW (nízké riziko)
- [ ] L1: Hex string keys v skipped messages dict — timing side-channel (post-auth)
- [ ] L2: RatchetHeader redundantní type konverze
- [ ] L3: `notif_label.setText()` vs `setHtml()` křehkost
- [ ] L4: SQL column interpolation v `update_user_profile` (whitelist chrání)
- [ ] L5: TLS cipher suite hardening (Python defaults rozumné, ne explicitní)
- [ ] L6: Temporary pairing key cleanup z paměti
- [ ] L7: `_user_cache` indefinite growth
## Funkční TODO
### High Priority
- [ ] **Sender Key Redistribution** — při `add_member` redistribuovat sender keys všem členům včetně nového. Nový člen skupiny momentálně nedešifruje staré zprávy.
### Medium Priority
- [ ] **iOS: Contact Key Verification** — safety numbers, fingerprints, QR kódy, TOFU registr. Spec viz CLAUDE.md (iOS implementation spec).
- [ ] Typing indicators (`typing_start`/`typing_stop` + 3s timeout, debounce)
- [ ] Delivery receipts (`message_delivered` notifikace — 1 fajfka odesláno, 2 fajfky doručeno, modré přečteno)
- [ ] Group admin roles (více adminů)
- [ ] Edit sent messages
### Low Priority
- [ ] Desktop notifications (system tray)
- [ ] Image gallery view
- [ ] Systemd + Docker deployment
## Před nasazením do produkce
- [ ] **TLS certifikáty** — Let's Encrypt nebo vlastní CA. `TLS_ENABLED=true`, `TLS_CERT_FILE`, `TLS_KEY_FILE`.
- [ ] **SMTP** — reálný SMTP server pro registrační kódy.
- [ ] **MySQL TLS** — SSL parametry v `db.get_connection()` pokud DB na jiném stroji.
- [ ] **UPLOAD_DIR** — persistentní disk, dostatečná kapacita, správná práva (0o700).
- [ ] **Backup** — pravidelný backup MySQL + UPLOAD_DIR.
- [ ] **Packaging** — pyinstaller / cx_Freeze pro distribuci klientů.
- [ ] **Penetrační testy** — manuální + automatizované (path traversal, DoS, race conditions, enumeration, TLS downgrade, pairing hijacking).
## Budoucí plány
- [ ] WebSocket upgrade (nahradit raw TCP pro lepší kompatibilitu)
- [ ] Mobilní push notifikace (APNs + FCM)
- [ ] Auto-update klientů (po packagingu)
- [ ] Monetizace — oddělený platební server (Stripe), premium kódy, free/premium tier. Detaily viz CLAUDE.md.
## Phantom Users — Distributed Cap
Pro multi-process deployment:
1. DB-backed quota (`system_quotas` tabulka, `SELECT ... FOR UPDATE`)
2. Same-email races přes `UNIQUE(email)`
3. Periodic reconciliation job
4. Shared rate-limits (Redis nebo DB atomic counters)
5. Concurrency testy
## Hotovo
### Security (všechny CRITICAL + většina HIGH/MEDIUM opraveny)
- [x] C1: readuntil DoS → LimitOverrunError handling
- [x] C2: SenderKeyState fast-forward DoS → MAX_SENDER_KEY_SKIP=256
- [x] C3: Plaintext message cache → AES-256-GCM šifrování
- [x] C4: OPK file permissions → chmod 0o600
- [x] C5: Upload size validation → received_bytes == file_size check
- [x] C6: Path traversal → UUID validace + is_relative_to
- [x] H1: Session/sender key šifrování → AES-256-GCM via _local_key
- [x] H2+H14: TLS hardening → ENVIRONMENT=dev guard
- [x] H3+H13: Anti-enumeration → generické odpovědi, auth pro get_user_info
- [x] H4: Race conditions → 5 asyncio.Lock guardů
- [x] H5+H6: Protocol error handling → base64/JSON exception handling
- [x] H7: Avatar path traversal → _safe_avatar_path
- [x] H8: Password memory → bytearray + zero-out
- [x] H10: Image validation → size + dimensions check
- [x] H11: Filename sanitization → os.path.basename
- [x] H12: OPK race condition → SELECT FOR UPDATE
- [x] M2: HKDF salt → b"\x00"*32
- [x] M3: PBKDF2 600k iterations (ECP1 formát)
- [x] M4: SPK rotace 7 dní + grace period
- [x] M5: Rate limit cleanup
- [x] M6: TOCTOU → remove_conversation_member_atomic
- [x] M8: UUID validace všech handlerů
- [x] M9: Ratchet state rollback (snapshot/restore)
- [x] M10: message_ids cap (500)
- [x] M11: Pairing poll token (secrets.token_hex)
- [x] M12: Upload end size validation
- [x] M13: chmod 0o700/0o600 na klíčové adresáře/soubory
- [x] L8: Phantom user cleanup (30 dní + email validace)
- [x] SPK/OPK šifrování na disku
- [x] Brute-force lockout (exponenciální backoff)
### Features
- [x] X3DH + Double Ratchet (Signal Protocol)
- [x] Sender Keys pro skupiny
- [x] Multi-device support (per-device sessions, pairing)
- [x] Kontaktní verifikace (safety numbers, fingerprints, QR kódy) — Python klienti
- [x] Message padding (bucketed 64B64KB)
- [x] Metadata privacy (log sanitizace, retention, sender chain minimalizace)
- [x] Secure deletion (overwrite + fsync + unlink)
- [x] Reakce na zprávy (6 emoji typů)
- [x] Přeposílání zpráv (text, obrázky, soubory)
- [x] Připnuté zprávy (pin/unpin + dialog)
- [x] @Mentions s autocomplete
- [x] Hledání zpráv (client-side, Ctrl+F)
- [x] Šifrované obrázky + soubory (chunked upload, až 50 MB)
- [x] Skupinové pozvánky (accept/decline)
- [x] Leave group + přenos creatora
- [x] Rename group (creator only)
- [x] Delete conversation
- [x] Group avatar
- [x] User profily (telefon, lokace, avatar, viditelnost)
- [x] Online/offline status
- [x] Unread count badges (server-side pro offline uživatele)
- [x] Privacy overlay / lock screen
- [x] Dark/light téma (Catppuccin + Signal) s live switching
- [x] Session recovery (reset + auto X3DH)
- [x] Connection indicator + auto-reconnect
- [x] Drag & drop souborů
- [x] Favorites (GUI)
- [x] Phantom users (anti-enumeration)
- [x] DB connection pooling (pool_size=10)
- [x] Version negotiation (0.8.4, MIN_CLIENT_VERSION=0.8.3)
- [x] Graceful server shutdown
- [x] iOS klient (47 Swift souborů, ~5 000 řádků)
- [x] CLI klient (23 menu opcí)
- [x] Pentest harness (4 test kategorií)