Skip to content

Commit fbb5b9e

Browse files
authored
Merge pull request #753 from accius/Chris-Sandbox
Chris sandbox
2 parents 82ab0f4 + 9c24fd7 commit fbb5b9e

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

server/routes/dxpeditions.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,17 @@ module.exports = function (app, ctx) {
3636
let prev;
3737
do {
3838
prev = text;
39-
text = text.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '');
39+
text = text.replace(/<script[^>]*>[\s\S]*?<\/script(?:\s[^>]*)?>/gi, '');
4040
} while (text !== prev);
4141
do {
4242
prev = text;
43-
text = text.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '');
43+
text = text.replace(/<style[^>]*>[\s\S]*?<\/style(?:\s[^>]*)?>/gi, '');
4444
} while (text !== prev);
4545
// Strip any remaining opening script/style tags (malformed HTML)
46-
text = text.replace(/<script[^>]*>/gi, '').replace(/<style[^>]*>/gi, '');
46+
do {
47+
prev = text;
48+
text = text.replace(/<script[^>]*>/gi, '').replace(/<style[^>]*>/gi, '');
49+
} while (text !== prev);
4750
text = text
4851
.replace(/<br\s*\/?>/gi, '\n') // Convert br to newlines
4952
.replace(/<[^>]+>/g, ' ') // Remove all HTML tags

server/routes/pskreporter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ module.exports = function (app, ctx) {
492492
// "Connection closed" errors are expected during reconnects —
493493
// the on('connect') handler will re-subscribe all active callsigns
494494
if (err.message && err.message.includes('onnection closed')) return;
495-
console.error(`[PSK-MQTT] Subscribe error for ${call}:`, err.message);
495+
console.error('[PSK-MQTT] Subscribe error for %s:', call, err.message);
496496
}
497497
});
498498
}
@@ -504,7 +504,7 @@ module.exports = function (app, ctx) {
504504
pskMqtt.client.unsubscribe([txTopic, rxTopic], (err) => {
505505
if (err) {
506506
if (err.message && err.message.includes('onnection closed')) return;
507-
console.error(`[PSK-MQTT] Unsubscribe error for ${call}:`, err.message);
507+
console.error('[PSK-MQTT] Unsubscribe error for %s:', call, err.message);
508508
}
509509
});
510510
}
@@ -525,9 +525,9 @@ module.exports = function (app, ctx) {
525525
pskMqtt.client.subscribe([txTopic, rxTopic], { qos: 0 }, (err) => {
526526
if (err) {
527527
if (err.message && err.message.includes('onnection closed')) return;
528-
console.error(`[PSK-MQTT] Grid subscribe error for ${grid}:`, err.message);
528+
console.error('[PSK-MQTT] Grid subscribe error for %s:', grid, err.message);
529529
} else {
530-
console.log(`[PSK-MQTT] Subscribed grid ${grid}`);
530+
console.log('[PSK-MQTT] Subscribed grid %s', grid);
531531
}
532532
});
533533
}
@@ -539,7 +539,7 @@ module.exports = function (app, ctx) {
539539
pskMqtt.client.unsubscribe([txTopic, rxTopic], (err) => {
540540
if (err) {
541541
if (err.message && err.message.includes('onnection closed')) return;
542-
console.error(`[PSK-MQTT] Grid unsubscribe error for ${grid}:`, err.message);
542+
console.error('[PSK-MQTT] Grid unsubscribe error for %s:', grid, err.message);
543543
}
544544
});
545545
}

server/routes/wsjtx.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,11 @@ module.exports = function (app, ctx) {
481481
// Reject dangerous msg.id values to prevent prototype pollution on state.clients
482482
if (msg.id && !isValidSessionId(msg.id)) return;
483483

484+
// Ensure clients is a prototype-less object to prevent prototype pollution
485+
if (!state.clients || Object.getPrototypeOf(state.clients) !== null) {
486+
state.clients = Object.assign(Object.create(null), state.clients || {});
487+
}
488+
484489
switch (msg.type) {
485490
case WSJTX_MSG.HEARTBEAT: {
486491
state.clients[msg.id] = {

0 commit comments

Comments
 (0)