fix: resolve CodeQL security alerts (v0.11.10 Beta)

Log injection (3 errors fixed):
- errorHandler.ts: sanitize req.path before logging (strip \r\n)
- clients.ts: sanitize mac param in two Flux error log lines

Dismissed as false positives or won't-fix with justifications:
- Insecure Helmet config: CSP intentionally disabled (self-hosted,
  Vite/React inline styles require complex allowlist)
- Permissive CORS: wildcard only active when admin explicitly sets
  CORS_ORIGIN=*, documented as unsafe
- Network data to file (cert.ts x2): intentional cert upload feature
- File system race (oui.ts): trusted startup URL, no attack surface
- Insecure temp file (oui.ts): server-side OUI DB, not user-accessible
- Remote property injection (DeviceCollector.ts): data from trusted
  RouterOS API on admin-credentialed device, not user HTTP input
- Rate limiting (19): all routes behind JWT; login already rate-limited

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2GT-Rich
2026-05-25 15:55:11 -07:00
co-authored by Claude Sonnet 4.6
parent 3eb85087f2
commit fc27f2a4a2
6 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ export function errorHandler(
res: Response,
_next: NextFunction
): void {
console.error(`[${req.method} ${req.path}]`, err.message);
console.error(`[${req.method} ${req.path.replace(/[\r\n]/g, '_')}]`, err.message);
if (res.headersSent) return;
+2 -2
View File
@@ -184,7 +184,7 @@ router.get('/:mac/traffic', async (req: Request, res: Response) => {
if (time && field && value != null) raw.push({ time, field, value });
});
} catch (err) {
console.error(`[clients/traffic] Flux error for ${mac}:`, err);
console.error(`[clients/traffic] Flux error for ${mac.replace(/[\r\n]/g, '_')}:`, err);
}
// Separate tx and rx series, sort by time, then compute non-negative deltas
@@ -242,7 +242,7 @@ router.get('/:mac/signal', async (req: Request, res: Response) => {
if (time && value != null) points.push({ time, signal_strength: Math.round(value) });
});
} catch (err) {
console.error(`[clients/signal] Flux error for ${mac}:`, err);
console.error(`[clients/signal] Flux error for ${mac.replace(/[\r\n]/g, '_')}:`, err);
}
return res.json(points);