2.7 KiB
2.7 KiB
Project Plan: LLM Proxy Enhancements & Security Upgrade
This document outlines the roadmap for standardizing frontend security, cleaning up the codebase, upgrading session management to HMAC-signed tokens, and extending integration testing.
Phase 1: Frontend Security Standardization
Primary Agent: frontend-developer
- Audit
static/js/pages/users.jsfor manual HTML string concatenation. - Replace custom escaping or unescaped injections with
window.api.escapeHtml. - Verify user list and user detail rendering for XSS vulnerabilities.
Phase 2: Codebase Cleanup
Primary Agent: backend-developer
- Identify and remove unused imports in
src/config/mod.rs. - Identify and remove unused imports in
src/providers/mod.rs. - Run
cargo clippyandcargo fmtto ensure adherence to standards.
Phase 3: HMAC Architectural Upgrade
Primary Agents: fullstack-developer, security-auditor, backend-developer
3.1 Design (Security Auditor)
- Define Token Structure:
base64(payload).signature.- Payload:
{ "session_id": "...", "username": "...", "role": "...", "exp": ... }
- Payload:
- Select HMAC algorithm (HMAC-SHA256).
- Define environment variable for secret key:
SESSION_SECRET.
3.2 Implementation (Backend Developer)
- Refactor
src/dashboard/sessions.rs:- Integrate
hmacandsha2crates (or similar). - Update
create_sessionto return signed tokens. - Update
validate_sessionto verify signature before checking store.
- Integrate
- Implement activity-based session refresh:
- If session is valid and >50% through its TTL, extend
expires_atand issue new signed token.
- If session is valid and >50% through its TTL, extend
3.3 Integration (Fullstack Developer)
- Update dashboard API handlers to handle new token format.
- Update frontend session storage/retrieval if necessary.
Phase 4: Extended Integration Testing
Primary Agent: qa-automation
- Setup test environment with encrypted key storage enabled.
- Implement end-to-end flow:
- Store encrypted provider key via API.
- Authenticate through Proxy.
- Make proxied LLM request (verifying decryption and usage).
- Validate HMAC token expiration and refresh logic in automated tests.
Phase 5: Code Quality & Refactoring
Primary Agent: fullstack-developer
- Refactor dashboard monolith into modular sub-modules (
auth.rs,usage.rs, etc.). - Standardize error handling and remove
unwrap()in production paths. - Implement system health metrics and backup functionality.
Technical Standards
- Rust: No
unwrap()in production code; use proper error handling (Result). - Frontend: Always use
window.apiwrappers for sensitive operations. - Security: Secrets must never be logged or hardcoded.