Skip to content

Commit 239a123

Browse files
authored
Merge branch 'main' into feat/otlp
2 parents ce816d3 + 0d66c0b commit 239a123

File tree

39 files changed

+1668
-298
lines changed

39 files changed

+1668
-298
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
3737

3838
- name: Initialize CodeQL
39-
uses: github/codeql-action/init@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # pin@v2
39+
uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e # pin@v2
4040
with:
4141
languages: 'java'
4242

@@ -45,4 +45,4 @@ jobs:
4545
./gradlew buildForCodeQL --no-build-cache
4646
4747
- name: Perform CodeQL Analysis
48-
uses: github/codeql-action/analyze@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # pin@v2
48+
uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e # pin@v2

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
fetch-depth: 0
3535
submodules: 'recursive'
3636
- name: Prepare release
37-
uses: getsentry/craft@63d1636bead951f6e034ed62c2a3610965fef010 # v2
37+
uses: getsentry/craft@41defb379de52e5f0e3943944fa5575b22fb9f92 # v2
3838
env:
3939
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
4040
with:

AGENTS.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,21 @@ The repository is organized into multiple modules:
144144
4. New features must be **opt-in by default** - extend `SentryOptions` or similar Option classes with getters/setters
145145
5. Consider backwards compatibility
146146

147+
### Getting PR Information
148+
149+
Use `gh pr view` to get PR details from the current branch. This is needed when adding changelog entries, which require the PR number.
150+
151+
```bash
152+
# Get PR number for current branch
153+
gh pr view --json number -q '.number'
154+
155+
# Get PR number for a specific branch
156+
gh pr view <branch-name> --json number -q '.number'
157+
158+
# Get PR URL
159+
gh pr view --json url -q '.url'
160+
```
161+
147162
## Useful Resources
148163

149164
- Main SDK documentation: https://develop.sentry.dev/sdk/overview/

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@
88
- OpenTelemetry is configured to send spans to Sentry directly using an OTLP endpoint.
99
- Sentry only uses trace and span ID from OpenTelemetry (via `OpenTelemetryOtlpEventProcessor`) but will not send spans through OpenTelemetry nor use OpenTelemetry `Context` for `Scopes` propagation.
1010
- See the OTLP setup docs for [Java](https://docs.sentry.io/platforms/java/opentelemetry/setup/otlp/) and [Spring Boot](https://docs.sentry.io/platforms/java/guides/spring-boot/opentelemetry/setup/otlp/) for installation and configuration instructions.
11+
- Add screenshot masking support using view hierarchy ([#5077](https://github.com/getsentry/sentry-java/pull/5077))
12+
- Masks sensitive content (text, images) in error screenshots using the same view hierarchy approach as Session Replay
13+
- Requires the `sentry-android-replay` module to be present at runtime for masking to work
14+
- Enable via code:
15+
```kotlin
16+
SentryAndroid.init(context) { options ->
17+
options.isAttachScreenshot = true
18+
options.screenshot.setMaskAllText(true)
19+
options.screenshot.setMaskAllImages(true)
20+
// Or mask specific view classes
21+
options.screenshot.addMaskViewClass("com.example.MyCustomView")
22+
}
23+
```
24+
- Or via `AndroidManifest.xml`:
25+
```xml
26+
<meta-data android:name="io.sentry.attach-screenshot" android:value="true" />
27+
<meta-data android:name="io.sentry.screenshot.mask-all-text" android:value="true" />
28+
<meta-data android:name="io.sentry.screenshot.mask-all-images" android:value="true" />
29+
```
1130

1231
### Fixes
1332

CLAUDE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
## STOP — Required Reading (Do This First)
44

55
Before doing ANYTHING else (including answering questions), you MUST use the Read tool to load [AGENTS.md](AGENTS.md) and follow ALL of its instructions, including reading the required `.cursor/rules/*.mdc` files it references.
6-
76
Do NOT skip this step. Do NOT proceed without reading these files first.

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,4 @@ msgpack = { module = "org.msgpack:msgpack-core", version = "0.9.8" }
238238
okhttp-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" }
239239
okio = { module = "com.squareup.okio:okio", version = "1.13.0" }
240240
roboelectric = { module = "org.robolectric:robolectric", version = "4.14" }
241+
dropbox-differ = { module = "com.dropbox.differ:differ-jvm", version = "0.3.0" }

sentry-android-core/api/sentry-android-core.api

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ public final class io/sentry/android/core/NetworkBreadcrumbsIntegration : io/sen
326326
}
327327

328328
public final class io/sentry/android/core/ScreenshotEventProcessor : io/sentry/EventProcessor {
329-
public fun <init> (Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/android/core/BuildInfoProvider;)V
329+
public fun <init> (Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/android/core/BuildInfoProvider;Z)V
330330
public fun getOrder ()Ljava/lang/Long;
331331
public fun process (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/SentryEvent;
332332
public fun process (Lio/sentry/protocol/SentryTransaction;Lio/sentry/Hint;)Lio/sentry/protocol/SentryTransaction;
@@ -354,6 +354,7 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr
354354
public fun getFrameMetricsCollector ()Lio/sentry/android/core/internal/util/SentryFrameMetricsCollector;
355355
public fun getNativeSdkName ()Ljava/lang/String;
356356
public fun getNdkHandlerStrategy ()I
357+
public fun getScreenshot ()Lio/sentry/android/core/SentryScreenshotOptions;
357358
public fun getStartupCrashDurationThresholdMillis ()J
358359
public fun isAnrEnabled ()Z
359360
public fun isAnrReportInDebug ()Z
@@ -450,6 +451,12 @@ public final class io/sentry/android/core/SentryPerformanceProvider {
450451
public fun shutdown ()V
451452
}
452453

454+
public final class io/sentry/android/core/SentryScreenshotOptions : io/sentry/SentryMaskingOptions {
455+
public fun <init> ()V
456+
public fun setMaskAllImages (Z)V
457+
public fun trackCustomMasking ()V
458+
}
459+
453460
public class io/sentry/android/core/SentryUserFeedbackButton : android/widget/Button {
454461
public fun <init> (Landroid/content/Context;)V
455462
public fun <init> (Landroid/content/Context;Landroid/util/AttributeSet;)V

sentry-android-core/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ dependencies {
108108
testImplementation(projects.sentryAndroidReplay)
109109
testImplementation(projects.sentryCompose)
110110
testImplementation(projects.sentryAndroidNdk)
111+
testImplementation(libs.dropbox.differ)
111112
testRuntimeOnly(libs.androidx.compose.ui)
112113
testRuntimeOnly(libs.androidx.fragment.ktx)
113114
testRuntimeOnly(libs.timber)

sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ static void initializeIntegrationsAndProcessors(
188188
options.addEventProcessor(
189189
new DefaultAndroidEventProcessor(context, buildInfoProvider, options));
190190
options.addEventProcessor(new PerformanceAndroidEventProcessor(options, activityFramesTracker));
191-
options.addEventProcessor(new ScreenshotEventProcessor(options, buildInfoProvider));
191+
options.addEventProcessor(
192+
new ScreenshotEventProcessor(options, buildInfoProvider, isReplayAvailable));
192193
options.addEventProcessor(new ViewHierarchyEventProcessor(options));
193194
options.addEventProcessor(
194195
new ApplicationExitInfoEventProcessor(context, options, buildInfoProvider));

sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ final class ManifestMetadataReader {
170170

171171
static final String SPOTLIGHT_CONNECTION_URL = "io.sentry.spotlight.url";
172172

173+
static final String SCREENSHOT_MASK_ALL_TEXT = "io.sentry.screenshot.mask-all-text";
174+
175+
static final String SCREENSHOT_MASK_ALL_IMAGES = "io.sentry.screenshot.mask-all-images";
176+
173177
/** ManifestMetadataReader ctor */
174178
private ManifestMetadataReader() {}
175179

@@ -659,6 +663,14 @@ static void applyMetadata(
659663
if (spotlightUrl != null) {
660664
options.setSpotlightConnectionUrl(spotlightUrl);
661665
}
666+
667+
// Screenshot masking options (default to false for backwards compatibility)
668+
options
669+
.getScreenshot()
670+
.setMaskAllText(readBool(metadata, logger, SCREENSHOT_MASK_ALL_TEXT, false));
671+
options
672+
.getScreenshot()
673+
.setMaskAllImages(readBool(metadata, logger, SCREENSHOT_MASK_ALL_IMAGES, false));
662674
}
663675
options
664676
.getLogger()

0 commit comments

Comments
 (0)