mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2026-09-03 03:50:02 +03:00
Fix xss in listview
This commit is contained in:
@@ -191,6 +191,11 @@ export function getListViewHtml(options) {
|
||||
for (let i = 0, length = items.length; i < length; i++) {
|
||||
const item = items[i];
|
||||
|
||||
const safeOverviewHtml = item.Overview ?
|
||||
// eslint-disable-next-line sonarjs/disabled-auto-escaping
|
||||
DOMPurify.sanitize(markdownIt({ html: true }).render(item.Overview)) :
|
||||
'';
|
||||
|
||||
let html = '';
|
||||
|
||||
if (options.showIndex) {
|
||||
@@ -416,11 +421,9 @@ export function getListViewHtml(options) {
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
if (enableOverview && item.Overview) {
|
||||
// eslint-disable-next-line sonarjs/disabled-auto-escaping
|
||||
const overview = DOMPurify.sanitize(markdownIt({ html: true }).render(item.Overview || ''));
|
||||
if (enableOverview && safeOverviewHtml) {
|
||||
html += '<div class="secondary listItem-overview listItemBodyText">';
|
||||
html += '<bdi>' + overview + '</bdi>';
|
||||
html += `<bdi>${safeOverviewHtml}</bdi>`;
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
@@ -482,9 +485,9 @@ export function getListViewHtml(options) {
|
||||
if (enableContentWrapper) {
|
||||
html += '</div>';
|
||||
|
||||
if (enableOverview && item.Overview) {
|
||||
if (enableOverview && safeOverviewHtml) {
|
||||
html += '<div class="listItem-bottomoverview secondary">';
|
||||
html += '<bdi>' + item.Overview + '</bdi>';
|
||||
html += `<bdi>${safeOverviewHtml}</bdi>`;
|
||||
html += '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user