-
Notifications
You must be signed in to change notification settings - Fork 5
Release: XSS security fixes #912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
76ae832
eba35cd
bc07e57
f2b74a7
ececcfa
9f41a71
e51cb29
103424b
015b3ea
e155083
9583131
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| // ==UserScript== | ||
| // @name XMOJ | ||
| // @version 3.1.0 | ||
| // @version 3.1.2 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Do not manually edit the userscript version header; it is managed by the UpdateVersion automation. Revert this change and let the workflow update it. Prompt for AI agents |
||
| // @description XMOJ增强脚本 | ||
| // @author @XMOJ-Script-dev, @langningchen and the community | ||
| // @namespace https://github/langningchen | ||
|
|
@@ -1912,7 +1912,7 @@ async function main() { | |
| let UpdateDataCardListItem = document.createElement("li"); | ||
| UpdateDataCardList.appendChild(UpdateDataCardListItem); | ||
| UpdateDataCardListItem.className = "list-group-item"; | ||
| 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; | ||
| 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); | ||
| } | ||
| let UpdateDataCardLink = document.createElement("a"); | ||
| UpdateDataCardBody.appendChild(UpdateDataCardLink); | ||
|
|
@@ -3418,7 +3418,7 @@ async function main() { | |
| let UpdateDataCardListItem = document.createElement("li"); | ||
| UpdateDataCardList.appendChild(UpdateDataCardListItem); | ||
| UpdateDataCardListItem.className = "list-group-item"; | ||
| 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; | ||
| 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); | ||
| } | ||
| let UpdateDataCardLink = document.createElement("a"); | ||
| UpdateDataCardBody.appendChild(UpdateDataCardLink); | ||
|
|
@@ -3709,8 +3709,8 @@ async function main() { | |
| let UserInfoElement = document.createElement("div"); | ||
| UserInfoElement.classList.add("col-auto"); | ||
| UserInfoElement.style.lineHeight = "40px"; | ||
| UserInfoElement.innerHTML += "用户名:" + UserID + "<br>"; | ||
| UserInfoElement.innerHTML += "昵称:" + UserNick + "<br>"; | ||
| UserInfoElement.innerHTML += "用户名:" + escapeHTML(UserID) + "<br>"; | ||
| UserInfoElement.innerHTML += "昵称:" + escapeHTML(UserNick) + "<br>"; | ||
| if (UtilityEnabled("Rating")) { | ||
| UserInfoElement.innerHTML += "评分:" + ((await GetUserInfo(UserID)).Rating) + "<br>"; | ||
| } | ||
|
|
@@ -4858,7 +4858,7 @@ int main() | |
| TitleLink.classList.add("link-secondary"); | ||
| TitleLink.innerHTML = "🔒 "; | ||
| } | ||
| TitleLink.innerHTML += Posts[i].Title; | ||
| TitleLink.innerHTML += escapeHTML(Posts[i].Title); | ||
| let AuthorCell = document.createElement("td"); | ||
| Row.appendChild(AuthorCell); | ||
| GetUsernameHTML(AuthorCell, Posts[i].UserID); | ||
|
|
@@ -5202,12 +5202,12 @@ int main() | |
| Delete.style.display = ""; | ||
| } | ||
| } | ||
| 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>`); | ||
| 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>`); | ||
| document.title = "讨论" + ThreadID + ": " + ResponseData.Data.Title; | ||
| PostAuthor.innerHTML = "<span></span>"; | ||
| GetUsernameHTML(PostAuthor.children[0], ResponseData.Data.UserID); | ||
| PostTime.innerHTML = GetRelativeTime(ResponseData.Data.PostTime); | ||
| PostBoard.innerHTML = ResponseData.Data.BoardName; | ||
| PostBoard.innerHTML = escapeHTML(ResponseData.Data.BoardName); | ||
| let Replies = ResponseData.Data.Reply; | ||
| PostReplies.innerHTML = ""; | ||
| for (let i = 0; i < Replies.length; i++) { | ||
|
|
@@ -5357,7 +5357,7 @@ int main() | |
| if (Replies[i].EditPerson == Replies[i].UserID) { | ||
| ReplyContentElement.innerHTML += `<span class="text-muted" style="font-size: 12px">最后编辑于${GetRelativeTime(Replies[i].EditTime)}</span>`; | ||
| } else { | ||
| ReplyContentElement.innerHTML += `<span class="text-muted" style="font-size: 12px">最后被<span class="Usernames">${Replies[i].EditPerson}</span>编辑于${GetRelativeTime(Replies[i].EditTime)}</span>`; | ||
| ReplyContentElement.innerHTML += `<span class="text-muted" style="font-size: 12px">最后被<span class="Usernames">${escapeHTML(Replies[i].EditPerson)}</span>编辑于${GetRelativeTime(Replies[i].EditTime)}</span>`; | ||
| } | ||
| } | ||
| let ContentEditElement = document.createElement("div"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "xmoj-script", | ||
| "version": "3.1.0", | ||
| "version": "3.1.2", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Avoid manually updating version numbers; the release automation is responsible for bumping package.json to keep it in sync with XMOJ.user.js and Update.json. Manual edits risk desynchronizing versions. Prompt for AI agents |
||
| "description": "an improvement script for xmoj.tech", | ||
| "main": "AddonScript.js", | ||
| "scripts": { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Security release version 3.1.2 is marked as
Prerelease: true, which will prevent normal users from receiving the XSS security fixes. The update system only prompts non-debug users to install stable (non-prerelease) versions. Change this tofalseto ensure the security patches are distributed to all users.Prompt for AI agents