Skip to content
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

⬆️ Update starlette to v0.40.0 [SECURITY] - autoclosed #1080

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 5, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
starlette (changelog) ==0.34.0 -> ==0.40.0 age adoption passing confidence

GitHub Vulnerability Alerts

CVE-2024-47874

Summary

Starlette treats multipart/form-data parts without a filename as 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

from starlette.applications import Starlette
from starlette.routing import Route

async def poc(request):
    async with request.form():
        pass

app = Starlette(routes=[
    Route('/', poc, methods=["POST"]),
])
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.


Release Notes

encode/starlette (starlette)

v0.40.0: Version 0.40.0

Compare Source

This release fixes a Denial of service (DoS) via multipart/form-data requests.

You can view the full security advisory:
GHSA-f96h-pmfr-66vw

Fixed

  • Add max_part_size to MultiPartParser to limit the size of parts in multipart/form-data
    requests fd038f3.

v0.39.2: Version 0.39.2

Compare Source

Fixed
  • Allow use of request.url_for when only "app" scope is available #​2672.
  • Fix internal type hints to support python-multipart==0.0.12 #​2708.

Full Changelog: encode/starlette@0.39.1...0.39.2

v0.39.1: Version 0.39.1

Compare Source

Fixed

  • Avoid regex re-compilation in responses.py and schemas.py #​2700.
  • Improve performance of get_route_path by removing regular expression usage #​2701.
  • Consider FileResponse.chunk_size when handling multiple ranges #​2703.
  • Use token_hex for generating multipart boundary strings #​2702.

Full Changelog: encode/starlette@0.39.0...0.39.1

v0.39.0: Version 0.39.0

Compare Source

Added

  • Add support for HTTP Range to FileResponse #​2697

Full Changelog: encode/starlette@0.38.6...0.39.0

v0.38.6: Version 0.38.6

Compare Source

Fixed

  • Close unclosed MemoryObjectReceiveStream in TestClient #​2693.

Full Changelog: encode/starlette@0.38.5...0.38.6

v0.38.5: Version 0.38.5

Compare Source

Fixed

  • Schedule BackgroundTasks from within BaseHTTPMiddleware #​2688.
    This behavior was removed in 0.38.3, and is now restored.

Full Changelog: encode/starlette@0.38.4...0.38.5

v0.38.4: Version 0.38.4

Compare Source

Fixed

  • Ensure accurate root_path removal in get_route_path function #​2600

Full Changelog: encode/starlette@0.38.3...0.38.4

v0.38.3: Version 0.38.3

Compare Source

Added
Fixed
  • Don't poll for disconnects in BaseHTTPMiddleware via StreamingResponse #​2620.

Full Changelog: encode/starlette@0.38.2...0.38.3

v0.38.2: Version 0.38.2

Compare Source

Fixed

  • Fix routing.get_name() not to assume all routines have __name__ #​2648

Full Changelog: encode/starlette@0.38.1...0.38.2

v0.38.1: Version 0.38.1

Compare Source

Removed
  • Revert "Add support for ASGI pathsend extension" #​2649.

Full Changelog: encode/starlette@0.38.0...0.38.1

v0.38.0: Version 0.38.0

Compare Source

Added

  • Allow use of memoryview in StreamingResponse and Response #​2576
    and #​2577.
  • Send 404 instead of 500 when filename requested is too long on StaticFiles #​2583.

Changed

  • Fail fast on invalid Jinja2Template instantiation parameters #​2568.
  • Check endpoint handler is async only once #​2536.

Fixed

  • Add proper synchronization to WebSocketTestSession #​2597.

Full Changelog: encode/starlette@0.37.2...0.38.0

v0.37.2: Version 0.37.2

Compare Source

Added
  • Add bytes to _RequestData type #​2510.
Fixed
  • Revert "Turn scope["client"] to None on TestClient (#​2377)" #​2525.
  • Remove deprecated app argument passed to httpx.Client on the TestClient #​2526.

Full Changelog: encode/starlette@0.37.1...0.37.2

v0.37.1: Version 0.37.1

Compare Source

Fixed

  • Warn instead of raise for missing env file on Config #​2485.

Full Changelog: encode/starlette@0.37.0...0.37.1

v0.37.0: Version 0.37.0

Compare Source

Added

  • Support the WebSocket Denial Response ASGI extension #​2041.

Full Changelog: encode/starlette@0.36.3...0.37.0

v0.36.3: Version 0.36.3

Compare Source

Fixed

  • Create anyio.Event on async context #​2459.

Full Changelog: encode/starlette@0.36.2...0.36.3

v0.36.2: Version 0.36.2

Compare Source

Fixed

  • Upgrade python-multipart to 0.0.7 13e5c26.
  • Avoid duplicate charset on Content-Type #​2443.

Full Changelog: encode/starlette@0.36.1...0.36.2

v0.36.1: Version 0.36.1

Compare Source

Fixed

  • Check if "extensions" in scope before checking the extension #​2438.

Full Changelog: encode/starlette@0.36.0...0.36.1

v0.36.0: Version 0.36.0

Compare Source

Added

  • Add support for ASGI pathsend extension #​2435.
  • Cancel WebSocketTestSession on close #​2427.
  • Raise WebSocketDisconnect when WebSocket.send() excepts IOError #​2425.
  • Raise FileNotFoundError when the env_file parameter on Config is not valid #​2422.

Full Changelog: encode/starlette@0.35.1...0.36.0

v0.35.1: Version 0.35.1

Compare Source

Fixed

  • Stop using the deprecated "method" parameter in FileResponse inside of StaticFiles #​2406.
  • Make typing-extensions optional again #​2409.

Full Changelog: encode/starlette@0.35.0...0.35.1

v0.35.0: Version 0.35.0

Compare Source

Added

  • Add *args to Middleware and improve its type hints #​2381.

Fixed

  • Use Iterable instead Iterator on iterate_in_threadpool #​2362.

Changes

  • Handle root_path to keep compatibility with mounted ASGI applications and WSGI #​2400.
  • Turn scope["client"] to None on TestClient #​2377.

Full Changelog: encode/starlette@0.34.0...0.35.0


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 this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot requested a review from basnijholt as a code owner December 5, 2024 19:14
@basnijholt basnijholt merged commit 43015d1 into main Dec 5, 2024
3 of 30 checks passed
@basnijholt basnijholt deleted the renovate/pypi-starlette-vulnerability branch December 5, 2024 19:20
@renovate renovate bot changed the title ⬆️ Update starlette to v0.40.0 [SECURITY] ⬆️ Update starlette to v0.40.0 [SECURITY] - autoclosed Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant