Repository navigation
fix(Security): improve regex and quote handling in strip_image_tags() - #10745
Merged
paulbalandan merged 1 commit intoNov 15, 2026
Merged
Conversation
paulbalandan
reviewed
Nov 9, 2026
gr8man
force-pushed
the
fix/strip-image-tags-regex
branch
from
November 9, 2026 18:36
e938e43 to
2965a8d
Compare
michalsn
reviewed
Nov 12, 2026
gr8man
force-pushed
the
fix/strip-image-tags-regex
branch
2 times, most recently
from
November 12, 2026 12:36
2c887b5 to
fdfb299
Compare
michalsn
requested changes
Nov 13, 2026
michalsn
left a comment
Member
There was a problem hiding this comment.
Please clarify that this helper is not an HTML sanitizer and does not make its output safe to render as HTML. It returns raw src values, so the result still needs appropriate escaping when displayed as text:
Maybe:
This function replaces image tags with their
srcvalues and removes tags withoutsrc. It does not sanitize HTML or escape the returned values. Use appropriate escaping when displaying the result as text.
paulbalandan
requested changes
Nov 13, 2026
gr8man
force-pushed
the
fix/strip-image-tags-regex
branch
3 times, most recently
from
November 13, 2026 20:06
26d5f5a to
e413069
Compare
strip_image_tags()
paulbalandan
left a comment
Member
There was a problem hiding this comment.
Nit for the docs: please mention that if replacement fails or reaches the iteration limit, remaining <img prefixes are escaped. That explains why callers may see escaped tag text in the result.
gr8man
force-pushed
the
fix/strip-image-tags-regex
branch
from
November 14, 2026 21:35
e413069 to
f5ab3d8
Compare
michalsn
approved these changes
Nov 15, 2026
paulbalandan
approved these changes
Nov 15, 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.
Description
strip_image_tags()used an invalid PCRE character class ([^\1]) that allowed HTML attribute injection upon mixed quotes, while also swallowing intervening text between multiple tags and failing to strip image tags withoutsrc. This change resolves these issues using a branch-reset pattern and ensures tags withoutsrcare stripped.Checklist: