Repository navigation
Fixes for a second round of XSS security issues found by Psalm's taint analysis. - #1719
Merged
Merged
Conversation
…TP_HOST (Although in practice, with virtual hosting, the caller may not be able to set the Host: header in the HTTP request to anything other than the hostname of the web server.)
While here, quell Psalm warning when printing usernames.
While here, use attr_safe on all the user input, despite it being validated to quell Psalm warnings.
Ironically this happens with user-provided paths that fail to validate. It just echos the entire thing unescaped.
…rn= param And while here sprinkle more defensive escaping (partly to quell Psalm warnings)
… controllable code_name (It's escaped elsewhere in the script)
…r names The script correctly validates the name for eg, path traversal issues, or using unsafe characters, for all filesystem activities such as renaming a file or creating a directory, but then drops the ball at the last step and shows the unescaped name in the fatal error message :(
… XSS in word= param It displays an unescaped version of the word= param, both undecoded if base16 decoding fails, and decoded if base16 decoding succeeds. Oy.
It displays an unescaped version of the word= param, both undecoded if base16 decoding fails, and decoded if base16 decoding succeeds. Oy.
This is probably harmless, but on the off chance that the FileUploadException can contain user-controlled characters, we should probably do this. Also it quells a Psalm taint warning.
We know valid usernames don't contain special HTML characters, but with the current structure of the code, Psalm can't see this.
by escaping HTML attributes. All of these are validated or are simple strings with no HTML special characters already, but Psalm can't see this, as belt-and-braces and to quell the warning, escape them anyway.
via echo_page_table. Not actually exploitable because page_detail.php validates selected_pages param in a way Psalm doesn't understand.
…e cookie While here, HTML escape all the other displayed info just to be safe.
This is an XSS exploit if the HTTP client sends non-percent encoded params (including ones unused by the page)
This can be set to any string up to 25 characters in length.
And while here, fail early if stage_id isn't a valid stage to prevent ugly error messages later. (It also incidentally makes the escaping unnecessary, but belt-and-braces in case this code is ever refactored)
These all happen to be inputs that are restricted to a particular set (although Psalm can't quite see it), or HTML-safe usernames.
These are server-controlled and practically speaking, will be HTML-safe strings, but Psalm doesn't know this, so to quell its warnings and be on the safe side, escape them.
…forms In practice, these are server-controlled random IDs like "icon_1234567890123.png" with no HTML special characters in them (see $avatarID and $iconID), but escape them to quell Psalm's warnings.
Amusingly, the row= and col= params couldn't be used for XSS because the table_pad function 'accidentally' validated these params as integers by throwing a TypeError if they weren't numeric-strings While here, fix a padding error.
All of the inputs were sufficiently validated/constrained that they're not XSS-able, but Psalm couldn't see that.
cpeel
approved these changes
Nov 22, 2026
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.
No description provided.