mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #553] [CLOSED] serve: image sources - network paths refused, URLs capped and fetched outside the FIFO, no local files for other origins' pages #2688
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2688
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/553
Author: @sergqwer
Created: 10/2/2026
Status: ❌ Closed
Base:
main← Head:pr/image-sources📝 Commits (1)
04a0cd2serve: image sources - network paths refused, URLs capped at 32 MiB and fetched outside the FIFO, no local files for other sites' pages📊 Changes
2 files changed (+210 additions, -12 deletions)
View changed files
📝
serve/server.py(+65 -12)📝
serve/test_server.py(+145 -0)📄 Description
Vision.load()takes any image source a request names:data:URL;http(s)URL, read whole with no size cap, under the global request FIFO;file://...;os.path.isfileaccepts.Three problems, all in
serve/server.py:\host\share\x.png,//host/share/...,\?\UNC\...,file://host/share/...) makes Windows open an SMB connection to that host and sign in with the user's NTLM credentials, at the firstos.path.isfile. These are now refused before anything looks at the path.file://host/...was also read as a relative path before.IMAGE_URL_MAX), and a largerContent-Lengthis refused unread.api_key(the default),/v1/messagesand/v1/chat/completionsread the body as JSON whatever its Content-Type. So any web page the user opens can send atext/plainPOST, a simple request with no CORS preflight, and have the server read a local file as an image. The page gets no answer to read unlesscors_originsallows it, but the file is read, and a UNC path leaks the hash.Originis not the server's own (nor intrusted_origins) may now send onlydata:andhttp(s)images. That is_foreign_origin(), factored out of_own_page().Origin(CLI tools, SDKs, agents) and Strata's own page work as before.Tests (
ImageSources): each network form is refused withoutisfilebeing called; the cap, with and withoutContent-Length, and a 404; the download runs with the FIFO free; a foreign-origin request is refused on both APIs while the allowed forms pass. Serve tests: 176 OK (7 skipped).🤖 Generated with Claude Code
https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.