-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
Open
buenaflor
wants to merge
29
commits into
main
Choose a base branch
from
replay/add-sensitive-content
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
333f93a
Add sensitive content widget to default masking
buenaflor a240674
Add sensitive content widget to default masking
buenaflor 6d1e35e
Merge branch 'main' into replay/add-sensitive-content
buenaflor 74eb694
Update impl
buenaflor 2e01b33
Merge branch 'main' into replay/add-sensitive-content
buenaflor 132f050
Update rule
buenaflor 591b9c3
Update doc
buenaflor 5ce2839
Update
buenaflor dfce0e8
Update sentry_privacy_options.dart
buenaflor efa9362
Merge branch 'main' into replay/add-sensitive-content
buenaflor f76a31d
Update
buenaflor b928028
Merge branch 'main' into replay/add-sensitive-content
buenaflor f4c8e58
Update
buenaflor 151a70d
Update impl
buenaflor c8596cd
Update
buenaflor dde1132
Update
buenaflor 7c9f696
Update
buenaflor 088cf62
Update
buenaflor 4bbbded
Update
buenaflor 20657ad
Update
buenaflor 32e3fc4
Update
buenaflor 0c59077
Merge branch 'main' into replay/add-sensitive-content
buenaflor 686750f
Update CHANGELOG
buenaflor 1f8bf63
Merge branch 'main' into replay/add-sensitive-content
buenaflor e38ab52
Merge branch 'main' into replay/add-sensitive-content
buenaflor 33b5751
Merge branch 'main' into replay/add-sensitive-content
buenaflor 87f3e2e
Merge branch 'main' into replay/add-sensitive-content
buenaflor e8fab32
refactor: enhance flutter version parsing and sensitive content detec…
buenaflor fbc6634
Add SensitiveContent widget to changelog
buenaflor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
167 changes: 167 additions & 0 deletions
167
packages/dart/test/event_processor/enricher/flutter_runtime_test.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| import 'package:sentry/src/event_processor/enricher/flutter_runtime.dart'; | ||
| import 'package:test/test.dart'; | ||
|
|
||
| void main() { | ||
| group('FlutterVersionComponents', () { | ||
| test('stores major and minor correctly', () { | ||
| const components = FlutterVersionComponents(3, 33); | ||
| expect(components.major, 3); | ||
| expect(components.minor, 33); | ||
| }); | ||
|
|
||
| test('equality works correctly', () { | ||
| const a = FlutterVersionComponents(3, 33); | ||
| const b = FlutterVersionComponents(3, 33); | ||
| const c = FlutterVersionComponents(3, 32); | ||
|
|
||
| expect(a, equals(b)); | ||
| expect(a, isNot(equals(c))); | ||
| }); | ||
|
|
||
| test('hashCode is consistent with equality', () { | ||
| const a = FlutterVersionComponents(3, 33); | ||
| const b = FlutterVersionComponents(3, 33); | ||
|
|
||
| expect(a.hashCode, equals(b.hashCode)); | ||
| }); | ||
|
|
||
| test('toString returns readable format', () { | ||
| const components = FlutterVersionComponents(3, 33); | ||
| expect(components.toString(), 'FlutterVersionComponents(3, 33)'); | ||
| }); | ||
|
|
||
| group('meetsMinimum', () { | ||
| test('returns false when major is less than threshold', () { | ||
| expect( | ||
| const FlutterVersionComponents(2, 99).meetsMinimum(3, 0), isFalse); | ||
| expect( | ||
| const FlutterVersionComponents(2, 0).meetsMinimum(3, 33), isFalse); | ||
| }); | ||
|
|
||
| test('returns false when major equals but minor is less than threshold', | ||
| () { | ||
| expect( | ||
| const FlutterVersionComponents(3, 32).meetsMinimum(3, 33), isFalse); | ||
| expect( | ||
| const FlutterVersionComponents(3, 0).meetsMinimum(3, 33), isFalse); | ||
| }); | ||
|
|
||
| test('returns true when major equals and minor equals threshold', () { | ||
| expect( | ||
| const FlutterVersionComponents(3, 33).meetsMinimum(3, 33), isTrue); | ||
| expect(const FlutterVersionComponents(4, 0).meetsMinimum(4, 0), isTrue); | ||
| }); | ||
|
|
||
| test('returns true when major equals and minor exceeds threshold', () { | ||
| expect( | ||
| const FlutterVersionComponents(3, 34).meetsMinimum(3, 33), isTrue); | ||
| expect( | ||
| const FlutterVersionComponents(3, 99).meetsMinimum(3, 33), isTrue); | ||
| }); | ||
|
|
||
| test('returns true when major exceeds threshold', () { | ||
| expect( | ||
| const FlutterVersionComponents(4, 0).meetsMinimum(3, 33), isTrue); | ||
| expect( | ||
| const FlutterVersionComponents(5, 0).meetsMinimum(3, 99), isTrue); | ||
| expect( | ||
| const FlutterVersionComponents(10, 0).meetsMinimum(3, 33), isTrue); | ||
| }); | ||
|
|
||
| test('works with various threshold values', () { | ||
| // Testing different thresholds | ||
| expect(const FlutterVersionComponents(2, 5).meetsMinimum(2, 5), isTrue); | ||
| expect( | ||
| const FlutterVersionComponents(2, 4).meetsMinimum(2, 5), isFalse); | ||
| expect(const FlutterVersionComponents(1, 0).meetsMinimum(1, 0), isTrue); | ||
| expect( | ||
| const FlutterVersionComponents(0, 0).meetsMinimum(0, 1), isFalse); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| group('FlutterVersion.parseVersion', () { | ||
| test('parses standard version format (major.minor.patch)', () { | ||
| final result = FlutterVersion.parseComponents('3.33.0'); | ||
| expect(result, isNotNull); | ||
| expect(result!.major, 3); | ||
| expect(result.minor, 33); | ||
| }); | ||
|
|
||
| test('parses version with pre-release suffix', () { | ||
| final result = FlutterVersion.parseComponents('3.33.0-pre.123'); | ||
| expect(result, isNotNull); | ||
| expect(result!.major, 3); | ||
| expect(result.minor, 33); | ||
| }); | ||
|
|
||
| test('parses version with build metadata', () { | ||
| final result = FlutterVersion.parseComponents('3.33.0+hotfix.1'); | ||
| expect(result, isNotNull); | ||
| expect(result!.major, 3); | ||
| expect(result.minor, 33); | ||
| }); | ||
|
|
||
| test('parses major.minor only (no patch)', () { | ||
| final result = FlutterVersion.parseComponents('4.0'); | ||
| expect(result, isNotNull); | ||
| expect(result!.major, 4); | ||
| expect(result.minor, 0); | ||
| }); | ||
|
|
||
| test('parses version with large numbers', () { | ||
| final result = FlutterVersion.parseComponents('10.100.999'); | ||
| expect(result, isNotNull); | ||
| expect(result!.major, 10); | ||
| expect(result.minor, 100); | ||
| }); | ||
|
|
||
| test('returns null for single number (no dot)', () { | ||
| expect(FlutterVersion.parseComponents('3'), isNull); | ||
| }); | ||
|
|
||
| test('returns null for non-numeric major', () { | ||
| expect(FlutterVersion.parseComponents('abc.33.0'), isNull); | ||
| }); | ||
|
|
||
| test('returns null for non-numeric minor', () { | ||
| expect(FlutterVersion.parseComponents('3.abc.0'), isNull); | ||
| }); | ||
|
|
||
| test('returns null for empty string', () { | ||
| expect(FlutterVersion.parseComponents(''), isNull); | ||
| }); | ||
|
|
||
| test('returns null for dot only', () { | ||
| expect(FlutterVersion.parseComponents('.'), isNull); | ||
| }); | ||
|
|
||
| test('returns null for leading dot', () { | ||
| expect(FlutterVersion.parseComponents('.33.0'), isNull); | ||
| }); | ||
|
|
||
| test('returns null for minor with hyphen suffix without patch', () { | ||
| // "3.33-beta" -> "33-beta" is not a valid integer | ||
| expect(FlutterVersion.parseComponents('3.33-beta'), isNull); | ||
| }); | ||
|
|
||
| test('parses version where minor ends at patch separator', () { | ||
| // "3.33.0-beta" -> major=3, minor=33 | ||
| final result = FlutterVersion.parseComponents('3.33.0-beta'); | ||
| expect(result, isNotNull); | ||
| expect(result!.major, 3); | ||
| expect(result.minor, 33); | ||
| }); | ||
|
|
||
| test('handles version 0.0.0', () { | ||
| final result = FlutterVersion.parseComponents('0.0.0'); | ||
| expect(result, isNotNull); | ||
| expect(result!.major, 0); | ||
| expect(result.minor, 0); | ||
| }); | ||
|
|
||
| test('returns null for malformed version', () { | ||
| expect(FlutterVersion.parseComponents('invalid'), isNull); | ||
| }); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.