Update dependency starlette to v1 [SECURITY]#22
Conversation
|
Hold off merging because My thoughts here:
|
thepetk
left a comment
There was a problem hiding this comment.
See comment here: #22 (comment)
created label |
Agreed on your comment regarding the I can look into the grouping of the PRs this week since I am now back from PTO @thepetk |
Ideally I think I would prefer to have a status that confirms that config.env is there when a new image is added (the PR that adds the new image). But I guess this might be too complex / not so much needed. So we could consider |
I like that idea and don't think it'd be difficult to implement, I'll take a look at implementing that alongside the PR grouping :) |
11b2f32 to
11dda4e
Compare
|
I like the new grouping btw. Seems nice |
11dda4e to
d35bed0
Compare
d35bed0 to
3494e80
Compare
3494e80 to
10c69cb
Compare
10c69cb to
4e52e18
Compare
4e52e18 to
990d2a4
Compare
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
990d2a4 to
9f00339
Compare
This PR contains the following updates:
==0.37.2→==1.3.1Starlette Denial of service (DoS) via multipart/form-data
CVE-2024-47874 / GHSA-f96h-pmfr-66vw
More information
Details
Summary
Starlette treats
multipart/form-dataparts without afilenameas text form fields and buffers those in byte strings with no size limit. This allows an attacker to upload arbitrary large form fields and cause Starlette to both slow down significantly due to excessive memory allocations and copy operations, and also consume more and more memory until the server starts swapping and grinds to a halt, or the OS terminates the server process with an OOM error. Uploading multiple such requests in parallel may be enough to render a service practically unusable, even if reasonable request size limits are enforced by a reverse proxy in front of Starlette.PoC
curl http://localhost:8000 -F 'big=</dev/urandom'Impact
This Denial of service (DoS) vulnerability affects all applications built with Starlette (or FastAPI) accepting form requests.
Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Starlette Denial of service (DoS) via multipart/form-data
CVE-2024-47874 / GHSA-f96h-pmfr-66vw
More information
Details
Summary
Starlette treats
multipart/form-dataparts without afilenameas text form fields and buffers those in byte strings with no size limit. This allows an attacker to upload arbitrary large form fields and cause Starlette to both slow down significantly due to excessive memory allocations and copy operations, and also consume more and more memory until the server starts swapping and grinds to a halt, or the OS terminates the server process with an OOM error. Uploading multiple such requests in parallel may be enough to render a service practically unusable, even if reasonable request size limits are enforced by a reverse proxy in front of Starlette.PoC
curl http://localhost:8000 -F 'big=</dev/urandom'Impact
This Denial of service (DoS) vulnerability affects all applications built with Starlette (or FastAPI) accepting form requests.
Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Starlette has possible denial-of-service vector when parsing large files in multipart forms
CVE-2025-54121 / GHSA-2c2j-9gv5-cj73
More information
Details
Summary
When parsing a multi-part form with large files (greater than the default max spool size)
starlettewill block the main thread to roll the file over to disk. This blocks the event thread which means we can't accept new connections.Details
Please see this discussion for details: https://github.com/encode/starlette/discussions/2927#discussioncomment-13721403. In summary the following UploadFile code (copied from here) has a minor bug. Instead of just checking for
self._in_memorywe should also check if the additional bytes will cause a rollover.I have already created a PR which fixes the problem: https://github.com/encode/starlette/pull/2962
PoC
See the discussion here for steps on how to reproduce.
Impact
To be honest, very low and not many users will be impacted. Parsing large forms is already CPU intensive so the additional IO block doesn't slow down
starlettethat much on systems with modern HDDs/SSDs. If someone is running on tape they might see a greater impact.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:LReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Starlette has missing Host header validation that poisons request.url.path, bypassing path-based security checks
CVE-2026-48710 / GHSA-86qp-5c8j-p5mr / PYSEC-2026-161 / X41-2026-002
More information
Details
Summary
In affected versions, the HTTP
Hostrequest header was not validated before being used to reconstructrequest.url. Because the routing algorithm relies on the raw HTTP path whilerequest.urlis rebuilt from theHostheader, a malformed header could makerequest.url.pathdiffer from the path that was actually requested. Middleware and endpoints that apply security restrictions based onrequest.url(rather than the rawscopepath) could therefore be bypassed.Details
When a client requests
http://example.com/foo, it sends:Affected versions reconstructed the URL by concatenating
http://{host}{path}and re-parsing the result. TheHostvalue is only valid as auri-host [ ":" port ]per RFC 9112 §3.2, whereuri-hostfollows the restrictedhostgrammar of RFC 3986 §3.2.2. When it contains characters outside that grammar - notably/,?, or#- those characters move the path/query/fragment boundaries during re-parsing, so the parsedrequest.url.pathno longer matches the path the server actually received. For example:reconstructs to
http://example.com/abc?bar=/foo, whose parsedpathis/abc- even though routing used the real path/foo. The router still dispatches to/fooand the endpoint executes, but any middleware or code that readsrequest.url.pathsees/abc, so path-based authorization checks can be bypassed.Impact
Any application running an affected version that relies on
request.url(orrequest.url.path) for security-sensitive decisions is affected. The most common case is middleware that gates access to certain path prefixes based onrequest.url.path. Deployments fronted by a proxy or load balancer are mitigated only if that proxy rejects or normalizes the malformedHostheader before forwarding and the application does not trust attacker-controlled host headers (e.g.X-Forwarded-Host) elsewhere.Mitigation
Upgrade to a patched version, which validates the
Hostheader against the grammar of RFC 9112 §3.2 / RFC 3986 §3.2.2 when constructingrequest.urland falls back toscope["server"]for malformed values.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
BadHost: Missing Host header validation poisons request.url.path, bypassing path-based security checks
CVE-2026-48710 / GHSA-86qp-5c8j-p5mr / PYSEC-2026-161 / X41-2026-002
More information
Details
Starlette reconstructs the requested URL based on the HTTP Host request header and requested path, but does not perform any validation of the Host header value. This allows attackers to inject paths into the host part, prepending the actual path. However, routing in Starlette is based on the actual request path. This inconsistent interpretation of HTTP requests may lead to issues such as authentication bypass when the authentication depends on the reconstructed URL’s path.
Severity
Unknown
References
This data is provided by OSV and the PyPI Advisory Database (CC-BY 4.0).
Starlette: SSRF and NTLM credential theft via UNC paths in StaticFiles on Windows
CVE-2026-48818 / GHSA-wqp7-x3pw-xc5r
More information
Details
Summary
When serving static files on Windows,
StaticFilesresolves the requested path withos.path.realpath. If a UNC path (such as\\attacker.com\share) reaches the resolver,realpathcauses the process to open a connection to the remote host over SMB (port 445). This is a server-side request forgery (SSRF) that leaks the service account's NTLMv2 credentials to the attacker-controlled host, which can then be cracked offline or relayed to other hosts.Details
StaticFiles.lookup_path()joins the requested path onto the served directory and callsos.path.realpathon the result before checking containment withos.path.commonpath. On Windows, a UNC path is absolute, soos.path.joindiscards the served directory andrealpathresolves the bare UNC path, triggering the outbound SMB connection and NTLM authentication before the containment check rejects the path. The HTTP response is a benign 404, but the credential disclosure has already happened. POSIX systems are not affected.This only affects the default configuration (
follow_symlink=False), which usesos.path.realpath. Thefollow_symlink=Truebranch usesos.path.abspath, which performs no I/O.Impact
Applications running on Windows that serve files with
StaticFiles(directly, or via a framework built on Starlette such as FastAPI) in the default configuration are affected.StaticFilesis typically unauthenticated, so any client can trigger the SMB connection and leak the service account's NTLMv2 hash. A secondary impact is discovering internal hosts reachable over SMB by timing responses for valid versus invalid addresses.Mitigation
Applications not running on Windows are not affected. On Windows, serving static files through a dedicated web server (such as nginx or IIS) instead of
StaticFilesavoids the issue. Blocking outbound SMB (port 445) from the application host prevents the credential disclosure even if a UNC path is resolved.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Starlette: Arbitrary HTTP method dispatched to
HTTPEndpointattributes viagetattrCVE-2026-48817 / GHSA-x746-7m8f-x49c
More information
Details
Summary
When dispatching a request,
HTTPEndpointselects the handler by lowercasing the HTTP method and looking it up as an attribute withgetattr, without restricting the lookup to a known set of HTTP verbs.When an
HTTPEndpointsubclass is registered throughRoute(...)without an explicitmethods=argument, the route does not constrain the method and every method reaches the endpoint. If a non-standard HTTP method whose lowercased name matches an attribute on the endpoint subclass reaches the endpoint, that attribute is invoked as if it were a request handler. An attacker can use this to reach methods that were never meant to be HTTP handlers, such as internal helpers, without the authorization checks applied by the intended public handler.Details
HTTPEndpointuses the client-supplied method name to resolve an instance attribute, without validating it against the set of HTTP verbs the endpoint supports. A method such as_DO_DELETEtherefore resolves an attribute like_do_deleteand invokes it. Non-standard methods are valid RFC 9110 token methods, so an endpoint must not treat the method name as a trusted attribute selector.Impact
An application is affected when all of the following hold:
HTTPEndpointsubclass and registers it viaRoute(...)without an explicitmethods=argument.requestargument and return a response.This also affects frameworks built on Starlette, like FastAPI.
Mitigation
Register
HTTPEndpointsubclasses with an explicitmethods=argument on theRoute, listing only the HTTP verbs the endpoint supports. The route then rejects any other method with405 Method Not Allowedbefore it reaches the endpoint, so non-standard methods cannot resolve an attribute.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Starlette: Unvalidated request path concatenated into authority poisons request.url.hostname
CVE-2026-54282 / GHSA-jp82-jpqv-5vv3
More information
Details
Summary
In affected versions, the HTTP request path is not validated before being used to reconstruct
request.url. Becauserequest.urlis rebuilt by concatenating{scheme}://{host}{path}and re-parsing the result, a path that does not begin with/(for example@google.com) moves the authority boundary during re-parsing, sorequest.url.hostnameandrequest.url.netlocbecome attacker-controlled. Code that readsrequest.url.hostname(rather than theHostheader orscope) can therefore be misled into trusting an attacker-supplied host.Details
When a client requests a path that does not start with
/:affected versions reconstruct the URL as
http://localhost@google.com. Per RFC 3986 §3.2.1, the substring before@in the authority isuserinfo, so re-parsing yieldsusername = "localhost"andhostname = "google.com", with an empty path:The root cause is that the path is concatenated directly after the host without a separating
/, and without validating that it begins with one. Only theHostheader was validated when constructingrequest.url; the path was not.This requires an ASGI server that forwards a request-target lacking a leading
/intoscope["path"].Impact
Any application running an affected version that uses
request.url,request.url.netloc, orrequest.url.hostnamefor a security-sensitive decision (host-based authorization, redirect/callback base, SSRF target, cache key, audit log) may be affected, when no fronting proxy or load balancer rejects the malformed request-target first.Note that this is less exploitable than GHSA-86qp-5c8j-p5mr: there, the poison is carried in the
Hostheader, so the real path still routes to a valid endpoint whilerequest.url.pathlies. Here, the poison must be carried in the path itself, and that path (@google.com) does not match any registered route, so routing returns404and no endpoint handler runs. The exposure is limited to code that readsrequest.urlbefore routing - notably middleware - or in 404/exception handlers.Mitigation
Upgrade to a patched version, which prevents the request path from crossing into the URL authority. The request above instead yields
http://localhost/@​google.comwithrequest.url.hostname == "localhost".Severity
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Starlette: request.form() limits silently ignored for application/x-www-form-urlencoded enable DoS
CVE-2026-54283 / GHSA-82w8-qh3p-5jfq
More information
Details
Summary
request.form()acceptsmax_fieldsandmax_part_sizeto bound resource consumption while parsing form data. These limits are enforced formultipart/form-data, but silently ignored forapplication/x-www-form-urlencoded. An unauthenticated attacker can therefore send a urlencoded body with an arbitrarily large number of fields or an arbitrarily large field, even when the application configured limits it believed would apply.Details
request.form()dispatches to a different parser depending on theContent-Type. Formultipart/form-datathemax_files,max_fields, andmax_part_sizelimits are forwarded to the parser, but forapplication/x-www-form-urlencodedthe parser is constructed without them. It has nomax_fieldsormax_part_sizeparameter to receive them, and it appends every field with no count check and accumulates each field's name and value with no size check. The configured limits are therefore both unreachable and unenforced for url-encoded bodies.Because the url-encoded parser does its work synchronously between stream reads, the two attack shapes have different effects:
f0=v&f1=v&...) blocks the worker's event loop for several seconds while parsing, during which the worker serves no other request.FormData, forcing memory allocation proportional to the request body.The equivalent
multipart/form-datarequest is correctly rejected with400 Too many fields/400 Field exceeded maximum size.Impact
This Denial of service (DoS) vulnerability affects all applications built with Starlette (or FastAPI) that call
request.form()onapplication/x-www-form-urlencodedrequests. A single request with a very large number of fields blocks the event loop for several seconds, and a single request with a very large field forces unbounded memory allocation; in either case, parallel requests can render the service unusable. A reverse proxy that enforces a request body size limit reduces but does not eliminate the exposure, since a sub-10MB body is already enough to block the event loop.Mitigation
Upgrade to a patched version, which forwards
max_fieldsandmax_part_sizeto the url-encoded parser and enforces them while parsing, raising before the oversized field or excess fields are accumulated. The defaults matchmultipart/form-data(max_fields=1000,max_part_size=1MB) and can be customized viarequest.form(max_fields=..., max_part_size=...).Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Release Notes
Kludex/starlette (starlette)
v1.3.1: Version 1.3.1Compare Source
What's Changed
StarletteDeprecationWarninginstead ofDeprecationWarningby @Kludex in #3119max_fieldsandmax_part_sizeinFormParserby @Kludex in #3329FormParserlimits in parser callbacks by @Kludex in #3331Full Changelog: Kludex/starlette@1.3.0...1.3.1
v1.3.0: Version 1.3.0Compare Source
What's Changed
FileResponseby @jiyujie2006 in #3307OSErroralongsideMultiPartExceptionwhen closing temp files by @N3XT3R1337 in #3191httpx2to thefullextra by @Kludex in #3323removeprefixto strip weak ETag indicator inis_not_modifiedby @gnosyslambda in #3193request.urlfrom structured components by @Kludex in #3326New Contributors
Full Changelog: Kludex/starlette@1.2.1...1.3.0
v1.2.1: Version 1.2.1Compare Source
What's Changed
httpx2for type checking in thetestclientmodule by @leifwar in #3304New Contributors
Full Changelog: Kludex/starlette@1.2.0...1.2.1
v1.2.0: Version 1.2.0Compare Source
What's Changed
Full Changelog: Kludex/starlette@1.1.0...1.2.0
v1.1.0: Version 1.1.0Compare Source
What's Changed
"application/octet-stream"as theFileResponsemedia type fallback by @ATOM00blue in #3283HTTPEndpointby @Kludex in #3286StaticFiles.lookup_pathby @Kludex in #3287New Contributors
Full Changelog: Kludex/starlette@1.0.1...1.1.0
v1.0.1: Version 1.0.1Compare Source
What's Changed
Hostheader when constructingrequest.urlby @Kludex in #3279Full Changelog: Kludex/starlette@1.0.0...1.0.1
v1.0.0: Version 1.0.0Compare Source
Starlette 1.0 is here! 🎉
After nearly eight years since its creation, Starlette has reached its first stable release.
A special thank you to @lovelydinosaur, the creator of Starlette, Uvicorn, HTTPX and MkDocs, whose work helped to lay the foundation for the modern async Python ecosystem. 🙏
Thank you to @adriangb, @graingert, @agronholm, @florimondmanca, @aminalaee, @tiangolo, @alex-oleshkevich, @abersheeran, and @uSpike for helping make Starlette what it is today. And to all my sponsors - especially @tiangolo, @huggingface, and @elevenlabs - thank you for your support!
Thank you to all 290+ contributors who have shaped Starlette over the years! ❤️
Read more on the blog post.
Check out the full release notes at https://www.starlette.io/release-notes/#100-march-22-2026
Full Changelog: Kludex/starlette@1.0.0rc1...1.0.0
v0.52.1: Version 0.52.1Compare Source
What's Changed
typing_extensionsin older Python versions by @Kludex in #3109Full Changelog: Kludex/starlette@0.52.0...0.52.1
v0.52.0: Version 0.52.0Compare Source
In this release,
Statecan be accessed using dictionary-style syntax for improved type safety (#3036).See Accessing State for more details.
Full Changelog: Kludex/starlette@0.51.0...0.52.0
v0.51.0: Version 0.51.0Compare Source
Added
allow_private_networkinCORSMiddleware#3065.Changed
DeprecationWarningfor wsgi module #3082.New Contributors
Full Changelog: Kludex/starlette@0.50.0...0.51.0
v0.50.0: Version 0.50.0Compare Source
Removed
Full Changelog: Kludex/starlette@0.49.3...0.50.0
v0.49.3: Version 0.49.3Compare Source
Fixed
Middlewaretype #3059.Full Changelog: Kludex/starlette@0.49.2...0.49.3
v0.49.2: Version 0.49.2Compare Source
Fixed
if-modified-sinceheader ifif-none-matchis present inStaticFiles#3044.Full Changelog: Kludex/starlette@0.49.1...0.49.2
v0.49.1: Version 0.49.1Compare Source
This release fixes a security vulnerability in the parsing logic of the
Rangeheader inFileResponse.You can view the full security advisory: GHSA-7f5h-v6xp-fcq8
Fixed
Full Changelog: Kludex/starlette@0.49.0...0.49.1
v0.49.0: Version 0.49.0Compare Source
Added
encodingparameter toConfigclass #2996.Request.cookies#3029.Literaltype forWebSocketEndpointencoding values #3027.Changed
Middlewarewhen usingBaseHTTPMiddleware#2976.New Contributors
Full Changelog: Kludex/starlette@0.48.0...0.49.0
v0.48.0: Version 0.48.0Compare Source
Added
Changed
New Contributors
Full Changelog: Kludex/starlette@0.47.3...0.48.0
v0.47.3: Version 0.47.3Compare Source
Fixed
asyncio.iscoroutinefunctionfor Python 3.12 and older by @mjpieters in encode#2984New Contributors
Full Changelog: Kludex/starlette@0.47.2...0.47.3
v0.47.2Compare Source
Fixed
UploadFilecheck for future rollover #2962.New Contributors
Full Changelog: Kludex/starlette@0.47.1...0.47.2
v0.47.1: Version 0.47.1Compare Source
Fixed
SelfinTestClient.__enter__#2951Full Changelog: Kludex/starlette@0.47.0...0.47.1
v0.47.0: Version 0.47.0Compare Source
Added
pathsendextension #2671.partitionedattribute toResponse.set_cookie#2501.Changed
methodsparameter type fromlist[str]toCollection[str]#2903.import typingbyfrom typing import ...in the whole codebase #2867.Fixed
ExceptionMiddleware.http_exceptionas async to prevent thread creation #2922.New Contributors
Full Changelog: Kludex/starlette@0.46.2...0.47.0
v0.46.2: Version 0.46.2Compare Source
What's Changed
TemplateResponseby @alex-oleshkevich in encode#2909BaseHTTPMiddlewareby @ramannanda9 in encode#2911New Contributors
Full Changelog: Kludex/starlette@0.46.1...0.46.2
v0.46.1: Version 0.46.1Compare Source
Fixed
follow_symlinks=True#2896.Full Changelog: Kludex/starlette@0.46.0...0.46.1
v0.46.0: Version 0.46.0Compare Source
Added
GZipMiddleware: Make sureVaryheader is always added if a response can be compressed #2865.Fixed
GZipMiddleware: Don't compress on server sent events #2871.Changed
MultiPartParser: Renamemax_file_sizetospool_max_size#2780.Deprecated
TestClient(timeout=...)#2840.New Contributors
Full Changelog: Kludex/starlette@0.45.3...0.46.0
v0.45.3: Version 0.45.3Compare Source
Fixed
lookup_pathon commonpath comparison by @Kludex in encode#2851Full Changelog: Kludex/starlette@0.45.2...0.45.3
v0.45.2: Version 0.45.2Compare Source
Fixed
create_memory_object_streamcompatible with old anyio versions once again, and bump anyio minimum version to 3.6.2 by @graingert in #2833.Full Changelog: Kludex/starlette@0.45.1...0.45.2
v0.45.1: Version 0.45.1Compare Source
Fixed
MemoryObjectReceiveStreamupon exception inBaseHTTPMiddlewarechildren by @Kludex in encode#2813Refactor
Full Changelog: Kludex/starlette@0.45.0...0.45.1
v0.45.0: Version 0.45.0Compare Source
Removed
ExceptionMiddlewareimport proxy fromstarlette.exceptionsmodule by @Kludex in encode#2826WS_1004_NO_STATUS_RCVDandWS_1005_ABNORMAL_CLOSUREby @Kludex in encode#2827Full Changelog: Kludex/starlette@0.44.0...0.45.0
v0.44.0: Version 0.44.0Compare Source
Added
max_part_sizeparameter toRequest.form()by @iudeen in encode#2815clientparameter toTestClientby @iudeen in encode#2810New Contributors
Full Changelog: Kludex/starlette@0.43.0...0.44.0
v0.43.0: Version 0.43.0Compare Source
Removed
allow_redirectsargument fromTestClient#2808.Added
New Contributors
Full Changelog: Kludex/starlette@0.42.0...0.43.0
v0.42.0: Version 0.42.0Compare Source
Added
ClientDisconnectonStreamingResponse#2732.Fixed
Configuration
📅 Schedule: (in timezone America/Toronto)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.