diff --git a/docs/sdk/android/network.mdx b/docs/sdk/android/network.mdx index dacc713..9e2e35f 100644 --- a/docs/sdk/android/network.mdx +++ b/docs/sdk/android/network.mdx @@ -160,7 +160,7 @@ Notes on the filter shape: - Event types are `NetworkEvent` / `LogEvent` in `com.bugsee.library.contracts`. - Mutators (`setUrl`, `setMethod`, `setBody`, headers, etc.) and `getBodyAbsenceReason()` are available. - The filter applies uniformly to events coming from every network extension — OkHttp, Ktor 2, Ktor 3, and Cronet all feed the same pipeline. -- Installing a filter turns off the built-in redaction of credentials (`Authorization`, cookies, `password` and `token` fields); your filter must redact them, or call `NetworkDataSanitizer.sanitize(event)` to keep the built-in redaction. See [Privacy → Network traffic](/sdk/android/privacy/network#a-filter-replaces-the-built-in-redaction). +- Installing a filter turns off the built-in redaction of credentials (`Authorization`, cookies, `password` and `token` fields); your filter must redact them, or call `Bugsee.getDefaultNetworkSanitizer().sanitize(event)` to keep the built-in redaction (on SDK 7.0.3 through 7.2.0, the static `NetworkDataSanitizer.sanitize(event)`). See [Privacy → Network traffic](/sdk/android/privacy/network#a-filter-replaces-the-built-in-redaction). See also the [Logs page](/sdk/android/logs) for the matching `setLogEventFilter(...)` API. diff --git a/docs/sdk/android/privacy/network.mdx b/docs/sdk/android/privacy/network.mdx index 2723db7..f275c04 100644 --- a/docs/sdk/android/privacy/network.mdx +++ b/docs/sdk/android/privacy/network.mdx @@ -117,16 +117,15 @@ only adds or renames a field records `Authorization` headers, cookies and unless you disabled `CaptureNetworkUseDefaultSanitizer`. ::: -To keep the built-in redaction and add your own, call -`NetworkDataSanitizer.sanitize(event)` (package -`com.bugsee.library.shared.security.privacy`) at the start of your filter: +To keep the built-in redaction and add your own, call the SDK's default +sanitizer, `Bugsee.getDefaultNetworkSanitizer()`, at the start of your filter: ```java Bugsee.setNetworkEventFilter((event, callback) -> { - NetworkDataSanitizer.sanitize(event); // built-in redaction + Bugsee.getDefaultNetworkSanitizer().sanitize(event); // built-in redaction // ...your own redaction... callback.run(event); }); @@ -137,7 +136,7 @@ Bugsee.setNetworkEventFilter((event, callback) -> { ```kotlin Bugsee.setNetworkEventFilter { event, callback -> - NetworkDataSanitizer.sanitize(event) // built-in redaction + Bugsee.getDefaultNetworkSanitizer().sanitize(event) // built-in redaction // ...your own redaction... callback.run(event) } @@ -146,6 +145,26 @@ Bugsee.setNetworkEventFilter { event, callback -> +`getDefaultNetworkSanitizer()` works before `Bugsee.launch()`, so you can use +it in a [manifest-declared filter](#declaring-the-filter-in-the-manifest), and +you can call it for every event. Besides `sanitize(event)`, which redacts the +URL, headers, body and error messages, it has `sanitizeUrl(event)` and +`sanitizeErrorMessage(event)`, which redact only the URL or only the error +messages. + +:::note +`Bugsee.getDefaultNetworkSanitizer()` is new in SDK 7.3.0. On SDK 7.0.3 +through 7.2.0, call the static `NetworkDataSanitizer.sanitize(event)` (package +`com.bugsee.library.shared.security.privacy`) instead; that class is deprecated +from 7.3.0 but still works. Earlier versions have no public sanitizer. + +If your code wildcard-imports both `com.bugsee.library.contracts.exchange.*` and +`com.bugsee.library.shared.security.privacy.*`, the compiler reports +`NetworkDataSanitizer` as ambiguous after the upgrade. Import the one you mean by +its full name, or use `Bugsee.getDefaultNetworkSanitizer()`, which needs no +import. +::: + Capture from OkHttp 3/4, Ktor 2/3, and Cronet is wired automatically by the Bugsee Gradle plugin through the matching [extension modules](/sdk/android/extensibility/bugsee-extensions) — no manual interceptor