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

Aperta
#3,309 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
csharp
Ambito
backend, security

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C#
Stelle
569
Fork
107
Merge medio
2h 49m
PR unite (30g)
397

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di fluentcms/FluentCMS

Tutte le issue di fluentcms/FluentCMS

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.