File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 66
77- Recursion in ` openDatabase ` when using ` SentrySqfliteDatabaseFactory ` ([ #3231 ] ( https://github.com/getsentry/sentry-dart/pull/3231 ) )
88
9+ ### Enhancements
10+
11+ - Replay: continue processing if encountering ` InheritedWidget ` ([ #3200 ] ( https://github.com/getsentry/sentry-dart/pull/3200 ) )
12+ - Prevents false debug warnings when using [ provider] ( https://pub.dev/packages/provider ) for example which extensively uses ` InheritedWidget `
13+
914## 9.7.0-beta.2
1015
1116### Features
Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ class SentryPrivacyOptions {
8383
8484 rules.add (SentryMaskingCustomRule <Widget >(
8585 callback: (Element element, Widget widget) {
86+ if (widget is InheritedWidget ) {
87+ return SentryMaskingDecision .continueProcessing;
88+ }
8689 final type = widget.runtimeType.toString ();
8790 if (regexp.hasMatch (type)) {
8891 logger (
Original file line number Diff line number Diff line change @@ -298,6 +298,26 @@ void main() async {
298298 });
299299 });
300300 });
301+
302+ testWidgets ('ignores InheritedWidget and does not log' , (tester) async {
303+ final logger = MockLogger ();
304+ final options = SentryPrivacyOptions ();
305+ final config =
306+ options.buildMaskingConfig (logger.call, MockRuntimeChecker ());
307+
308+ final rootElement = await pumpTestElement (tester, children: const [
309+ _PasswordInherited (child: Text ('child' )),
310+ ]);
311+
312+ final element = rootElement.findFirstOfType <_PasswordInherited >();
313+ expect (config.shouldMask (element, element.widget),
314+ SentryMaskingDecision .continueProcessing);
315+
316+ // The debug rule contains a RegExp that matches 'password'. Our widget
317+ // name contains it but because it's an InheritedWidget it should be
318+ // ignored and thus no warning is logged.
319+ expect (logger.items.where ((i) => i.level == SentryLevel .warning), isEmpty);
320+ });
301321}
302322
303323extension on Element {
@@ -327,3 +347,10 @@ extension on Element {
327347 return result;
328348 }
329349}
350+
351+ class _PasswordInherited extends InheritedWidget {
352+ const _PasswordInherited ({required super .child});
353+
354+ @override
355+ bool updateShouldNotify (covariant _PasswordInherited oldWidget) => false ;
356+ }
You can’t perform that action at this time.
0 commit comments