getsentry / sentry

Developer-first error tracking and performance monitoring
https://sentry.io
Other
39.22k stars 4.21k forks source link

fix(toolbar): Remove closing </body> tag so extra #login_as markup is not injected #81106

Closed ryan953 closed 8 hours ago

ryan953 commented 19 hours ago

In getsentry we inject some login code to the bottom of rendered templates, we don't need this to happen inside our toolbar popup; and we can skip it by omitting the </body> tag form the template.

class ViewAsRenderMiddleware will replace </body> with the content of https://github.com/getsentry/getsentry/blob/3cff20a7236510b918e785e3cd50a3cd20434207/getsentry/templates/viewas/header.html#L1

ryan953 commented 8 hours ago

Could build-in a way i guess. Whether the code is injected or not isn't a huge deal because it's inert anyway. I just want it skipped so the payload is a little bit smaller....

There will be a followup though to make this page look nice, so importing global styles (or bootstrapping react + emotion? idk), so not over-over yet.

ryan953 commented 8 hours ago

The popup we're talking about looks like this right now, with or without the login_as stuff appended is the same.

SCR-20241121-uklg
codecov[bot] commented 8 hours ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

:white_check_mark: All tests successful. No failed tests found.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #81106 +/- ## ========================================== - Coverage 78.49% 78.48% -0.02% ========================================== Files 7215 7215 Lines 319812 319812 Branches 44045 44045 ========================================== - Hits 251040 251005 -35 - Misses 62387 62412 +25 - Partials 6385 6395 +10 ```