Gate OkHttp body capture on active Session Replay

Open Beginner friendly
#6,138 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
kotlin
Domain
networking

Research direction

Start in sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt, reviewing the capture condition around lines 112-118 and the peekBody call around lines 318-327. Confirm that body capture only occurs while Session Replay is recording or buffering, and that known streaming responses such as text/event-stream are skipped before peekBody().

Written by the indexing model from the issue text.

Description

Bug Java Platform: Java

OkHttp captures allowlisted response bodies even when Session Replay is neither recording nor buffering. For SSE responses, peekBody(150KB + 1) can delay events until the connection closes.

Gate body capture on active Session Replay. Skip known streaming content types, at minimum text/event-stream, before calling peekBody().

Captured body contents are only used for Session Replay; spans, breadcrumbs, and failed-request events use sizes, status, and headers rather than body contents.

Relevant implementation: capture condition and peekBody call.

Dominant language
Kotlin
Stars
1.4k
Forks
478
Avg merge
3d 2h
Merged PRs (30d)
70

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getsentry/sentry-java

All issues in getsentry/sentry-java

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.