Refuse SVG sources and never save an unknown input as JPEG (closes #68) #240

Merged
clawbot merged 5 commits from issue-68-refuse-svg into next 2026-10-13 07:13:18 +02:00
5 Commits
Author SHA1 Message Date
clawbot c80e0e48b1 Say which input the image processor refuses before decoding
check / check (push) Waiting to run
README.md, the doc comment of ErrUnsupportedInputFormat and the TODO.md
entry say the 415 is for input whose first bytes libvips reads as
another format, and no longer read as refusing a damaged image in a
source format, which is decoded and answers 500. The doc comment of
TestImageProcessor_OrigOfUnnamedFormatRefused says TIFF is refused
before it is decoded.

Model: opus-5-5
2026-10-13 04:24:18 +00:00
clawbot 6241c6a425 Refuse, before decoding, input libvips would not load as a source format
check / check (push) Waiting to run
govips picks the libvips loader for the input with DetermineImageType.
The image processor now names the format from that type before decoding,
and refuses with ErrUnsupportedInputFormat, answered 415, any input it
cannot name as one of the six source formats. An SVG whose first bytes
pass the first-bytes check for AVIF therefore never reaches librsvg.
orig is the format named there. README.md and TODO.md say so.

Model: opus-5-5
2026-10-13 03:20:52 +00:00
clawbot d67b6d5051 Test that an SVG served as AVIF is refused, and that each source format loads
An SVG starting with an XML comment holding "ftypavis" passes the
first-bytes check for AVIF; resized as PNG, it is answered 200 with the
SVG rendered. The new server test asks for it through both image routes,
resized and as orig, and wants 415 for each. The new processor test
checks that an image in each of the six source formats loads and is saved
again in its own format.

Model: opus-5-5
2026-10-13 03:20:48 +00:00
clawbot 06e537c458 Refuse SVG at the fetcher and never save an unknown input as JPEG (closes #68)
check / check (push) Waiting to run
The fetcher no longer accepts image/svg+xml, so an SVG source gets the
refusal every unaccepted upstream type gets, which both image routes now
answer with 415 where they answered 500. orig of an input the processor
cannot name is ErrUnsupportedInputFormat, also answered 415, where it
was saved as JPEG. README.md drops SVG from the source formats and lists
the 415.

Model: opus-5-5
2026-10-13 02:19:41 +00:00
clawbot c5f318033d Test that an SVG source and orig of an unnamed input are refused
Failing tests, ahead of the fix: an upstream answering image/svg+xml is
answered 415 on the image route, also for orig; both image routes answer
415 for an unaccepted upstream content type and for orig of an input the
processor cannot name; and the processor refuses orig of a TIFF instead
of saving it as JPEG.

Model: opus-5-5
2026-10-13 01:51:55 +00:00