Skip to content

Commit 8af01d0

Browse files
committed
docs(okhttp): update sanitizer docs to list all stripped URL components
1 parent 5835a82 commit 8af01d0

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

rollbar-okhttp/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ dependencies {
3737
NetworkTelemetryRecorder recorder = new NetworkTelemetryRecorder() {
3838
@Override
3939
public void recordNetworkEvent(Level level, String method, String url, String statusCode) {
40-
// url has query parameters stripped by default (see Security section below)
40+
// url has userinfo, query parameters, and fragment stripped by default
41+
// (see Security section below)
4142
rollbar.recordNetworkEventFor(level, method, url, statusCode);
4243
}
4344

@@ -79,9 +80,9 @@ The interceptor will automatically record telemetry events to Rollbar without in
7980

8081
## Security
8182

82-
URL query parameters often carry sensitive data such as API keys (`?api_key=...`), OAuth tokens (`?access_token=...`), or PII. To prevent accidental leakage to Rollbar, the interceptor **strips query parameters by default** before passing the URL to `NetworkTelemetryRecorder`.
83+
URLs can carry sensitive data in several components. To prevent accidental leakage to Rollbar, the interceptor **strips userinfo (basic-auth credentials), query parameters, and the fragment by default** before passing the URL to `NetworkTelemetryRecorder`.
8384

84-
For example, a request to `https://api.example.com/charge?token=sk_live_secret` will be recorded as `https://api.example.com/charge`.
85+
For example, a request to `https://user:secret@api.example.com/charge?token=sk_live_secret#section` will be recorded as `https://api.example.com/charge`.
8586

8687
If your URLs do not contain sensitive query parameters and you need them for debugging, you can opt in to the full URL by supplying a custom sanitizer:
8788

rollbar-okhttp/src/main/java/com/rollbar/okhttp/NetworkTelemetryRecorder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ public interface NetworkTelemetryRecorder {
1111
*
1212
* @param level the severity level to attach to the telemetry event
1313
* @param method the HTTP method (e.g. GET, POST)
14-
* @param url the request URL with query parameters stripped by default; supply a custom
15-
* sanitizer to {@link RollbarOkHttpInterceptor} to change this behavior
14+
* @param url the request URL with userinfo (basic-auth credentials), query parameters,
15+
* and fragment stripped by default; supply a custom sanitizer to
16+
* {@link RollbarOkHttpInterceptor} to change this behavior
1617
* @param statusCode the HTTP response status code as a string (e.g. "200", "404")
1718
*/
1819
void recordNetworkEvent(Level level, String method, String url, String statusCode);

0 commit comments

Comments
 (0)