fix(web): escape HTML in commit messages to prevent XSS#6523
Merged
6543 merged 4 commits intoMay 1, 2026
Conversation
Commit messages containing HTML tags (e.g. <input type="color" />) were being rendered as actual HTML elements in the web UI because RenderMarkdown uses v-html with DOMPurify, which allows safe HTML. Add HTML escaping to the message and title computed properties in usePipeline.ts before they reach the markdown renderer, ensuring all special characters are displayed as plain text. Fixes woodpecker-ci#6522 Signed-off-by: wucm667 <stevenwucongmin@gmail.com>
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
6543
reviewed
Apr 30, 2026
Member
|
also some tests might be nice... |
Member
sorry, we just get flooded more and more. happy to work with humans 🚀 |
- Extract escapeHtml from usePipeline.ts to web/src/lib/utils/index.ts - Add comprehensive unit tests for escapeHtml in utils.test.ts - Addresses maintainer review comments on PR woodpecker-ci#6523
Contributor
Author
|
Done. Moved |
Member
6543
approved these changes
May 1, 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.

Fixes #6522
Bug
When a commit message contains HTML tags like
<input type="color" />,the Woodpecker web UI renders them as actual HTML elements instead of
displaying them as plain text. This is a potential XSS vulnerability
in the activity log and pipeline pages.
Root Cause
The
RenderMarkdowncomponent usesv-htmlwith DOMPurify configuredwith
{ USE_PROFILES: { html: true } }, which allows safe HTML elementslike
<input>to be rendered. Commit messages pass through this componentwithout prior HTML escaping.
Fix
Added HTML escaping (
<→<,>→>, etc.) to themessageand
titlecomputed properties inusePipeline.ts. This ensures allspecial characters are displayed as plain text before reaching the
markdown renderer.
Verification