Skip to content

Commit e3bbe9e

Browse files
authored
Merge pull request #912 from XMOJ-Script-dev/dev
2 parents 4a671fc + 9583131 commit e3bbe9e

3 files changed

Lines changed: 47 additions & 10 deletions

File tree

Update.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3348,6 +3348,43 @@
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."
3362+
},
3363+
"3.1.2": {
3364+
"UpdateDate": 1771493127347,
3365+
"Prerelease": true,
3366+
"UpdateContents": [
3367+
{
3368+
"PR": 911,
3369+
"Description": "Fix additional XSS vulnerabilities"
3370+
}
3371+
],
3372+
"Notes": "Fixed additional stored XSS vulnerabilities where user-controlled data was inserted into innerHTML without sanitization."
3373+
},
3374+
"3.2.0": {
3375+
"UpdateDate": 1771493320789,
3376+
"Prerelease": false,
3377+
"UpdateContents": [
3378+
{
3379+
"PR": 910,
3380+
"Description": "Fix XSS in post title rendering"
3381+
},
3382+
{
3383+
"PR": 911,
3384+
"Description": "Fix additional XSS vulnerabilities"
3385+
}
3386+
],
3387+
"Notes": "No release notes were provided for this release."
33513388
}
33523389
}
33533390
}

XMOJ.user.js

Lines changed: 9 additions & 9 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.2.0
44
// @description XMOJ增强脚本
55
// @author @XMOJ-Script-dev, @langningchen and the community
66
// @namespace https://github/langningchen
@@ -1912,7 +1912,7 @@ async function main() {
19121912
let UpdateDataCardListItem = document.createElement("li");
19131913
UpdateDataCardList.appendChild(UpdateDataCardListItem);
19141914
UpdateDataCardListItem.className = "list-group-item";
1915-
UpdateDataCardListItem.innerHTML = "(<a href=\"https://github.com/XMOJ-Script-dev/XMOJ-Script/pull/" + Data.UpdateContents[j].PR + "\" target=\"_blank\">" + "#" + Data.UpdateContents[j].PR + "</a>) " + Data.UpdateContents[j].Description;
1915+
UpdateDataCardListItem.innerHTML = "(<a href=\"https://github.com/XMOJ-Script-dev/XMOJ-Script/pull/" + Data.UpdateContents[j].PR + "\" target=\"_blank\">" + "#" + Data.UpdateContents[j].PR + "</a>) " + escapeHTML(Data.UpdateContents[j].Description);
19161916
}
19171917
let UpdateDataCardLink = document.createElement("a");
19181918
UpdateDataCardBody.appendChild(UpdateDataCardLink);
@@ -3418,7 +3418,7 @@ async function main() {
34183418
let UpdateDataCardListItem = document.createElement("li");
34193419
UpdateDataCardList.appendChild(UpdateDataCardListItem);
34203420
UpdateDataCardListItem.className = "list-group-item";
3421-
UpdateDataCardListItem.innerHTML = "(<a href=\"https://github.com/XMOJ-Script-dev/XMOJ-Script/pull/" + Data.UpdateContents[j].PR + "\" target=\"_blank\">" + "#" + Data.UpdateContents[j].PR + "</a>) " + Data.UpdateContents[j].Description;
3421+
UpdateDataCardListItem.innerHTML = "(<a href=\"https://github.com/XMOJ-Script-dev/XMOJ-Script/pull/" + Data.UpdateContents[j].PR + "\" target=\"_blank\">" + "#" + Data.UpdateContents[j].PR + "</a>) " + escapeHTML(Data.UpdateContents[j].Description);
34223422
}
34233423
let UpdateDataCardLink = document.createElement("a");
34243424
UpdateDataCardBody.appendChild(UpdateDataCardLink);
@@ -3709,8 +3709,8 @@ async function main() {
37093709
let UserInfoElement = document.createElement("div");
37103710
UserInfoElement.classList.add("col-auto");
37113711
UserInfoElement.style.lineHeight = "40px";
3712-
UserInfoElement.innerHTML += "用户名:" + UserID + "<br>";
3713-
UserInfoElement.innerHTML += "昵称:" + UserNick + "<br>";
3712+
UserInfoElement.innerHTML += "用户名:" + escapeHTML(UserID) + "<br>";
3713+
UserInfoElement.innerHTML += "昵称:" + escapeHTML(UserNick) + "<br>";
37143714
if (UtilityEnabled("Rating")) {
37153715
UserInfoElement.innerHTML += "评分:" + ((await GetUserInfo(UserID)).Rating) + "<br>";
37163716
}
@@ -4858,7 +4858,7 @@ int main()
48584858
TitleLink.classList.add("link-secondary");
48594859
TitleLink.innerHTML = "🔒 ";
48604860
}
4861-
TitleLink.innerHTML += Posts[i].Title;
4861+
TitleLink.innerHTML += escapeHTML(Posts[i].Title);
48624862
let AuthorCell = document.createElement("td");
48634863
Row.appendChild(AuthorCell);
48644864
GetUsernameHTML(AuthorCell, Posts[i].UserID);
@@ -5202,12 +5202,12 @@ 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);
52095209
PostTime.innerHTML = GetRelativeTime(ResponseData.Data.PostTime);
5210-
PostBoard.innerHTML = ResponseData.Data.BoardName;
5210+
PostBoard.innerHTML = escapeHTML(ResponseData.Data.BoardName);
52115211
let Replies = ResponseData.Data.Reply;
52125212
PostReplies.innerHTML = "";
52135213
for (let i = 0; i < Replies.length; i++) {
@@ -5357,7 +5357,7 @@ int main()
53575357
if (Replies[i].EditPerson == Replies[i].UserID) {
53585358
ReplyContentElement.innerHTML += `<span class="text-muted" style="font-size: 12px">最后编辑于${GetRelativeTime(Replies[i].EditTime)}</span>`;
53595359
} else {
5360-
ReplyContentElement.innerHTML += `<span class="text-muted" style="font-size: 12px">最后被<span class="Usernames">${Replies[i].EditPerson}</span>编辑于${GetRelativeTime(Replies[i].EditTime)}</span>`;
5360+
ReplyContentElement.innerHTML += `<span class="text-muted" style="font-size: 12px">最后被<span class="Usernames">${escapeHTML(Replies[i].EditPerson)}</span>编辑于${GetRelativeTime(Replies[i].EditTime)}</span>`;
53615361
}
53625362
}
53635363
let ContentEditElement = document.createElement("div");

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.2.0",
44
"description": "an improvement script for xmoj.tech",
55
"main": "AddonScript.js",
66
"scripts": {

0 commit comments

Comments
 (0)