P1: /v1/e/ encrypted URLs bypass dimension and fit-mode validation #62
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Verified against
mainat61f42e6.HandleImageEnc(internal/handlers/imageenc.go:49-50) builds the image request straight from the decrypted payload:Unlike the
/v1/image/path, nothing between decryption and processing applies:MaxDimensionbound enforced byinternal/imgcache/urlparser.go:24,224-226ValidateFitModeThe token generator is equally lax:
HandleGenerateURL(internal/handlers/auth.go:106-108) runsstrconv.Atoionwidth,height,quality, andttland discards every error, so non-numeric input silently becomes0, and no upper bound is applied to width/height.Consequences:
/v1/image/path already guards against.imageprocessor.resize's default branch (internal/imageprocessor/imageprocessor.go:326-328) and surfaces as a 500 rather than a 400.This requires the signing key to exploit (the payload is sealed), so it is self-inflicted rather than remotely exploitable — but "the operator can trivially DoS their own daemon through the supplied web UI, and gets a 500 for a validation error" is not 1.0 behavior, and the asymmetry with
/v1/image/is exactly the kind of thing that rots.Related but filed separately: repo policy forbids silently defaulting an invalid explicit value.
strconv.Atoierrors becoming0is that defect in the handler layer.Definition of done
/v1/e/applies the same dimension bound and fit-mode validation as/v1/image/, sharing the validation code rather than duplicating it.HandleGenerateURLchecks everystrconv.Atoierror and rejects bad input with a 400 naming the offending field, instead of coercing to0. Width/height are bounds-checked at generation time too, so an unusable token cannot be minted.POST /generatewith non-numeric width returns 400 rather than generating a0-width token.make checkgreen.