Fix XSS in Welcome template and sanitize Reviewed in User review #set#2
Open
Fix XSS in Welcome template and sanitize Reviewed in User review #set#2
Conversation
- Welcome: escape {{{name}}} in greeting (< and > to < >) to prevent XSS; sanitize name in formredlink target (strip ], [, |) to prevent link/query injection
- User review: sanitize {{{Reviewed|}}} when used in #set (strip ], [, |) to prevent SMW store injection
- Add ParserFunctions to requiredExtensions and README ($wgPFEnableStringFunctions = true)
Co-authored-by: Cursor <cursoragent@cursor.com>
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
Addresses two security issues found during repo audit:
XSS in Welcome template –
Template/Welcome.mediawikioutputs{{{name}}}raw in "Hello {{{name}}}". When the welcome message is posted to a new user's talk page, the name is the username; a username containing<script>or similar would execute. The same parameter is used informredlinktarget=User:{{{name}}}without sanitization, allowing link/query injection. Fix: Escape<and>in the greeting; strip][|from name when used in the link target.User review #set unsanitized –
Template/User review.mediawikiuses{{#set:Is reviewed={{{Reviewed|}}}}}. The form normally sends Yes/No, but the value can be tampered (e.g. via query string). A value containing]or|can break the #set or inject. Fix: Strip][|from Reviewed when used in #set.Dependency: ParserFunctions with
$wgPFEnableStringFunctions = trueadded to requiredExtensions and README.GitHub issues can be filed separately for each finding. Jira SLOP task(s) to be created and linked when Jira is available.
Audit: Repo audit workflow; work performed by AI / Cursor Agent.