fix(ui): XSS, state mutation, and miscellaneous frontend fixes#1927
Open
HandSonic wants to merge 3 commits into
Open
fix(ui): XSS, state mutation, and miscellaneous frontend fixes#1927HandSonic wants to merge 3 commits into
HandSonic wants to merge 3 commits into
Conversation
dangerouslySetInnerHTML rendered unescaped nodeData.originalTitle directly. Database object names containing HTML tags (e.g. <script>) would execute. Now escapes HTML entities before regex replacement.
Multiple actions (appendChatDetails, updateQuestionId, appendAnswerParts, stopAllAnswerParts, updateAnswer) mutated state objects in-place then called set() with the same reference. Zustand's equality check cannot detect changes on the same object reference, causing React components to not re-render. Now uses spread operators to create new objects.
… parsing - base.tsx: use local effectiveErrorLevel variable instead of mutating shared closure variable, preventing concurrent request race condition - useSqlExecutor: onlyOne=true now returns [data[0]] (array) instead of data[0] (single object), matching the declared return type - AIChatInput: add mainPageActiveTab to useEffect dependency array so cascader data updates when switching pages - sseStream: skip lines without colon separator instead of throwing, handling malformed SSE events gracefully
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.
Summary
Fixes 7 verified frontend bugs.
Fixes included:
dangerouslySetInnerHTMLto prevent stored XSS via database object nameseffectiveErrorLevelvariable instead of mutating shared closure variable[data[0]](array) instead ofdata[0](single object), matching declared return typemainPageActiveTabto dependency array so cascader data updates when switching pages