Fix all backend lint errors and security vulnerabilities
Backend lint (4 errors fixed): - auth.ts: suppress @typescript-eslint/no-namespace on Express global augmentation (legitimate TS pattern for extending Request type) - clients.ts: remove unnecessary \. escape in regex character class - devices.ts: remove unnecessary \- escape by moving hyphen to front [-:] - PollerService.ts: add comment to empty catch block Security audit (high/critical CVEs fixed): - frontend: bump axios (critical SSRF), lodash (high injection), follow-redirects (moderate) via npm audit fix - backend: bump nodemailer 6.x → 8.0.5 (fixes 4 SMTP injection CVEs)
This commit is contained in:
Generated
+4
-4
@@ -20,7 +20,7 @@
|
||||
"ioredis": "^5.3.2",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"morgan": "^1.10.0",
|
||||
"nodemailer": "^6.9.13",
|
||||
"nodemailer": "^8.0.5",
|
||||
"pg": "^8.11.3",
|
||||
"socket.io": "^4.6.1",
|
||||
"ssh2": "^1.14.0",
|
||||
@@ -3055,9 +3055,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/nodemailer": {
|
||||
"version": "6.10.1",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.10.1.tgz",
|
||||
"integrity": "sha512-Z+iLaBGVaSjbIzQ4pX6XV41HrooLsQ10ZWPUehGmuantvzWoDVBnmsdUcOIDM1t+yPor5pDhVlDESgOMEGxhHA==",
|
||||
"version": "8.0.5",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-8.0.5.tgz",
|
||||
"integrity": "sha512-0PF8Yb1yZuQfQbq+5/pZJrtF6WQcjTd5/S4JOHs9PGFxuTqoB/icwuB44pOdURHJbRKX1PPoJZtY7R4VUoCC8w==",
|
||||
"license": "MIT-0",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"ioredis": "^5.3.2",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"morgan": "^1.10.0",
|
||||
"nodemailer": "^6.9.13",
|
||||
"nodemailer": "^8.0.5",
|
||||
"pg": "^8.11.3",
|
||||
"socket.io": "^4.6.1",
|
||||
"ssh2": "^1.14.0",
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface AuthPayload {
|
||||
}
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace Express {
|
||||
interface Request {
|
||||
user?: AuthPayload;
|
||||
|
||||
@@ -251,7 +251,7 @@ router.get('/:mac/signal', async (req: Request, res: Response) => {
|
||||
// POST /api/clients/:mac/wol — send Wake-on-LAN magic packet
|
||||
router.post('/:mac/wol', requireWrite, async (req: Request, res: Response) => {
|
||||
const mac = req.params.mac.replace(/[^0-9a-fA-F:.-]/g, '');
|
||||
const hexMac = mac.replace(/[:\-\.]/g, '');
|
||||
const hexMac = mac.replace(/[:\-.]/g, '');
|
||||
if (hexMac.length !== 12) {
|
||||
return res.status(400).json({ error: 'Invalid MAC address' });
|
||||
}
|
||||
|
||||
@@ -1464,7 +1464,7 @@ router.post('/:id/tools/wol', requireWrite, async (req: Request, res: Response)
|
||||
if (!iface) return res.status(400).json({ error: 'interface is required' });
|
||||
|
||||
// Basic MAC validation
|
||||
if (!/^([0-9A-Fa-f]{2}[:\-]){5}[0-9A-Fa-f]{2}$/.test(mac)) {
|
||||
if (!/^([0-9A-Fa-f]{2}[-:]){5}[0-9A-Fa-f]{2}$/.test(mac)) {
|
||||
return res.status(400).json({ error: 'Invalid MAC address format' });
|
||||
}
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ export class PollerService {
|
||||
try {
|
||||
const { redis } = await import('../config/redis');
|
||||
await redis.set(key, String(ts), 'EX', 600);
|
||||
} catch {}
|
||||
} catch { /* redis unavailable — timestamp not cached */ }
|
||||
}
|
||||
|
||||
private startWorkers(): void {
|
||||
|
||||
Reference in New Issue
Block a user