Fetch the source path and query URL-encoded, not joined as text (closes #288)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
The source URL was built by joining the decoded path and query as text, so a space in the query reached the upstream raw and failed with 502, 100%25.png made a URL Go could not parse and answered 401, and %20 and %2520 fetched the same path under different cache keys. The source URL is now built with net/url, so each decoded path and query is one upstream request matching its signature and cache key; the query encodes the characters a browser encodes, ' included. The generator page compares what pixa would fetch with the URL as entered, and answers 400 with the URL to use when they differ, or for a user name and password or a .. segment. Model: opus-5-5
This commit was merged in pull request #289.
This commit is contained in:
@@ -30,6 +30,19 @@ P2: security: per-origin rate limiting
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-10-16 the source URL a request fetches is built with `net/url` from the
|
||||
source host, path and query, not joined as text (closes #288). The source
|
||||
path, decoded, is fetched percent-encoded again, so `100%25.png` fetches
|
||||
`/100%25.png` where it answered 401, and `my%20cat.png` and `my%2520cat.png`
|
||||
fetch different paths where both fetched `/my%20cat.png` under two cache keys.
|
||||
The source query stays as the source URL writes it; the characters a browser
|
||||
percent-encodes in a query, such as `'` or a space, which was sent raw and
|
||||
answered 502, are percent-encoded when the image URL is read, so the query is
|
||||
signed and cached as it is sent. The generator page answers 400, showing the
|
||||
URL pixa would fetch, for a source URL its image URL would fetch written
|
||||
another way, such as with `%2F` in the path, whatever else the path holds, or
|
||||
with a user name and password. It also answers 400 for a source path holding a
|
||||
`..` segment, as `/v1/image/` refuses one.
|
||||
- 2026-10-15 a thin source requested with `fit=cover` no longer makes libvips
|
||||
build a huge image (closes #282): libvips' thumbnail scaled the whole source
|
||||
to cover the requested size and copied that into memory before it cut out the
|
||||
|
||||
Reference in New Issue
Block a user