ChuckerTeam / chucker

🔎 An HTTP inspector for Android & OkHTTP (like Charles but on device)
Apache License 2.0
3.78k stars 330 forks source link

Method skipPaths on builder does not work as expected #1237

Open mikegr opened 1 week ago

mikegr commented 1 week ago

:writing_hand: Describe the bug

Using skipPaths does not work as expected. When using the builder the path is added by using the addPathSegment method on the HttpUrl.Builder, which will escape any slash to %F2. You should use the addPathSegments to allow a full path. Because later the full "encodedPath" of the request url is used to compare.

See line https://github.com/ChuckerTeam/chucker/blob/main/library/src/main/kotlin/com/chuckerteam/chucker/api/ChuckerInterceptor.kt#L193 and https://github.com/ChuckerTeam/chucker/blob/main/library/src/main/kotlin/com/chuckerteam/chucker/api/ChuckerInterceptor.kt#L75

:bomb: Steps to reproduce

chucker = "4.0.0"

                ChuckerInterceptor.Builder(app)
                    .skipPaths("/f1/proxy/ggw/posthog-proxy/public/capture")
                    .build()

Result:

Bildschirmfoto 2024-06-26 um 12 08 55
VenomVendor commented 3 days ago

The path is added as single segment instead of segments

https://github.com/ChuckerTeam/chucker/blob/9a2487605d052d20a124e794560716c61e1e1d0e/library/src/main/kotlin/com/chuckerteam/chucker/api/ChuckerInterceptor.kt#L193

Also, the path is encoded which change / to %2F which is wrong.