fix(builder): safeImageUrl for FeaturesGrid/ContentSlider image sinks + tighten data:image allowlist
FeaturesGrid's <img src> and ContentSlider's CSS background-image url() were still on safeUrl, which blocks data:image/svg+xml -- inconsistent with other image sinks already swapped to safeImageUrl and a latent regression for those two components. Swapped both to safeImageUrl; left their navigation sinks (buttonUrl/buttonHref) on safeUrl. Also tightened safeImageUrl's data:image allowlist check to require the slash (dataimage/ not dataimage), so a bogus MIME like data:imagehtml/... can no longer slip past the prefix check.
This commit is contained in:
@@ -102,7 +102,7 @@ export function safeImageUrl(s: unknown): string {
|
||||
if (collapsed.startsWith('javascript') || collapsed.startsWith('vbscript')) {
|
||||
return '';
|
||||
}
|
||||
if (collapsed.startsWith('data') && !collapsed.startsWith('dataimage')) {
|
||||
if (collapsed.startsWith('data') && !collapsed.startsWith('dataimage/')) {
|
||||
// A data: URI whose MIME type isn't image/* -- e.g. data:text/html,
|
||||
// data:application/javascript, data:text/javascript. No legitimate
|
||||
// image source needs these; block unconditionally.
|
||||
|
||||
Reference in New Issue
Block a user