Skip to content

replay: add sensitive content widget to default masking #2989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions flutter/lib/src/sentry_privacy_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ class SentryPrivacyOptions {
mask: false,
name: 'SentryUnmask',
));
// TODO: check for Flutter version and make this testable
Copy link
Collaborator

@ueman ueman Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static const String? version = bool.hasEnvironment('FLUTTER_VERSION')
should be at least 3.33.0-0.2.pre or higher.

Ideally, you also make a check for bool.hasEnvironment('FLUTTER_VERSION') so that it tree shakes better. Calling a property on dynamic basically disables tree shaking for that property on any class. And the FLUTTER_VERSION dart define was introduced just one major Flutter version before this, which should already improve tree shaking quite a lot for most Flutter versions.

rules.add(SentryMaskingCustomRule<Widget>(
callback: (Element element, Widget widget) {
dynamic dynWidget = widget;
try {
final sensitivity = dynWidget.sensitivity;
assert(sensitivity is Enum);
return SentryMaskingDecision.mask;
} catch (e) {
return SentryMaskingDecision.continueProcessing;
}
},
name: 'SensitiveContent',
description: 'Mask SensitiveContent'));

// Then, we apply apply rules based on the configuration.
if (maskAllImages) {
Expand Down
Loading