Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix chapter name XSS injection in progress bar #5563

Merged
merged 1 commit into from
May 21, 2024

Conversation

nielsvanvelzen
Copy link
Member

@nielsvanvelzen nielsvanvelzen commented May 20, 2024

The chapter markers in the video player seekbar, introduced in 10.9, have some issues. First they add unsanitized user values to the seekbar (chapter name). And secondly, those names can be anything which could cause serious issues when they clash with existing CSS classes. I have no idea why we add these names as a class as this does not provide any benefit. For now, just add the specific className (which is currently always chapterMarker).

Changes

  • Fix chapter name XSS injection in progress bar

Issues
Fixes #5561

@nielsvanvelzen nielsvanvelzen added bug Something isn't working security This PR or issue mainly concerns security labels May 20, 2024
@nielsvanvelzen nielsvanvelzen requested a review from a team as a code owner May 20, 2024 09:30
Copy link
Contributor

@dmitrylyzo dmitrylyzo left a comment

Choose a reason for hiding this comment

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

I originally only asked for className (can be used to specify an icon from the Material Icons). It must be defined beforehand by the marker provider.

@nielsvanvelzen
Copy link
Member Author

Unfortunately, even if this was meant to change an icon it still doesn't work great. This screenshot was posted in our troubleshooting channel:

TXZOlvwhYVfVNyJXighxBELo

It looks terrible

@dmitrylyzo
Copy link
Contributor

dmitrylyzo commented May 20, 2024

It looks terrible

If necessary, we can add the icon as a child element to the marker (wrap current "span"). Then className (applied to the marker) can be provided with some padding/margin/position.

I mean, the idea was to provide some way for marker customization.

@thornbill
Copy link
Member

The material-icons class should probably be removed also. If we want to keep the title then it could be added as a data attribute... there is no reason to add it as a class.

@dmitrylyzo
Copy link
Contributor

dmitrylyzo commented May 20, 2024

The material-icons class should probably be removed also.

Yes, it's useless in its current state.

If we want to keep the title then it could be added as a data attribute... there is no reason to add it as a class.

className is not a chapter title (title is name). As I said, its purpose is to allow some customization. Currently, it looks like you can only change background-color (say "gray" for chapters, "yellow" for opening/ending).
Looks like we need to add another element to be able to support icons.

Or do you mean storing the title in addition to the class?

@nielsvanvelzen
Copy link
Member Author

nielsvanvelzen commented May 20, 2024

Updated the PR, I've now also removed the material-icons class and the className option as it is never used in any CSS. If we want to show icons again I personally consider that a feature that should not be in a backport.

Copy link

sonarcloud bot commented May 20, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@jellyfin-bot
Copy link
Collaborator

Cloudflare Pages deployment

Latest commit b8a7cf2
Status ✅ Deployed!
Preview URL https://65011071.jellyfin-web.pages.dev
Type 🔀 Preview

View build logs
View bot logs

@thornbill thornbill added this to the v10.9.3 milestone May 20, 2024
@thornbill thornbill added the stable backport Backport into the next stable release label May 20, 2024
@thornbill
Copy link
Member

className is not a chapter title (title is name). As I said, its purpose is to allow some customization. Currently, it looks like you can only change background-color (say "gray" for chapters, "yellow" for opening/ending). Looks like we need to add another element to be able to support icons.

Or do you mean storing the title in addition to the class?

I mean we should not be appending the chapter Name as an additional css class (marker-${markerInfo.name.substring(0, 100).toLowerCase().replace(' ', '-')}). Maybe we could add it as a data-* attribute, but since it is unused, I would prefer just removing it for now.

@thornbill thornbill merged commit 7eb54e0 into jellyfin:release-10.9.z May 21, 2024
12 checks passed
@nielsvanvelzen nielsvanvelzen deleted the fix-chapter-xss branch May 21, 2024 05:39
joshuaboniface pushed a commit that referenced this pull request May 25, 2024
Fix chapter name XSS injection in progress bar

Original-merge: 7eb54e0

Merged-by: thornbill <thornbill@users.noreply.github.com>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
@jellyfin-bot jellyfin-bot removed the stable backport Backport into the next stable release label May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working security This PR or issue mainly concerns security
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants