Skip to content

Commit 29afc36

Browse files
authored
Merge commit from fork
Fix beets_XSS_01 vulnerability
2 parents e3e8793 + 12a1eea commit 29afc36

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

beetsplug/web/templates/index.html

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ <h1>beets</h1>
3939
<div id="extra-detail"></div>
4040
<!-- Templates. -->
4141
<script type="text/template" id="item-entry-template">
42-
<% if (artist) { %><%= artist %><% } %>
42+
<% if (artist) { %><%- artist %><% } %>
4343
<% if (artist && album) { %> &ndash; <% } %>
44-
<% if (album) { %><%= album %><% } %>
44+
<% if (album) { %><%- album %><% } %>
4545
<% if ((artist || album) && title) { %> &ndash; <% } %>
46-
<%= title %>
46+
<%- title %>
4747
<span class="playing">&#9654;</span>
4848
</script>
4949
<script type="text/template" id="item-main-detail-template">
50-
<span class="artist"><%= artist %></span>
50+
<span class="artist"><%- artist %></span>
5151
<span class="album">
52-
<span class="albumtitle"><%= album %></span>
53-
<span class="year">(<%= year %>)</span>
52+
<span class="albumtitle"><%- album %></span>
53+
<span class="year">(<%- year %>)</span>
5454
</span>
55-
<span class="title"><%= title %></span>
55+
<span class="title"><%- title %></span>
5656

5757
<button class="play">&#9654;</button>
5858

@@ -61,34 +61,34 @@ <h1>beets</h1>
6161
<script type="text/template" id="item-extra-detail-template">
6262
<dl>
6363
<dt>Track</dt>
64-
<dd><%= track %>/<%= tracktotal %></dd>
64+
<dd><%- track %>/<%- tracktotal %></dd>
6565
<% if (disc) { %>
6666
<dt>Disc</dt>
67-
<dd><%= disc %>/<%= disctotal %></dd>
67+
<dd><%- disc %>/<%- disctotal %></dd>
6868
<% } %>
6969
<dt>Length</dt>
70-
<dd><%= timeFormat(length) %></dd>
70+
<dd><%- timeFormat(length) %></dd>
7171
<dt>Format</dt>
72-
<dd><%= format %></dd>
72+
<dd><%- format %></dd>
7373
<dt>Bitrate</dt>
74-
<dd><%= Math.round(bitrate/1000) %> kbps</dd>
74+
<dd><%- Math.round(bitrate/1000) %> kbps</dd>
7575
<% if (mb_trackid) { %>
7676
<dt>MusicBrainz entry</dt>
7777
<dd>
78-
<a target="_blank" href="http://musicbrainz.org/recording/<%= mb_trackid %>">view</a>
78+
<a target="_blank" href="http://musicbrainz.org/recording/<%- mb_trackid %>">view</a>
7979
</dd>
8080
<% } %>
8181
<dt>File</dt>
8282
<dd>
83-
<a target="_blank" class="download" href="item/<%= id %>/file">download</a>
83+
<a target="_blank" class="download" href="item/<%- id %>/file">download</a>
8484
</dd>
8585
<% if (lyrics) { %>
8686
<dt>Lyrics</dt>
87-
<dd class="lyrics"><%= lyrics %></dd>
87+
<dd class="lyrics"><%- lyrics %></dd>
8888
<% } %>
8989
<% if (comments) { %>
9090
<dt>Comments</dt>
91-
<dd><%= comments %></dd>
91+
<dd><%- comments %></dd>
9292
<% } %>
9393
</dl>
9494
</script>

docs/changelog.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ Bug fixes
5454
which also restores compatibility with :doc:`plugins/mbpseudo` for
5555
chroma-triggered lookups. :bug:`6212` :bug:`6441`
5656
- :ref:`import-cmd` Remove clutter from imported album folders. :bug:`5016`
57+
- :doc:`plugins/web`: Fix a stored XSS vulnerability where unescaped metadata
58+
fields (artist, album, title, comments, lyrics) could execute arbitrary
59+
JavaScript in the browser. Template tags now use ``<%-`` (escaped
60+
interpolation) instead of ``<%=`` (raw interpolation).
5761

5862
For plugin developers
5963
~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)