Skip to content

FIX: Bump starlette to >=1.0.1 to address CVE-2026-48710 (BadHost)#1818

Merged
romanlutz merged 1 commit into
microsoft:mainfrom
romanlutz:romanlutz/bump-starlette-dependency
May 27, 2026
Merged

FIX: Bump starlette to >=1.0.1 to address CVE-2026-48710 (BadHost)#1818
romanlutz merged 1 commit into
microsoft:mainfrom
romanlutz:romanlutz/bump-starlette-dependency

Conversation

@romanlutz
Copy link
Copy Markdown
Contributor

Description

Starlette versions prior to 1.0.1 are vulnerable to CVE-2026-48710 (BadHost), where a single character injected into the HTTP Host header bypasses path-based authorization in Starlette (and therefore FastAPI). The X41 D-Sec advisory rates this as critical for tooling that exposes MCP servers and AI agent endpoints, which includes PyRIT's backend.

PyRIT was pulling in starlette==0.50.0 transitively through fastapi==0.128.0, which pinned starlette<0.51.0 and could not be upgraded to the patched line without also bumping FastAPI.

This PR:

  • Adds starlette>=1.0.1 as a direct dependency. The backend middleware (pyrit/backend/middleware/auth.py, request_id.py, security_headers.py) already imports starlette directly, so declaring it explicitly is also correct from a packaging standpoint and prevents accidental regressions to a vulnerable version.
  • Bumps fastapi>=0.115.0 to fastapi>=0.133.0, the first FastAPI release that drops the starlette<1.0.0 upper bound, so the resolver is free to pick the patched starlette.
  • Refreshes uv.lock, which now resolves to starlette==1.1.0 and fastapi==0.136.3.

Reviewed the Starlette 1.0 release notes for breaking changes (removal of on_startup, on_event, add_event_handler, @app.route, @app.websocket_route, @app.exception_handler, @app.middleware, and the old Jinja2Templates signature). None of those APIs are used in PyRIT; the backend only depends on BaseHTTPMiddleware, Request, Response, JSONResponse, and the ASGIApp type, which are unchanged.

Tests and Documentation

No code or doc changes are needed beyond the dependency bump. The full backend unit test suite (tests/unit/backend/, 567 tests) passes against the upgraded starlette==1.1.0 / fastapi==0.136.3. JupyText was not run because no notebooks or example code were touched.

One unrelated DeprecationWarning appears now (HTTP_422_UNPROCESSABLE_ENTITY -> HTTP_422_UNPROCESSABLE_CONTENT) from Starlette 1.0's constant rename; this is just a warning, not a failure, and is out of scope for this security fix.

Starlette versions prior to 1.0.1 are vulnerable to CVE-2026-48710
(`BadHost`): a single-character injection in the HTTP Host header
bypasses path-based authorization. The vulnerability affects FastAPI
and much of the Python AI tooling ecosystem.

PyRIT pulled in starlette 0.50.0 transitively through fastapi 0.128.0,
which pinned `starlette<0.51.0`. To pick up the patched starlette:

- Add `starlette>=1.0.1` as a direct dependency (the backend
  middleware already imports starlette directly, so declaring it is
  also correct from a packaging standpoint).
- Bump `fastapi>=0.133.0` (the first release that drops the
  `starlette<1.0.0` upper bound) so the resolver can pick a
  patched starlette.

uv lock now resolves to starlette 1.1.0 and fastapi 0.136.3. All 567
backend unit tests pass with the new versions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@romanlutz romanlutz added this pull request to the merge queue May 27, 2026
Merged via the queue into microsoft:main with commit 0c485cb May 27, 2026
48 checks passed
@romanlutz romanlutz deleted the romanlutz/bump-starlette-dependency branch May 27, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants