Skip to content

Conversation

@billyvg
Copy link
Member

@billyvg billyvg commented Oct 23, 2025

Pass ignoreCSSAttributes with background-imgae to ignore background images when blockAllMedia is enabled. ignoreCSSAttributes was expanded in this PR so that it also works for inline styles.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.63 kB - -
@sentry/browser - with treeshaking flags 23.11 kB - -
@sentry/browser (incl. Tracing) 40.97 kB - -
@sentry/browser (incl. Tracing, Profiling) 45.26 kB - -
@sentry/browser (incl. Tracing, Replay) 79.52 kB +0.29% +228 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.2 kB +0.33% +226 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 84.22 kB +0.28% +227 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 96.38 kB +0.24% +225 B 🔺
@sentry/browser (incl. Feedback) 41.3 kB - -
@sentry/browser (incl. sendFeedback) 29.29 kB - -
@sentry/browser (incl. FeedbackAsync) 34.22 kB - -
@sentry/react 26.31 kB - -
@sentry/react (incl. Tracing) 42.97 kB - -
@sentry/vue 29.11 kB - -
@sentry/vue (incl. Tracing) 42.75 kB - -
@sentry/svelte 24.64 kB - -
CDN Bundle 26.9 kB - -
CDN Bundle (incl. Tracing) 41.62 kB - -
CDN Bundle (incl. Tracing, Replay) 78.12 kB +0.32% +247 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 83.58 kB +0.28% +233 B 🔺
CDN Bundle - uncompressed 78.86 kB - -
CDN Bundle (incl. Tracing) - uncompressed 123.44 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 239.33 kB +0.36% +846 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 252.09 kB +0.34% +846 B 🔺
@sentry/nextjs (client) 45.11 kB - -
@sentry/sveltekit (client) 41.4 kB - -
@sentry/node-core 50.75 kB -0.01% -1 B 🔽
@sentry/node 157.81 kB +0.01% +1 B 🔺
@sentry/node - without tracing 92.63 kB +0.01% +1 B 🔺
@sentry/aws-serverless 106.35 kB - -

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 2025

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 11,417 - 9,643 +18%
GET With Sentry 1,616 14% 1,422 +14%
GET With Sentry (error only) 7,808 68% 6,216 +26%
POST Baseline 1,183 - 1,219 -3%
POST With Sentry 528 45% 561 -6%
POST With Sentry (error only) 1,062 90% 1,071 -1%
MYSQL Baseline 4,130 - 3,392 +22%
MYSQL With Sentry 543 13% 477 +14%
MYSQL With Sentry (error only) 3,375 82% 2,748 +23%

View base workflow run

@billyvg billyvg marked this pull request as ready for review October 23, 2025 17:50
@billyvg billyvg requested a review from a team as a code owner October 23, 2025 17:50
@billyvg billyvg requested a review from chargome October 23, 2025 17:51
Pass `ignoreCSSAttributes` with `background-imgae` to ignore background images when `blockAllMedia` is enabled. `ignoreCSSAttributes` was expanded in [this PR](getsentry/rrweb#252) so that it also works for inline styles.
@billyvg billyvg force-pushed the billy/feat-replay-ignore-background-css-inline branch from 83a5467 to a6b7d3d Compare October 24, 2025 17:28
this._recordingOptions.blockSelector = !this._recordingOptions.blockSelector
? MEDIA_SELECTORS
: `${this._recordingOptions.blockSelector},${MEDIA_SELECTORS}`;
this._recordingOptions.ignoreCSSAttributes = new Set(['background-image']);
Copy link

Choose a reason for hiding this comment

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

Bug: Media Block Overwrites CSS Ignore Settings

When blockAllMedia is enabled, this._recordingOptions.ignoreCSSAttributes is unconditionally overwritten with a new Set containing only 'background-image'. This causes any previously configured ignored CSS attributes to be lost, unlike the merging behavior for blockSelector.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't publicly expose ignoreCSSAttributes so we won't be overwriting anything

@billyvg
Copy link
Member Author

billyvg commented Oct 24, 2025

@sentry review

Comment on lines 189 to +190
: `${this._recordingOptions.blockSelector},${MEDIA_SELECTORS}`;
this._recordingOptions.ignoreCSSAttributes = new Set(['background-image']);
Copy link

Choose a reason for hiding this comment

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

The ignoreCSSAttributes is unconditionally set here, which will override any user-provided configuration. Consider checking if it's already set before assigning it, or merging with existing values if the property supports it. This ensures that user-provided configurations are respected and not silently overwritten.
Severity: MEDIUM

🤖 Prompt for AI Agent

Fix this code. In packages/replay-internal/src/integration.ts#L189-L190: The
`ignoreCSSAttributes` is unconditionally set here, which will override any user-provided
configuration. Consider checking if it's already set before assigning it, or merging
with existing values if the property supports it. This ensures that user-provided
configurations are respected and not silently overwritten.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Member Author

Choose a reason for hiding this comment

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

@sentry can you check that we allow the user to provide ignoreCSSAttributes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant