Skip to content

Commit f2b74a7

Browse files
authored
Merge pull request #910 from XMOJ-Script-dev/fix/xss-post-title
Fix XSS in post title rendering
2 parents 068092d + bc07e57 commit f2b74a7

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

Update.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3348,6 +3348,17 @@
33483348
}
33493349
],
33503350
"Notes": "v3 显然需要在新年第一天发布("
3351+
},
3352+
"3.1.1": {
3353+
"UpdateDate": 1771489733913,
3354+
"Prerelease": true,
3355+
"UpdateContents": [
3356+
{
3357+
"PR": 910,
3358+
"Description": "Fix XSS in post title rendering"
3359+
}
3360+
],
3361+
"Notes": "Fixed a stored XSS vulnerability in discussion thread post titles."
33513362
}
33523363
}
33533364
}

XMOJ.user.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name XMOJ
3-
// @version 3.1.0
3+
// @version 3.1.1
44
// @description XMOJ增强脚本
55
// @author @XMOJ-Script-dev, @langningchen and the community
66
// @namespace https://github/langningchen
@@ -5202,7 +5202,7 @@ int main()
52025202
Delete.style.display = "";
52035203
}
52045204
}
5205-
PostTitle.innerHTML = ResponseData.Data.Title + (ResponseData.Data.ProblemID == 0 ? "" : ` - 题目` + ` <a href="https://www.xmoj.tech/problem.php?id=` + ResponseData.Data.ProblemID + `">` + ResponseData.Data.ProblemID + `</a>`);
5205+
PostTitle.innerHTML = escapeHTML(ResponseData.Data.Title) + (ResponseData.Data.ProblemID == 0 ? "" : ` - 题目` + ` <a href="https://www.xmoj.tech/problem.php?id=` + ResponseData.Data.ProblemID + `">` + ResponseData.Data.ProblemID + `</a>`);
52065206
document.title = "讨论" + ThreadID + ": " + ResponseData.Data.Title;
52075207
PostAuthor.innerHTML = "<span></span>";
52085208
GetUsernameHTML(PostAuthor.children[0], ResponseData.Data.UserID);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xmoj-script",
3-
"version": "3.1.0",
3+
"version": "3.1.1",
44
"description": "an improvement script for xmoj.tech",
55
"main": "AddonScript.js",
66
"scripts": {

0 commit comments

Comments
 (0)