Skip to content

Fixes for a set of XSS security issues found using Psalm taint analysis - #1718

Merged
cpeel merged 15 commits into
DistributedProofreaders:masterfrom
bpfoley:xss-1
Nov 22, 2026
Merged

cpeel merged 15 commits into
DistributedProofreaders:masterfrom
bpfoley:xss-1

Conversation

@bpfoley

@bpfoley bpfoley commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

…= and url=

Note that URL needs to be something that can be fetched via HTTP,
but there's nothing stopping a malicious user setting up a web server
where '><script>...<script> is valid at the end of a URL
… param

Only applies for action=edit, action=delete.

Other actions fail with null argument TypeError  exception when the
language code can't be looked up by name. Add an explicit guard for this
rather than accidentally blocking further progress.

Add some extra input validation and URL escaping.

The guard & validation makes some of these html_safe/attr_safe
redundant, but it's better to be belt and braces in case this code is
ever refactored.
…direction= params

Add more input validation, and HTML escaping of dumped SQL output
while we're here.
…x XSS from cutoff= and lang_match= params

While here, validate most of the input strictly, escape the SQL WHERE
clause and HTML escape some more output
…aim pages

Very unlikely to be exploitable, but it quells a warning from Psalm
It's not technically necessary, but Psalm doesn't understand the
flow control and can't see that none of the messages contain HTML
characters.
* The anchor for a row to scroll to the correct location on form
  reload can be a simple counter like row_N.
* The bare HTML should use html_safe
* The hidden form field should use attr_safe
All these params are checked by validate_projectID/validate_page_image
and so can't be used for XSS.
All these page IDs are validated, so can't be used for XSS.
…r report card

It's a plain-text <pre>-block with a few bits of server-provided
styling. HTML escape all the comments provided by the user to avoid XSS.
@cpeel
cpeel merged commit 97fd7b7 into DistributedProofreaders:master Nov 22, 2026
12 checks passed
@bpfoley
bpfoley deleted the xss-1 branch November 22, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants