mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 12:32:10 +01:00
fix: address multiple code review issues across platform components
- Fix maxUsers input validation to prevent negative values and handle NaN cases - Enhance error handling in fetchCompany with detailed logging and context - Implement actual cache invalidation logic with pattern-based clearing - Add comprehensive cache optimization with memory management - Remove unsafe type casting in performance history analytics - Improve form validation and authentication patterns - Update documentation to mask sensitive data in examples
This commit is contained in:
@ -65,8 +65,8 @@ const data = await response.json();
|
||||
"severity": "HIGH",
|
||||
"userId": "user-456",
|
||||
"companyId": "company-789",
|
||||
"ipAddress": "192.168.1.100",
|
||||
"userAgent": "Mozilla/5.0...",
|
||||
"ipAddress": "192.168.1.***",
|
||||
"userAgent": "Mozilla/5.0 (masked)",
|
||||
"timestamp": "2024-01-01T12:00:00Z",
|
||||
"description": "Failed login attempt",
|
||||
"metadata": {
|
||||
|
||||
@ -136,8 +136,8 @@ const metrics = await response.json();
|
||||
"sourceFile": "https://example.com/page",
|
||||
"riskLevel": "high",
|
||||
"bypassAttempt": true,
|
||||
"ipAddress": "192.168.1.100",
|
||||
"userAgent": "Mozilla/5.0..."
|
||||
"ipAddress": "192.168.1.***",
|
||||
"userAgent": "Mozilla/5.0 (masked)"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -425,9 +425,16 @@ CSP_ALERT_THRESHOLD=5 # violations per 10 minutes
|
||||
|
||||
### Privacy Protection
|
||||
|
||||
- **IP anonymization** option for GDPR compliance
|
||||
- **User agent sanitization** removes sensitive information
|
||||
- **No personal data** stored in violation reports
|
||||
**⚠️ Data Collection Notice:**
|
||||
- **IP addresses** are collected and stored in memory for security monitoring
|
||||
- **User agent strings** are stored for browser compatibility analysis
|
||||
- **Legal basis**: Legitimate interest for security incident detection and prevention
|
||||
- **Retention**: In-memory storage only, automatically purged after 7 days or application restart
|
||||
- **Data minimization**: Only violation-related metadata is retained, not page content
|
||||
|
||||
**Planned Privacy Enhancements:**
|
||||
- IP anonymization options for GDPR compliance (roadmap)
|
||||
- User agent sanitization to remove sensitive information (roadmap)
|
||||
|
||||
### Rate Limiting Protection
|
||||
|
||||
|
||||
@ -21,12 +21,12 @@ The optimization focuses on the most frequently queried patterns in the applicat
|
||||
```sql
|
||||
-- Query pattern: companyId + processingStatus + requestedAt
|
||||
CREATE INDEX "AIProcessingRequest_companyId_processingStatus_requestedAt_idx"
|
||||
ON "AIProcessingRequest" ("sessionId", "processingStatus", "requestedAt");
|
||||
ON "AIProcessingRequest" ("companyId", "processingStatus", "requestedAt");
|
||||
|
||||
-- Covering index for batch processing
|
||||
CREATE INDEX "AIProcessingRequest_session_companyId_processingStatus_idx"
|
||||
ON "AIProcessingRequest" ("sessionId")
|
||||
INCLUDE ("processingStatus", "batchId", "requestedAt");
|
||||
CREATE INDEX "AIProcessingRequest_companyId_processingStatus_covering_idx"
|
||||
ON "AIProcessingRequest" ("companyId")
|
||||
INCLUDE ("processingStatus", "batchId", "requestedAt", "sessionId");
|
||||
```
|
||||
|
||||
**Impact**:
|
||||
|
||||
@ -104,8 +104,8 @@ import { securityAuditLogger, AuditOutcome } from "./lib/securityAuditLogger";
|
||||
await securityAuditLogger.logAuthentication("user_login_success", AuditOutcome.SUCCESS, {
|
||||
userId: "user-123",
|
||||
companyId: "company-456",
|
||||
ipAddress: "192.168.1.1",
|
||||
userAgent: "Mozilla/5.0...",
|
||||
ipAddress: "192.168.1.***",
|
||||
userAgent: "Mozilla/5.0 (masked)",
|
||||
metadata: { loginMethod: "password" },
|
||||
});
|
||||
|
||||
|
||||
@ -191,7 +191,7 @@ const analysis = await fetch("/api/admin/security-monitoring/threat-analysis", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
ipAddress: "192.168.1.100",
|
||||
ipAddress: "192.168.1.***",
|
||||
timeRange: {
|
||||
start: "2024-01-01T00:00:00Z",
|
||||
end: "2024-01-02T00:00:00Z",
|
||||
|
||||
Reference in New Issue
Block a user