Skip to main content

Privacy and network traffic (7.x Beta)

7.x Beta

This page documents the 7.x beta line. For the stable release, see the 6.x network privacy page.

Disabling network traffic collection

Network capture can be disabled via the MonitorNetwork option — see configuration.

Sanitizing network events

7.x replaces the 6.x NetworkEventFilter two-arg callback with a single-method generic EventFilter<T>. Return the (possibly mutated) NetworkEvent to keep it; return null to drop it. The event type is NetworkEvent (package com.bugsee.library.contracts) — it replaces 6.x's BugseeNetworkEvent. The helper getters/setters carry over almost unchanged (including getNoBodyReason()).

Bugsee.setNetworkEventFilter(event -> {
// URL
String url = event.getUrl();
if (url != null && url.contains("token")) {
event.setUrl(url.replaceAll("token=\\S+", "token=[REDACTED]"));
}

// Headers
Map<String, Object> headers = event.getHeaders();
if (headers != null) {
headers.remove("Authorization");
event.setHeaders(headers);
}

// Body
String body = event.getBody();
if (body != null && body.contains("\"password\"")) {
event.setBody("[REDACTED]");
}

// Error text (captured for failed requests)
if (event.getErrorDescription() != null) {
event.setErrorDescription("…");
}

return event; // keep
// return null; // drop
});
Replacement for 6.x filters

This API supersedes the 6.x setNetworkEventFilter(NetworkEventFilter) two- arg callback. See migration section 6 for a side-by-side and note on type renames.

Capture from OkHttp 3/4, Ktor 2/3, and Cronet is wired automatically by the Bugsee Gradle plugin through the matching extension modules — no manual interceptor registration is required in 7.x.