Add image-gen module: Spring AI ImageModel options on the wire, a moderation gate, and safe storage of generated images in MinIO (sniffed content type, byte and pixel caps, server-chosen keys, capped URL fetcher); per-provider cost table dated 2026-10-28. ImageModel and ModerationModel are hand-written fakes; MinIO is real via Testcontainers; no image provider called.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7rnC7jppGGdHGESvy
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# ImageVerifier decisions (cap 8 MiB, 16,000,000 pixels, png/jpeg/webp)
|
||||
|
||||
input verdict detail
|
||||
real PNG 64x48 ACCEPT image/png 64x48
|
||||
real JPEG 64x48 ACCEPT image/jpeg 64x48
|
||||
WebP header only (sniffed, not decoded) ACCEPT image/webp
|
||||
SVG with a script REJECT not-an-image: no known image signature in the first bytes
|
||||
HTML page REJECT not-an-image: no known image signature in the first bytes
|
||||
PDF REJECT not-an-image: no known image signature in the first bytes
|
||||
PNG signature + garbage REJECT undecodable: IIOException
|
||||
valid PNG + 40 bytes of HTML appended ACCEPT image/png 16x16
|
||||
PNG header claiming 40000x40000 REJECT too-many-pixels: 40000x40000 = 1600000000 > cap 16000000
|
||||
GIF (sniffed but not on the allow list) REJECT type-not-allowed: image/gif
|
||||
empty REJECT not-an-image: no known image signature in the first bytes
|
||||
9 MB of PNG-looking zeros REJECT too-large: 9437184 bytes > cap 8388608
|
||||
Reference in New Issue
Block a user