Skip to content

Commit 6bbc784

Browse files
[mirotalk] - fix(security): escape /activeRooms renderer (stored XSS)
1 parent 56455ab commit 6bbc784

8 files changed

Lines changed: 36 additions & 17 deletions

File tree

.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ====================================================
2-
# MiroTalk P2P v.1.8.36 - Environment Configuration
2+
# MiroTalk P2P v.1.8.37 - Environment Configuration
33
# ====================================================
44

55
# App environment

app/src/config.template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* ==============================================
5-
* MiroTalk P2P v.1.8.36 - Configuration File
5+
* MiroTalk P2P v.1.8.37 - Configuration File
66
* ==============================================
77
*
88
* This file is the central configuration source.

app/src/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dependencies: {
4545
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
4646
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
4747
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
48-
* @version 1.8.36
48+
* @version 1.8.37
4949
*
5050
*/
5151

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mirotalk",
3-
"version": "1.8.36",
3+
"version": "1.8.37",
44
"description": "A free WebRTC browser-based video call",
55
"main": "server.js",
66
"scripts": {

public/js/activeRooms.js

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ function setRoomsContent(html) {
2525
roomsDiv.innerHTML = html;
2626
}
2727

28+
// Security: escape user-controlled strings before injecting into innerHTML.
29+
function escapeHtml(value) {
30+
return String(value ?? '').replace(/[&<>"'`=\/]/g, (c) => {
31+
return {
32+
'&': '&amp;',
33+
'<': '&lt;',
34+
'>': '&gt;',
35+
'"': '&quot;',
36+
"'": '&#39;',
37+
'`': '&#96;',
38+
'=': '&#61;',
39+
'/': '&#47;',
40+
}[c];
41+
});
42+
}
43+
2844
function getRoomsData(res) {
2945
return !isTest ? res.data.activeRooms || [] : mockRooms();
3046
}
@@ -75,30 +91,33 @@ function renderRooms(rooms) {
7591
}
7692
setRoomsContent(
7793
rooms
78-
.map(
79-
(room) => `
94+
.map((room) => {
95+
const id = escapeHtml(room.id);
96+
const peers = Number(room.peers) || 0;
97+
const join = escapeHtml(room.join);
98+
return `
8099
<div class="room-card">
81100
<div class="room-card-header">
82101
<div class="room-title">
83-
<i class="fa-solid fa-door-open"></i>${room.id}
102+
<i class="fa-solid fa-door-open"></i>${id}
84103
</div>
85104
<div class="peer-badge">
86105
<i class="fa-solid fa-users"></i>
87-
${room.peers}
106+
${peers}
88107
</div>
89108
</div>
90109
<div class="room-card-footer">
91110
<div class="peer-status">
92111
<span class="dot"></span>
93-
${room.peers} ${room.peers === 1 ? 'peer' : 'peers'} connected
112+
${peers} ${peers === 1 ? 'peer' : 'peers'} connected
94113
</div>
95-
<a href="${room.join}" class="join-btn" target="_blank">
114+
<a href="${join}" class="join-btn" target="_blank" rel="noopener noreferrer">
96115
<i class="fa-solid fa-arrow-right-to-bracket"></i> Join
97116
</a>
98117
</div>
99118
</div>
100-
`
101-
)
119+
`;
120+
})
102121
.join('')
103122
);
104123
}

public/js/brand.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ let brand = {
109109
},
110110
about: {
111111
imageUrl: '../images/mirotalk-logo.gif',
112-
title: 'WebRTC P2P v1.8.36',
112+
title: 'WebRTC P2P v1.8.37',
113113
html: `
114114
<button
115115
id="support-button"

public/js/client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
1616
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
1717
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
18-
* @version 1.8.36
18+
* @version 1.8.37
1919
*
2020
*/
2121

@@ -15823,7 +15823,7 @@ function showAbout() {
1582315823
Swal.fire({
1582415824
background: swBg,
1582515825
position: 'center',
15826-
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.36',
15826+
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.37',
1582715827
imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
1582815828
customClass: { image: 'img-about' },
1582915829
html: renderRoomTemplate('tpl-about-modal', {

0 commit comments

Comments
 (0)