Flip on debug logging and the full event payload, user and device fields included, lands where any script on the page can read it.
What goes wrong
Turn on debug mode and every telemetry event gets serialized straight into the browser console. Telemetry is rarely just counters. It carries user identifiers and device details, plus whatever activity you attached to the event.
The console is not a private channel. Any script running in the page can read it. So can browser extensions and injected tags, and anyone watching over a support screen share. A value you would never put in a response body ends up in plain text, one panel away in dev tools.
The error path makes it worse. When a send fails, the whole error object goes to the console too, server messages included. This stays Low because it needs debug logging on and someone with console access. It also ships to production by accident, because the flag was handy during a bad week.
The pattern
if (debugEnabled) {
console.log('telemetry', JSON.stringify(event));
}
sendTelemetry(event).catch(err => {
console.log('telemetry failed', err);
});if (debugEnabled) {
console.log('telemetry', summarize(event)); // field names, not values
}
sendTelemetry(event).catch(err => {
console.log('telemetry failed', err.code);
});
// summarize() drops user, device, and payload fieldsEvery gate held. The exploit path was reproduced against a negative control, the impact was calibrated, and the finding was signed report-ready.
Why it matters to you
If your frontend logs rich objects behind a debug flag, assume that flag is on somewhere you did not intend. A support build, or staging that shares a domain with prod. A device someone kept after QA and forgot. The data never has to leave your servers to leak. It only has to be readable by code you do not control, and the console is exactly that.
Check your own code
- Grep for console.log calls that pass a whole object or JSON.stringify of a payload.
- Confirm no error handler prints a raw error object to a client console.
- Make debug output show field names and counts, never values.
- Default debug flags to off and keep them out of user-controlled config.