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 6
6
7
7
- Recursion in ` openDatabase ` when using ` SentrySqfliteDatabaseFactory ` ([ #3231 ] ( https://github.com/getsentry/sentry-dart/pull/3231 ) )
8
8
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
+
9
14
## 9.7.0-beta.2
10
15
11
16
### Features
Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ class SentryPrivacyOptions {
83
83
84
84
rules.add (SentryMaskingCustomRule <Widget >(
85
85
callback: (Element element, Widget widget) {
86
+ if (widget is InheritedWidget ) {
87
+ return SentryMaskingDecision .continueProcessing;
88
+ }
86
89
final type = widget.runtimeType.toString ();
87
90
if (regexp.hasMatch (type)) {
88
91
logger (
Original file line number Diff line number Diff line change @@ -298,6 +298,26 @@ void main() async {
298
298
});
299
299
});
300
300
});
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
+ });
301
321
}
302
322
303
323
extension on Element {
@@ -327,3 +347,10 @@ extension on Element {
327
347
return result;
328
348
}
329
349
}
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