Skip to content

Commit

Permalink
Merge branch 'main' into feat/spm
Browse files Browse the repository at this point in the history
# Conflicts:
#	flutter/ios/Classes/SentryFlutterPlugin.h
  • Loading branch information
denrase committed Nov 25, 2024
2 parents 249bb1e + 7f97e6c commit 00cd940
Show file tree
Hide file tree
Showing 107 changed files with 5,036 additions and 4,487 deletions.
10 changes: 7 additions & 3 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ body:
id: environment
attributes:
label: Platform
description: Which platform do you use?
description: Which platforms does this bug affect?
multiple: true
options:
- Dart
- Dart Web
- Flutter Mobile
- Flutter Desktop
- Flutter Mobile iOS
- Flutter Mobile Android
- Flutter Desktop Windows
- Flutter Desktop Linux
- Flutter Web
- Flutter Wasm
validations:
required: true

Expand Down
3 changes: 2 additions & 1 deletion .github/file-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ high_risk_code: &high_risk_code
- "flutter/lib/src/integrations/native_app_start_integration.dart"
- "flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt"
- "flutter/ios/Classes/SentryFlutterPluginApple.swift"

- "flutter/lib/src/screenshot/recorder.dart"
- "flutter/lib/src/screenshot/widget_filter.dart"
24 changes: 20 additions & 4 deletions .github/workflows/changes-in-high-risk-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,25 @@ jobs:
script: |
const highRiskFiles = process.env.high_risk_code;
const fileList = highRiskFiles.split(',').map(file => `- [ ] ${file}`).join('\n');
github.rest.issues.createComment({
// Get existing comments
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `### 🚨 Detected changes in high risk code 🚨 \n High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:\n ${fileList}`
})
repo: context.repo.repo
});
// Check if we already have a high risk code comment
const hasExistingComment = comments.data.some(comment =>
comment.body.includes('🚨 Detected changes in high risk code 🚨')
);
// Only create comment if we don't already have one
if (!hasExistingComment) {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `### 🚨 Detected changes in high risk code 🚨 \n High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:\n ${fileList}`
});
}
2 changes: 1 addition & 1 deletion .github/workflows/drift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
cd drift
flutter test --coverage --test-randomize-ordering-seed=random
- uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # pin@v3
- uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # pin@v3
if: runner.os == 'Linux' && matrix.sdk == 'stable' && matrix.target == 'linux'
with:
name: sentry_drift
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- name: 'Setup Linux'
run: |
sudo apt update
sudo apt install -y cmake dbus libblkid-dev libgtk-3-dev liblzma-dev ninja-build pkg-config xvfb
sudo apt install -y cmake dbus libblkid-dev libgtk-3-dev liblzma-dev ninja-build pkg-config xvfb libcurl4-openssl-dev
sudo apt install -y network-manager upower
if: matrix.target == 'linux'

Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
flutter test --coverage --test-randomize-ordering-seed=random
dart run remove_from_coverage -f coverage/lcov.info -r 'binding.dart'
- uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # pin@v3
- uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # pin@v3
if: matrix.sdk == 'stable' && matrix.target == 'linux'
with:
name: sentry_flutter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/isar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
cd isar
flutter test -j 1 --coverage --test-randomize-ordering-seed=random
- uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # pin@v3
- uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # pin@v3
if: runner.os == 'Linux' && matrix.sdk == 'stable' && matrix.target == 'linux'
with:
name: sentry_isar
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sqflite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
cd sqflite
flutter test --coverage --test-randomize-ordering-seed=random
- uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # pin@v3
- uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # pin@v3
if: runner.os == 'Linux' && matrix.sdk == 'stable' && matrix.target == 'linux'
with:
name: sentry_sqflite
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # [email protected]
- run: xcodes select 15.0.1
- uses: ruby/setup-ruby@7d3497fd78c07c0d84ebafa58d8dac60cd1f0763 # pin@v1.199.0
- uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc # pin@v1.202.0
with:
ruby-version: '2.7.5'
bundler-cache: true
Expand Down
80 changes: 75 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,49 @@

### Features

