Skip to content

fix: Don't use HTML in panel titles, treat as text#2365

Merged
mofojed merged 3 commits intodeephaven:mainfrom
mofojed:DH-18645-fix-html-title
Feb 7, 2025
Merged

fix: Don't use HTML in panel titles, treat as text#2365
mofojed merged 3 commits intodeephaven:mainfrom
mofojed:DH-18645-fix-html-title

Conversation

@mofojed
Copy link
Copy Markdown
Member

@mofojed mofojed commented Feb 7, 2025

  • Golden Layout was setting the title in panel titles with .html() method, which allows remote code execution, and potentially could craft a notebook with a malicious name that could run arbitrary JS
  • Instead just use .text and treat it like text, as we should.
  • Tested on DHC - created a notebook with the name <img src=q onerror=prompt(1)>.py. It now appears correctly as text and does not pop up an alert message. Also verified that title still appears in italics when in "preview" mode.
  • Fixes DH-18645

- Golden Layout was setting the title in panel titles with `.html()` method, which allows remote code execution, and potentially could craft a notebook with a malicious name that could run arbitrary JS
- Instead just use `.text` and treat it like text, as we should.
- Tested on DHC - created a notebook with the name `<img src=q onerror=prompt(1)>.py`. It now appears correctly as text and does not pop up an alert message
@mofojed mofojed requested a review from a team February 7, 2025 15:03
@mofojed mofojed self-assigned this Feb 7, 2025
@mofojed mofojed requested review from bmingles and removed request for a team February 7, 2025 15:03
Copy link
Copy Markdown
Contributor

@bmingles bmingles left a comment

Choose a reason for hiding this comment

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

Unit tests are failing. Looks like they need to be updated with escaped values.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.72%. Comparing base (0305522) to head (577083d).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2365      +/-   ##
==========================================
- Coverage   46.74%   46.72%   -0.03%     
==========================================
  Files         710      710              
  Lines       39125    39143      +18     
  Branches     9779     9972     +193     
==========================================
  Hits        18289    18289              
- Misses      20825    20843      +18     
  Partials       11       11              
Flag Coverage Δ
unit 46.72% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mofojed mofojed requested a review from bmingles February 7, 2025 20:36
Copy link
Copy Markdown
Contributor

@bmingles bmingles left a comment

Choose a reason for hiding this comment

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

LGTM

@mofojed mofojed merged commit e28a741 into deephaven:main Feb 7, 2025
@mofojed mofojed deleted the DH-18645-fix-html-title branch February 7, 2025 21:24
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants