Skip to content
Merged
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
10 changes: 4 additions & 6 deletions examples/voice/static/plain/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,10 @@
.with({ kind: 'voice-incoming-end' }, (m) => endIncoming(m.from))
.with({ kind: 'system' }, () => { /* informational */ })
.otherwise(() => {
// Log only the sanitized `kind` tag, never the raw server payload,
// so a crafted message can't forge console entries (CodeQL
// js/log-injection).
const kind =
typeof m?.kind === 'string' ? m.kind.replace(/[^\w.:-]/g, '') : '(unknown)';
console.debug('unhandled server msg kind:', kind);
// Encode the user-controlled value before logging so a crafted
// message can't forge console entries. encodeURIComponent is a
// sanitizer CodeQL recognises for js/log-injection.
console.debug('unhandled server msg kind:', encodeURIComponent(String(m?.kind ?? '')));
Comment thread
pathosDev marked this conversation as resolved.
Dismissed
});
}

Expand Down