Skip to content

Conversation

@Git-Hub-Chris
Copy link
Owner

Potential fix for https://github.com/Git-Hub-Chris/MicrosoftVsCode/security/code-scanning/93

To fix the problem, you should further restrict the use of SVG images in data URIs for the img.src attribute, because SVGs can contain JavaScript and other active content that can result in XSS vulnerabilities if not thoroughly sanitized. The single best change is to update the isSafeImageSrc() function to disallow SVG images in data URIs, or, if SVG images must be supported, ensure comprehensive sanitization before using them as an image source. In this context, the most effective fix is to remove svg+xml from the list of allowed media types in data URIs.

This change needs to be made in the file extensions/media-preview/media/imagePreview.js, specifically the regex on line 336 in the isSafeImageSrc() function. No new imports are needed, and you do not need to introduce any new variables or logic outside of updating this function.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…as HTML

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Christopher Birnie-Browne <153604499+Git-Hub-Chris@users.noreply.github.com>
@Git-Hub-Chris Git-Hub-Chris marked this pull request as ready for review September 24, 2025 22:43
@Git-Hub-Chris Git-Hub-Chris merged commit e29fafd into Main Sep 24, 2025
11 checks passed
@Git-Hub-Chris Git-Hub-Chris deleted the alert-autofix-93 branch September 24, 2025 22:43
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