-
Notifications
You must be signed in to change notification settings - Fork 33
PF5: Copy response text as both plain text and rich HTML #1879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kyoto
wants to merge
1
commit into
openshift:pattern-fly-5
Choose a base branch
from
kyoto:pf5-copy-rich-text
base: pattern-fly-5
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: openshift/lightspeed-console
Length of output: 91
🏁 Script executed:
Repository: openshift/lightspeed-console
Length of output: 696
🏁 Script executed:
Repository: openshift/lightspeed-console
Length of output: 137
🏁 Script executed:
Repository: openshift/lightspeed-console
Length of output: 826
🏁 Script executed:
Repository: openshift/lightspeed-console
Length of output: 54
🏁 Script executed:
Repository: openshift/lightspeed-console
Length of output: 54
🌐 Web query:
marked 14.0.0 sanitization HTML security💡 Result:
In marked version 14.0.0, there is no built-in HTML sanitization feature. The legacy 'sanitize' and 'sanitizer' options were removed in version 8.0.0. Marked explicitly warns that it does not sanitize output HTML and users must apply a separate sanitization library to prevent XSS attacks when processing untrusted input. Key security guidance from official documentation: - Marked converts Markdown (including raw HTML blocks) to HTML without filtering dangerous content like script tags or malicious attributes. - Recommended approach: Parse with marked first, then sanitize the resulting HTML. - Primary recommendation: Use DOMPurify.sanitize(marked.parse(markdown)). - Alternatives: sanitize-html, insane, or js-xss. Example for secure usage: import { marked } from 'marked'; import DOMPurify from 'dompurify'; const safeHtml = DOMPurify.sanitize(marked.parse(userMarkdown)); Using extensions with hooks.postprocess: marked.use({ hooks: { postprocess(html) { return DOMPurify.sanitize(html); } } }); No XSS vulnerabilities are reported specifically for marked 14.0.0 in security databases like Snyk or GitHub Advisories. Past issues (pre-v4) involved ReDoS, fixed long ago. Version 14.0.0 (released Aug 2024) focuses on renderer changes, with no sanitization-related updates. For untrusted user input, always sanitize post-parsing to mitigate risks from raw HTML in Markdown.
Citations:
sanitizeroption for easier secure rendering with DOMPurify markedjs/marked#3943🏁 Script executed:
Repository: openshift/lightspeed-console
Length of output: 54
Sanitize the HTML and add a fallback for older browsers.
marked.parse(value)preserves raw HTML from the markdown source, and marked 14.0.0 has no built-in sanitization. Thetext/htmlclipboard payload can carry untrusted markup into downstream paste targets without external sanitization. Additionally, this implementation unconditionally depends onClipboardItem/navigator.clipboard.write(), so browsers without support for the richer clipboard API will silently fail instead of falling back tonavigator.clipboard.writeText(value).Recommendations:
ClipboardItemsupport🤖 Prompt for AI Agents