Summary
Generic raster image policies currently allow SVG files in image-standard, image-compact, and image-logo. Those policies are used by tools such as Image Resizer, Photo Censor, Image Cropper, Image Filters, Color Picker, and Caption Generator.
The project already treats SVG as a special security surface in dedicated SVG/Markdown guards and sanitizers. Generic raster image tools should not ingest raw SVG through unsanitized object URLs unless the SVG path has an explicit sanitizer/rasterization boundary.
Why this matters
SVG is not the same risk class as PNG/JPEG/WebP/GIF/AVIF:
- SVG is XML/markup, not a pure raster image.
- SVG can contain links, embedded references, styles, metadata, and other markup-like surfaces.
- Browser behavior differs depending on whether SVG is loaded as
<img>, object URL, data URL, canvas source, or parsed text. - The site's privacy claim depends on avoiding accidental external-resource loads and avoiding ambiguous rendering boundaries.
Dedicated SVG tools already use explicit sanitization paths. Generic raster tools should either reject SVG or route it through an explicit sanitized SVG-to-raster path.
Current behavior
Relevant policy:
"image-standard": {accept: "image/*",allowedMimePrefixes: ["image/"],allowedExtensions: [".png",".jpg",".jpeg",".webp",".gif",".svg",".avif"],}Similar .svg entries exist in image-compact and image-logo.
Example path:
src/features/tools/image-resizer/browser-actions.ts- validates with
FILE_INPUT_POLICIES["image-standard"]; - creates
URL.createObjectURL(file); - loads it into an
Image() via loadImageElement(); - later renders it to canvas/worker.
There is no SVG sanitizer in this generic image path.
Expected behavior
Choose one of these approaches.
Preferred option: exclude SVG from generic raster image policies
- Remove
.svg and image/svg+xml acceptance from image-standard, image-compact, and image-logo. - Keep SVG only in the dedicated
svg policy. - Point users to SVG Optimizer / SVG to PNG / SVG converter tools for SVG workflows.
Alternative option: explicit sanitized SVG raster path
- Detect SVG uploads in generic image tools.
- Sanitize SVG using the shared sanitizer before preview/rasterization.
- Prevent external references from loading.
- Rasterize through a controlled data URL/blob path.
- Add tests proving dangerous SVG payloads are sanitized and no external references remain.
Suggested implementation plan
- Audit every consumer of:
FILE_INPUT_POLICIES["image-standard"]FILE_INPUT_POLICIES["image-compact"]FILE_INPUT_POLICIES["image-logo"]
- Remove
.svg from generic image policies unless a consumer has an explicit sanitizer/raster path. - Keep
FILE_INPUT_POLICIES.svg for SVG-specific tools. - Update upload copy so users understand SVG should use SVG tools.
- Add guard tests:
- generic raster policies do not include
.svg; - dedicated SVG policy still accepts
.svg; - image-resizer/photo-censor/cropper/filter tools do not silently accept SVG through raster policy.
- If supporting SVG in raster tools is intentionally required, add sanitizer tests with malicious SVG fixtures.
Acceptance criteria
Related code pointers
src/core/files/file-input-policy.tssrc/core/utils/image-canvas-utils.tssrc/features/tools/image-resizer/browser-actions.tssrc/core/security/sanitize.tstests/guards/html-injection-surface-guard.test.ts
Summary
Generic raster image policies currently allow SVG files in
image-standard,image-compact, andimage-logo. Those policies are used by tools such as Image Resizer, Photo Censor, Image Cropper, Image Filters, Color Picker, and Caption Generator.The project already treats SVG as a special security surface in dedicated SVG/Markdown guards and sanitizers. Generic raster image tools should not ingest raw SVG through unsanitized object URLs unless the SVG path has an explicit sanitizer/rasterization boundary.
Why this matters
SVG is not the same risk class as PNG/JPEG/WebP/GIF/AVIF:
<img>, object URL, data URL, canvas source, or parsed text.Dedicated SVG tools already use explicit sanitization paths. Generic raster tools should either reject SVG or route it through an explicit sanitized SVG-to-raster path.
Current behavior
Relevant policy:
Similar
.svgentries exist inimage-compactandimage-logo.Example path:
src/features/tools/image-resizer/browser-actions.tsFILE_INPUT_POLICIES["image-standard"];URL.createObjectURL(file);Image()vialoadImageElement();There is no SVG sanitizer in this generic image path.
Expected behavior
Choose one of these approaches.
Preferred option: exclude SVG from generic raster image policies
.svgandimage/svg+xmlacceptance fromimage-standard,image-compact, andimage-logo.svgpolicy.Alternative option: explicit sanitized SVG raster path
Suggested implementation plan
FILE_INPUT_POLICIES["image-standard"]FILE_INPUT_POLICIES["image-compact"]FILE_INPUT_POLICIES["image-logo"].svgfrom generic image policies unless a consumer has an explicit sanitizer/raster path.FILE_INPUT_POLICIES.svgfor SVG-specific tools..svg;.svg;Acceptance criteria
npm test -- --run tests/unit/file-input-policy.test.ts tests/component/bf-025-bf-031-image-file-safety.test.tsx tests/guards/html-injection-surface-guard.test.tspasses if updated.npm run check:typesandnpm run lintpass.Related code pointers
src/core/files/file-input-policy.tssrc/core/utils/image-canvas-utils.tssrc/features/tools/image-resizer/browser-actions.tssrc/core/security/sanitize.tstests/guards/html-injection-surface-guard.test.ts