SECURITY-HARDENING
Guide for SECURITY-HARDENING
Mission: Security Hardening & Vulnerability Remediation
Status: In Progress
Owner: Senior Security Engineer (Red/Blue Team)
Priority: P0 (Critical)
Overview
Address the 20 vulnerabilities identified in the 2026-01-27 Security Audit. This mission focuses on securing player data, preventing DoS attacks, and fixing critical authentication flaws.
Objectives
- Secure Authentication: Eliminate legacy hashing and duplicate auth paths.
- Protect Player Data: Fix Google Login data wipe and Trading metadata loss.
- Encrypted PII: Encrypt sensitive user data (email, ticket content) at rest using externalized keys (AES-256-GCM).
- Harden APIs: Secure Ticket and Shop APIs against PII leaks and race conditions.
- Prevent Denial of Service: Implement proper rate limiting and connection caps.
Implementation Plan
Phase 1: Critical Fixes (Data Loss & Auth) ✅
- Fix Insecure Password Hashing
- Remove
api-game/src/api/auth_handlers.rs(Insecure Placeholder). - Ensure all routes use
logic_core::auth(Argon2).
- Remove
- Fix Google Login Data Wipe
- Update
websocket.rsto load existing player state before overwriting.
- Update
- Fix Trading Metadata Loss
- Update
trading/manager.rsto query and restore item metadata.
- Update
- Fix WebSocket Connection Limit
- Lower IP limit from 500 to 10.
Phase 2: API Security & Encryption (In Progress)
- PII Encryption (External Key)
- Infrastructure: Add
PII_ENCRYPTION_KEY(32-byte hex) to.env. - Implementation: Create
EncryptionServiceusingaes-gcm. - Migration: Encrypt
users.emailandtickets.contentcolumns. - Ticket API: Decrypt on-the-fly ONLY for authorized admins (with
X-Admin-Secret).
- Infrastructure: Add
- Secure Ticket API
- Add
X-Admin-Secretcheck toGET /tickets. - Patch Prompt Injection vector in Gemini classifier.
- Add
- Secure Shop API
- Fix Shop Stock Race Condition (Atomic/Durable Object or optimistic locking).
- Add Auth/Captcha to
POST /orders.
Phase 3: Cleanup & Hardening
- Remove Sensitive Logs (Reset Tokens).
- Fix Handler Panics (Replace
expectwithResult). - Implement Rate Limiting on missing endpoints.