File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99@ ApiStatus .Internal
1010public final class DataCollectionResolver {
1111
12- private static final @ NotNull KeyValueCollectionBehavior OFF = KeyValueCollectionBehavior .off ();
13- private static final @ NotNull KeyValueCollectionBehavior EMPTY_DENY_LIST =
14- KeyValueCollectionBehavior .denyList ();
15-
1612 private final @ NotNull SentryOptions options ;
1713
1814 DataCollectionResolver (final @ NotNull SentryOptions options ) {
@@ -71,9 +67,11 @@ public boolean isGraphqlVariablesWithLegacyAlways() {
7167 return cookies ;
7268 }
7369 if (isDataCollectionConfigured ()) {
74- return EMPTY_DENY_LIST ;
70+ return KeyValueCollectionBehavior . denyList () ;
7571 }
76- return options .isSendDefaultPii () ? EMPTY_DENY_LIST : OFF ;
72+ return options .isSendDefaultPii ()
73+ ? KeyValueCollectionBehavior .denyList ()
74+ : KeyValueCollectionBehavior .off ();
7775 }
7876
7977 public @ NotNull KeyValueCollectionBehavior getUrlQueryParams () {
@@ -128,7 +126,7 @@ private boolean explicitOrDefault(
128126
129127 private @ NotNull KeyValueCollectionBehavior explicitOrEmptyDenyList (
130128 final @ Nullable KeyValueCollectionBehavior explicit ) {
131- return explicit != null ? explicit : EMPTY_DENY_LIST ;
129+ return explicit != null ? explicit : KeyValueCollectionBehavior . denyList () ;
132130 }
133131
134132 private boolean isHttpBodyEnabled (
Original file line number Diff line number Diff line change @@ -244,6 +244,17 @@ class DataCollectionResolverTest {
244244 assertThat(options.dataCollectionResolver.cookies).isEqualTo(KeyValueCollectionBehavior .off())
245245 }
246246
247+ @Test
248+ fun `mutating one fallback key-value behavior does not affect other getters` () {
249+ val resolver = SentryOptions ().apply { dataCollection.setUserInfo(true ) }.dataCollectionResolver
250+
251+ resolver.cookies.terms = listOf (" custom-cookie" )
252+
253+ assertThat(resolver.urlQueryParams.terms).doesNotContain(" custom-cookie" )
254+ assertThat(resolver.httpRequestHeaders.terms).doesNotContain(" custom-cookie" )
255+ assertThat(resolver.httpResponseHeaders.terms).doesNotContain(" custom-cookie" )
256+ }
257+
247258 @Test
248259 fun `cookies use default deny list when unset and sendDefaultPii is true` () {
249260 val options = SentryOptions ().apply { isSendDefaultPii = true }
You can’t perform that action at this time.
0 commit comments