feat: refactor countdown update in AFKOverlay#757
Open
odaysec wants to merge 2 commits intoEpicGamesExt:masterfrom
Open
feat: refactor countdown update in AFKOverlay#757odaysec wants to merge 2 commits intoEpicGamesExt:masterfrom
odaysec wants to merge 2 commits intoEpicGamesExt:masterfrom
Conversation
Refactor updateCountdown method to use textContent for countdown updates.
|
lukehb
requested changes
Jan 13, 2026
Contributor
lukehb
left a comment
There was a problem hiding this comment.
I have highlighted an issue with the PR that would be need to be addressed before we could accept it.
Additionally, our linter has highlighted some issues that would also need to be addressed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor updateCountdown method to use textContent for countdown updates.
fix unsafe HTML construction, avoid writing untrusted data into
innerHTML. Instead, build the DOM structure usingdocument.createElement, and insert dynamic pieces viatextContent/innerTextor by explicitly setting properties on elements. This prevents the dynamic value from being interpreted as HTML and eliminates the XSS sink.For this specific case, the overlay content is simple and mostly static. The only dynamic part is the numeric countdown. The safest and least intrusive fix is:
<span id="afkCountDownNumber">, is created without dynamic content (this is already done increateContentElement).updateCountdownso it does not rebuild the full HTML string withinnerHTML. Instead, locate the existing<span id="afkCountDownNumber">withinthis.textElementand update itstextContentwith the currentcountdownvalue.Concretely, in
Frontend/ui-library/src/Overlay/AFKOverlay.ts, replace line 47’sinnerHTMLassignment with logic like:const span = this.textElement.querySelector('#afkCountDownNumber') as HTMLSpanElement | null;span.textContent = String(countdown);this.textElement.textContentor do nothing; here, a simple defensive check is enough.No changes are needed in
Frontend/ui-library/src/Application/Application.ts, because after the AFKOverlay is made safe, passingcountDownintoupdateCountdownno longer reaches a dangerous sink.Relevant components: