Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions server/routes/dxpeditions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ module.exports = function (app, ctx) {
let prev;
do {
prev = text;
text = text.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '');
text = text.replace(/<script[^>]*>[\s\S]*?<\/script(?:\s[^>]*)?>/gi, '');
} while (text !== prev);
do {
prev = text;
text = text.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '');
text = text.replace(/<style[^>]*>[\s\S]*?<\/style(?:\s[^>]*)?>/gi, '');
} while (text !== prev);
// Strip any remaining opening script/style tags (malformed HTML)
text = text.replace(/<script[^>]*>/gi, '').replace(/<style[^>]*>/gi, '');
do {
prev = text;
text = text.replace(/<script[^>]*>/gi, '').replace(/<style[^>]*>/gi, '');
} while (text !== prev);
text = text
.replace(/<br\s*\/?>/gi, '\n') // Convert br to newlines
.replace(/<[^>]+>/g, ' ') // Remove all HTML tags
Expand Down
10 changes: 5 additions & 5 deletions server/routes/pskreporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ module.exports = function (app, ctx) {
// "Connection closed" errors are expected during reconnects —
// the on('connect') handler will re-subscribe all active callsigns
if (err.message && err.message.includes('onnection closed')) return;
console.error(`[PSK-MQTT] Subscribe error for ${call}:`, err.message);
console.error('[PSK-MQTT] Subscribe error for %s:', call, err.message);
}
});
}
Expand All @@ -504,7 +504,7 @@ module.exports = function (app, ctx) {
pskMqtt.client.unsubscribe([txTopic, rxTopic], (err) => {
if (err) {
if (err.message && err.message.includes('onnection closed')) return;
console.error(`[PSK-MQTT] Unsubscribe error for ${call}:`, err.message);
console.error('[PSK-MQTT] Unsubscribe error for %s:', call, err.message);
}
});
}
Expand All @@ -525,9 +525,9 @@ module.exports = function (app, ctx) {
pskMqtt.client.subscribe([txTopic, rxTopic], { qos: 0 }, (err) => {
if (err) {
if (err.message && err.message.includes('onnection closed')) return;
console.error(`[PSK-MQTT] Grid subscribe error for ${grid}:`, err.message);
console.error('[PSK-MQTT] Grid subscribe error for %s:', grid, err.message);
} else {
console.log(`[PSK-MQTT] Subscribed grid ${grid}`);
console.log('[PSK-MQTT] Subscribed grid %s', grid);
}
});
}
Expand All @@ -539,7 +539,7 @@ module.exports = function (app, ctx) {
pskMqtt.client.unsubscribe([txTopic, rxTopic], (err) => {
if (err) {
if (err.message && err.message.includes('onnection closed')) return;
console.error(`[PSK-MQTT] Grid unsubscribe error for ${grid}:`, err.message);
console.error('[PSK-MQTT] Grid unsubscribe error for %s:', grid, err.message);
}
});
}
Expand Down
5 changes: 5 additions & 0 deletions server/routes/wsjtx.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,11 @@ module.exports = function (app, ctx) {
// Reject dangerous msg.id values to prevent prototype pollution on state.clients
if (msg.id && !isValidSessionId(msg.id)) return;

// Ensure clients is a prototype-less object to prevent prototype pollution
if (!state.clients || Object.getPrototypeOf(state.clients) !== null) {
state.clients = Object.assign(Object.create(null), state.clients || {});
}

switch (msg.type) {
case WSJTX_MSG.HEARTBEAT: {
state.clients[msg.id] = {
Expand Down