Image size ignores EXIF orientation, and the SVG sanitizer keeps external references

Open
#3,309 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
csharp
Domain
backend, security

Research direction

Read src/plugins/FluentCMS.Plugins.Media/ImageSize.cs, MediaService.cs, SkiaImageProcessor.cs, and SvgDocument.cs, then review linked issue #3281 because it changes the same image processing. Trace how dimensions and SVG references are handled, and check the media tests. Done means EXIF-oriented dimensions are reported correctly, existing assets are backfilled, external SVG references and escaped @import are removed, and each behavior has a test.

Written by the indexing model from the issue text.

Description

plugin type:bug

Problem

  1. Stored width and height ignore EXIF orientation. The size is read from the raw header (src/plugins/FluentCMS.Plugins.Media/ImageSize.cs:65-122, used at MediaService.cs:927), while transforms swap for a turned image (SkiaImageProcessor.cs:41,99). A portrait phone JPEG reports its width and height swapped to API consumers.
  2. The SVG sanitizer keeps external references. Remote href/xlink:href, <use>, <image> and url(https://…) are kept; only javascript:, vbscript: and non-image data: are dropped (SvgDocument.cs:133-153). @import is removed by a string match (:155-159) that a CSS escape such as @\69mport passes. The CSP sandbox covers a file served by the CMS (MediaEndpoints.cs:30,165-167), not an inlined SVG or a CDN that drops the header.

Proposal

  • Take the size from IImageProcessor.IdentifyAsync; backfill existing assets with a job.
  • Allow only same-document #fragment references, strip remote url(), and match @import after unescaping.

Done together with #3281, which changes the same image processing.

Acceptance

  • An image with a turned EXIF orientation reports the size it displays at
  • Existing assets are corrected by the backfill
  • A sanitized SVG contains no reference outside the document
  • An escaped @import is removed
  • Tests for each

Found in the code review of 17 Nov 2026.

Dominant language
C#
Stars
569
Forks
107
Avg merge
2h 49m
Merged PRs (30d)
397

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fluentcms/FluentCMS

All issues in fluentcms/FluentCMS

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.