Include quality and fit in the URL signature (closes #60) #116

Merged
clawbot merged 2 commits from issue-60-sign-quality-fit into next 2026-09-28 13:02:22 +02:00
2 Commits
Author SHA1 Message Date
sneak 10041c4986 Include quality and fit in the URL signature (closes #60)
check / check (push) Successful in 3m23s
The signed data is now
host:path:query:width:height:format:expiration:quality:fit. The route
turns a missing q into 85 and a missing fit into cover before checking
the signature, so those are the values signed for a URL without them;
imgcache fills both from the parsed request.

imgcache.Service.GenerateSignedURL now writes q and fit into the URL
next to sig and exp, first setting an unset quality or fit to 85 or
cover, so a generated URL verifies for the values it signed.

The known-answer vectors in golden_test.go, including one for quality
40 and fit contain, and the README signature section describe the new
format.

Model: opus-4-8 (implementation); opus-5-5 (rework)
2026-09-28 10:23:10 +00:00
sneak 306e075b5c Test that the URL signature covers quality and fit (closes #60)
check / check (push) Failing after 2m18s
Add Quality and FitMode to signature.Request, not yet part of the
signed data, and tests that a signature for quality 85 and fit cover is
refused when replayed with another quality or fit: one against
Signer.Verify, one through the image route. The route test also sends
the same signature with no q or fit and with q=85&fit=cover, which must
both pass, and sends URLs built by imgcache.Service.GenerateSignedURL.

The replay cases fail until the next commit.

Model: opus-4-8 (implementation); opus-5-5 (rework)
2026-09-28 10:22:53 +00:00