debug: Add WebSocket message validation debugging
**Motivations :** - Debug why handshake messages are being filtered by validator - Understand WebSocket message structure and validation errors **Modifications :** - Added detailed logging for raw WebSocket messages - Added validation result logging - Enhanced error reporting for invalid messages **Pages affectées :** - src/websockets.ts - Enhanced WebSocket debugging
This commit is contained in:
parent
c21de2b943
commit
08a47fab3e
@ -2116,7 +2116,7 @@ export default class Services {
|
||||
spAddressType: typeof handshakeMsg.sp_address,
|
||||
spAddressLength: handshakeMsg.sp_address?.length
|
||||
});
|
||||
|
||||
|
||||
if (handshakeMsg.sp_address) {
|
||||
this.updateRelay(url, handshakeMsg.sp_address);
|
||||
this.relayAddresses[url] = handshakeMsg.sp_address;
|
||||
|
||||
@ -28,9 +28,15 @@ export async function initWebsocket(url: string) {
|
||||
if (typeof msgData === 'string') {
|
||||
try {
|
||||
// Valider le message avant traitement
|
||||
console.log('🔍 DEBUG: Raw WebSocket message:', msgData);
|
||||
const validation = messageValidator.validateWebSocketMessage(msgData);
|
||||
console.log('🔍 DEBUG: Validation result:', validation);
|
||||
|
||||
if (!validation.isValid) {
|
||||
console.warn('⚠️ Invalid WebSocket message received:', {
|
||||
errors: validation.errors,
|
||||
messagePreview: msgData.substring(0, 100)
|
||||
});
|
||||
secureLogger.warn('Invalid WebSocket message received', {
|
||||
component: 'WebSocket',
|
||||
operation: 'message_validation',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user