Skip to content

Escape the comment website URL on output - #13

Closed
p-w wants to merge 1 commit into
splitbrain:mainfrom
p-w:security-hardening
Closed

p-w wants to merge 1 commit into
splitbrain:mainfrom
p-w:security-hardening

Conversation

@p-w

@p-w p-w commented Nov 13, 2026

Copy link
Copy Markdown

Security hardening for a privately reported issue. A credit for Peter Wilfahrt (p-w) would be appreciated if a fix is released, though it is by no means required.
GitHub: https://github.com/p-w Web: https://pw.is

A public comment's website field was stored verbatim and rendered by the
frontend directly into an anchor href. Because the component does not
sanitize the URL, a javascript: value was stored XSS - executing (on
click) in the blog origin, including in the admin moderation view, where
the admin JWT lives in localStorage. Separately, the admin edit endpoint
copied the raw comment text into the html column (rendered via
innerHTML), bypassing the safe-mode Markdown that create() uses, so an
admin text edit turned any HTML payload into live markup.

Validate the website URL server-side (only http(s) or empty/relative;
reject javascript:/data: and control-char-smuggled schemes) in both
create and edit, and run the admin edit through the same safe-mode
Parsedown pipeline instead of copying raw text into html.
splitbrain added a commit that referenced this pull request Nov 13, 2026
The website of a comment was stored as given and used as the link
target of the author name. Anyone could post a comment with a
javascript: URL as website. When the admin clicked the author name
of such a comment, the script ran with the admin's access. The Disqus
importer also stored websites from the export file without a check.
Now only http and https URLs are stored, all other values are removed.

Reported by Peter Wilfahrt (p-w) in #13
@splitbrain

Copy link
Copy Markdown
Owner

fixed a bit differently. thanks for reporting

@splitbrain splitbrain closed this Nov 13, 2026
@p-w
p-w deleted the security-hardening branch November 14, 2026 11:31
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