fix: Increase maxStringLength for large handshake messages
**Motivations :** - Fix WebSocket message validation for large handshake messages - Allow processing of long peer lists in handshake content **Modifications :** - Increased maxStringLength from 10000 to 100000 characters - Added detailed error logging for validation failures **Pages affectées :** - src/services/message-validator.ts - Increased string length limit - src/websockets.ts - Enhanced error logging
This commit is contained in:
parent
a96a292089
commit
82e37cbff7
@ -17,7 +17,7 @@ export interface WebSocketMessage {
|
|||||||
export class MessageValidator {
|
export class MessageValidator {
|
||||||
private static instance: MessageValidator;
|
private static instance: MessageValidator;
|
||||||
private maxMessageSize = 1024 * 1024; // 1MB
|
private maxMessageSize = 1024 * 1024; // 1MB
|
||||||
private maxStringLength = 10000;
|
private maxStringLength = 100000; // Increased for large handshake messages
|
||||||
private allowedFlags = ['Handshake', 'NewTx', 'Cipher', 'Commit'];
|
private allowedFlags = ['Handshake', 'NewTx', 'Cipher', 'Commit'];
|
||||||
|
|
||||||
private constructor() {}
|
private constructor() {}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ export async function initWebsocket(url: string) {
|
|||||||
errors: validation.errors,
|
errors: validation.errors,
|
||||||
messagePreview: msgData.substring(0, 100)
|
messagePreview: msgData.substring(0, 100)
|
||||||
});
|
});
|
||||||
|
console.log('🔍 DEBUG: Full validation errors:', validation.errors);
|
||||||
secureLogger.warn('Invalid WebSocket message received', {
|
secureLogger.warn('Invalid WebSocket message received', {
|
||||||
component: 'WebSocket',
|
component: 'WebSocket',
|
||||||
operation: 'message_validation',
|
operation: 'message_validation',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user