-
Notifications
You must be signed in to change notification settings - Fork 5
Update dependency starlette to v0.49.1 [SECURITY] #341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the
Comment |
4c4dc05 to
c59bc3b
Compare
2a68aff to
8fe7529
Compare
c48eef3 to
3d8811c
Compare
29deefc to
0e1d020
Compare
|
There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions. |
70bfebe to
b35d0fc
Compare
a39abc8 to
e3f059f
Compare
825033c to
f5056cc
Compare
c2ed433 to
071fdfa
Compare
071fdfa to
039af89
Compare
This PR contains the following updates:
^0.47.2→^0.49.0==0.41.3→==0.49.1GitHub Vulnerability Alerts
CVE-2025-62727
Summary
An unauthenticated attacker can send a crafted HTTP Range header that triggers quadratic-time processing in Starlette's
FileResponseRange parsing/merging logic. This enables CPU exhaustion per request, causing denial‑of‑service for endpoints serving files (e.g.,StaticFilesor any use ofFileResponse).Details
Starlette parses multi-range requests in
FileResponse._parse_range_header(), then merges ranges using an O(n^2) algorithm.The parsing loop of
FileResponse._parse_range_header()uses the regular expression which vulnerable to denial of service for its O(n^2) complexity. A craftedRangeheader can maximize its complexity.The merge loop processes each input range by scanning the entire result list, yielding quadratic behavior with many disjoint ranges. A crafted Range header with many small, non-overlapping ranges (or specially shaped numeric substrings) maximizes comparisons.
This affects any Starlette application that uses:
starlette.staticfiles.StaticFiles(internally returnsFileResponse) —starlette/staticfiles.py:178starlette.responses.FileResponseresponsesPoC
Impact
Any Starlette app serving files via FileResponse or StaticFiles; frameworks built on Starlette (e.g., FastAPI) are indirectly impacted when using file-serving endpoints. Unauthenticated remote attackers can exploit this via a single HTTP request with a crafted Range header.
CVE-2025-54121
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.Release Notes
Kludex/starlette (starlette)
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
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.