Escape issue summary in search response#9
Open
g4mm4-VCF wants to merge 1 commit into
Open
Conversation
The search response embeds raw HTML in a JSON 'data' field that the plugin's client-side JS injects into the DOM via $.fn.after() on bug_report_page.php. Pass the summary through string_display_line(), the standard MantisBT helper for HTML-safe single-line output, so any HTML characters in stored summaries are rendered as text instead of parsed as markup. Also defensively cast the bug id to int.
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
In
pages/search.php, the issue summary is concatenated directly into the HTML payload returned in the JSONdatafield, then injected into the DOM by the client-side JS via$.fn.after()onbug_report_page.php. Because that path parses HTML, any markup-special character in a stored summary is reflected to anyone running the plugin's live search.This patch pipes the summary through
string_display_line(), which is MantisBT's standard helper for HTML-safe single-line output. The bug id is also cast tointdefensively.Change
One line, no behaviour change for normal summaries, brings the plugin in line with MantisBT core's output-escaping convention.
string_display_line()also fires theEVENT_DISPLAY_TEXThook, so installed formatting plugins (e.g. MantisCoreFormatting) still get to do their own processing.Test plan
<,>,&, etc. are rendered as text in the dropdown rather than parsed as markup.Happy to coordinate further on a security advisory / release tag if useful.