- Support for screenshot PII content masking ([#2361](https://github.com/getsentry/sentry-dart/pull/2361))
By default, masking is enabled for SessionReplay. To also enable it for screenshots captured with events, you can specify `options.experimental.privacy`:
```dart
await SentryFlutter.init(
(options) {
...
// the defaults are:
options.experimental.privacy.maskAllText = true;
options.experimental.privacy.maskAllImages = true;
options.experimental.privacy.maskAssetImages = false;
// you cal also set up custom masking, for example:
options.experimental.privacy.mask<WebView>();
},
appRunner: () => runApp(MyApp()),
);
```
Actually, just accessing this field will cause it to be initialized with the default settings to mask all text and images:
```dart
await SentryFlutter.init(
(options) {
...
// this has a side-effect of creating the default privacy configuration, thus enabling Screenshot masking:
options.experimental.privacy;
},
appRunner: () => runApp(MyApp()),
);
```
- Linux native error & obfuscation support ([#2431](https://github.com/getsentry/sentry-dart/pull/2431))
- Improve Device context on plain Dart and Flutter desktop apps ([#2441](https://github.com/getsentry/sentry-dart/pull/2441))

### Dependencies

- Bump Cocoa SDK from v8.40.1 to v8.41.0 ([#2442](https://github.com/getsentry/sentry-dart/pull/2442))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8410)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.40.1...8.41.0)

## 8.11.0-beta.1

### Features

- Windows native error & obfuscation support ([#2286](https://github.com/getsentry/sentry-dart/pull/2286), [#2426](https://github.com/getsentry/sentry-dart/pull/2426))
- Improve app start measurements by using `addTimingsCallback` instead of `addPostFrameCallback` to determine app start end ([#2405](https://github.com/getsentry/sentry-dart/pull/2405))
- ⚠️ This change may result in reporting of shorter app start durations
- Improve frame tracking accuracy ([#2372](https://github.com/getsentry/sentry-dart/pull/2372))
- Introduces `SentryWidgetsFlutterBinding` that tracks a frame starting from `handleBeginFrame` and ending in `handleDrawFrame`, this is approximately the [buildDuration](https://api.flutter.dev/flutter/dart-ui/FrameTiming/buildDuration.html) time
- By default, `SentryFlutter.init()` automatically initializes `SentryWidgetsFlutterBinding` through the `WidgetsFlutterBindingIntegration`
Expand All @@ -12,13 +55,40 @@
void main() async {
// Replace WidgetsFlutterBinding.ensureInitialized()
SentryWidgetsFlutterBinding.ensureInitialized();
await SentryFlutter.init(...);
runApp(MyApp());
}
```
- ⚠️ Frame tracking will be disabled if a different binding is used

### Enhancements

- Only send debug images referenced in the stacktrace for events ([#2329](https://github.com/getsentry/sentry-dart/pull/2329))
- Remove `sentry` frames if SDK falls back to current stack trace ([#2351](https://github.com/getsentry/sentry-dart/pull/2351))
- Flutter doesn't always provide stack traces for unhandled errors - this is normal Flutter behavior
- When no stack trace is provided (in Flutter errors, `captureException`, or `captureMessage`):
- SDK creates a synthetic trace using `StackTrace.current`
- Internal SDK frames are removed to reduce noise
- Original stack traces (when provided) are left unchanged

### Fixes

- Apply default IP address (`{{auto}}`) to transactions ([#2395](https://github.com/getsentry/sentry-dart/pull/2395))
- Previously, transactions weren't getting the default IP address when user context was loaded
- Now consistently applies default IP address to both events and transactions when:
- No user context exists
- User context exists but IP address is null

### Dependencies

- Bump Android SDK from v7.16.0 to v7.18.0 ([#2408](https://github.com/getsentry/sentry-dart/pull/2408), [#2419](https://github.com/getsentry/sentry-dart/pull/2419))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7180)
- [diff](https://github.com/getsentry/sentry-java/compare/7.16.0...7.18.0)
- Bump Native SDK from v0.7.12 to v0.7.15 ([#2430](https://github.com/getsentry/sentry-dart/pull/2430))
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0715)
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.12...0.7.15)

## 8.10.1

### Fixes
Expand Down Expand Up @@ -72,15 +142,15 @@
),
);
```

- Add screenshot to `SentryFeedbackWidget` ([#2369](https://github.com/getsentry/sentry-dart/pull/2369))
- Use `SentryFlutter.captureScreenshot` to create a screenshot attachment
- Call `SentryFeedbackWidget` with this attachment to add it to the user feedback

```dart
final id = await Sentry.captureMessage('UserFeedback');
final screenshot = await SentryFlutter.captureScreenshot();
Navigator.push(
context,
MaterialPageRoute(
Expand All @@ -100,7 +170,7 @@
- Avoid sending too many empty client reports when Http Transport is used ([#2380](https://github.com/getsentry/sentry-dart/pull/2380))
- Cache parsed DSN ([#2365](https://github.com/getsentry/sentry-dart/pull/2365))
- Handle backpressure earlier in pipeline ([#2371](https://github.com/getsentry/sentry-dart/pull/2371))
- Drops max un-awaited parallel tasks earlier, so event processors & callbacks are not executed for them.
- Drops max un-awaited parallel tasks earlier, so event processors & callbacks are not executed for them.
- Change by setting `SentryOptions.maxQueueSize`. Default is 30.
- Use native spotlight integrations on Flutter Android, iOS, macOS ([#2285](https://github.com/getsentry/sentry-dart/pull/2285))
- Improve app start integration ([#2266](https://github.com/getsentry/sentry-dart/pull/2266))
Expand All @@ -127,7 +197,7 @@

- Metrics API ([#2312](https://github.com/getsentry/sentry-dart/pull/2312))
- Learn more: https://sentry.zendesk.com/hc/en-us/articles/26369339769883-Metrics-Beta-Coming-to-an-End

### Dependencies

- Bump Native SDK from v0.7.10 to v0.7.12 ([#2390](https://github.com/getsentry/sentry-dart/pull/2390))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'dart:io';

import 'package:meta/meta.dart';

import '../../../sentry.dart';
import 'enricher_event_processor.dart';
import 'io_platform_memory.dart';
Expand All @@ -16,6 +18,8 @@ class IoEnricherEventProcessor implements EnricherEventProcessor {

final SentryOptions _options;
late final String _dartVersion = _extractDartVersion(Platform.version);
late final SentryOperatingSystem _os = extractOperatingSystem(
Platform.operatingSystem, Platform.operatingSystemVersion);

/// Extracts the semantic version and channel from the full version string.
///
Expand Down Expand Up @@ -137,9 +141,46 @@ class IoEnricherEventProcessor implements EnricherEventProcessor {
}

SentryOperatingSystem _getOperatingSystem(SentryOperatingSystem? os) {
return (os ?? SentryOperatingSystem()).copyWith(
name: os?.name ?? Platform.operatingSystem,
version: os?.version ?? Platform.operatingSystemVersion,
if (os == null) {
return _os.clone();
} else {
return _os.mergeWith(os);
}
}

@internal
SentryOperatingSystem extractOperatingSystem(
String name, String rawDescription) {
RegExpMatch? match;
switch (name) {
case 'android':
match = _androidOsRegexp.firstMatch(rawDescription);
name = 'Android';
break;
case 'ios':
name = 'iOS';
match = _appleOsRegexp.firstMatch(rawDescription);
break;
case 'macos':
name = 'macOS';
match = _appleOsRegexp.firstMatch(rawDescription);
break;
case 'linux':
name = 'Linux';
match = _linuxOsRegexp.firstMatch(rawDescription);
break;
case 'windows':
name = 'Windows';
match = _windowsOsRegexp.firstMatch(rawDescription);
break;
}

return SentryOperatingSystem(
name: name,
rawDescription: rawDescription,
version: match?.namedGroupOrNull('version'),
build: match?.namedGroupOrNull('build'),
kernelVersion: match?.namedGroupOrNull('kernelVersion'),
);
}

Expand All @@ -150,3 +191,32 @@ class IoEnricherEventProcessor implements EnricherEventProcessor {
);
}
}

// LYA-L29 10.1.0.289(C432E7R1P5)
// TE1A.220922.010
final _androidOsRegexp = RegExp('^(?<build>.*)\$', caseSensitive: false);

// Linux 5.11.0-1018-gcp #20~20.04.2-Ubuntu SMP Fri Sep 3 01:01:37 UTC 2021
final _linuxOsRegexp = RegExp(
'(?<kernelVersion>[a-z0-9+.\\-]+) (?<build>#.*)\$',
caseSensitive: false);

// Version 14.5 (Build 18E182)
final _appleOsRegexp = RegExp(
'(?<version>[a-z0-9+.\\-]+)( \\(Build (?<build>[a-z0-9+.\\-]+))\\)?\$',
caseSensitive: false);

// "Windows 10 Pro" 10.0 (Build 19043)
final _windowsOsRegexp = RegExp(
' (?<version>[a-z0-9+.\\-]+)( \\(Build (?<build>[a-z0-9+.\\-]+))\\)?\$',
caseSensitive: false);

extension on RegExpMatch {
String? namedGroupOrNull(String name) {
if (groupNames.contains(name)) {
return namedGroup(name);
} else {
return null;
}
}
}
8 changes: 5 additions & 3 deletions dart/lib/src/platform_checker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ class PlatformChecker {
// the OS checks return true when the browser runs on the checked platform.
// Example: platform.isAndroid return true if the browser is used on an
// Android device.
return platform.isAndroid || platform.isIOS || platform.isMacOS;
// Temporarily disabled due to https://github.com/getsentry/sentry-dart-plugin/issues/270
// platform.isWindows
return platform.isAndroid ||
platform.isIOS ||
platform.isMacOS ||
platform.isWindows ||
platform.isLinux;
}

static bool _isWebWithWasmSupport() {
Expand Down
16 changes: 16 additions & 0 deletions dart/lib/src/protocol/sentry_operating_system.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,20 @@ class SentryOperatingSystem {
theme: theme ?? this.theme,
unknown: unknown,
);

SentryOperatingSystem mergeWith(SentryOperatingSystem other) =>
SentryOperatingSystem(
name: other.name ?? name,
version: other.version ?? version,
build: other.build ?? build,
kernelVersion: other.kernelVersion ?? kernelVersion,
rooted: other.rooted ?? rooted,
rawDescription: other.rawDescription ?? rawDescription,
theme: other.theme ?? theme,
unknown: other.unknown == null
? unknown
: unknown == null
? null
: {...unknown!, ...other.unknown!},
);
}
Loading

0 comments on commit 00cd940

Please sign in to comment.