Skip to content

fix(deps): bump fastapi and starlette for upload DoS advisories - #646

Merged
madara88645 merged 1 commit into
mainfrom
fix/bump-fastapi-starlette-security
Oct 21, 2026
Merged

madara88645 merged 1 commit into
mainfrom
fix/bump-fastapi-starlette-security

Conversation

@madara88645

Copy link
Copy Markdown
Owner

What / why

starlette==0.36.3 is affected by several published advisories. Two are High, and both are reachable through /api/upload-project:

This PR bumps:

  • fastapi 0.109.2 → 0.141.1
  • starlette 0.36.3 → 1.7.0

Starlette 1.7.0 fixes every advisory currently listed for the package: GHSA-f96h-pmfr-66vw, GHSA-82w8-qh3p-5jfq, GHSA-2c2j-9gv5-cj73, GHSA-7f5h-v6xp-fcq8, GHSA-86qp-5c8j-p5mr, GHSA-wqp7-x3pw-xc5r, GHSA-x746-7m8f-x49c and GHSA-jp82-jpqv-5vv3.

Why these exact versions:

  • FastAPI 0.141.1 (2026-07-29) is the last release before native OpenTelemetry arrived in 0.142, which added an opentelemetry-api dependency. It also predates the burst of 30+ releases that began on 2026-10-18. It allows starlette>=0.46.0.
  • Starlette 1.7.0 (2026-09-23) is the newest release that still supports Python 3.10. 1.8.0 and later need 3.11+. No advisory affects 1.7.0.

The PR also adds a post-deploy health check to .github/workflows/fly.yml. After flyctl deploy, it curls https://vibegraph-api.fly.dev/api/health with up to 6 retries, 10 s apart and 15 s per attempt, which allows for a cold start and gives about 165 s worst case. The job fails if the public URL doesn't answer 200.

No application code changes.

How verified

Local Python 3.12 venv with the new pins, the same Python as CI and Dockerfile.fly:

  • python -m pytest tests/: 650 passed.
  • CI's mypy command: no issues.
  • uvicorn app:app smoke test: /api/health returns 200, a small /api/upload-project returns 200 with a graph, and the security headers and X-Request-ID are present.

An independent side-by-side review compared the old and new stacks (same app, same other deps). These are identical:

  • 422 validation payloads, the 500 handler output, and the 413/400 upload errors
  • StaticFiles behaviour, CORS allow/deny, and the slowapi 429 body
  • the upload background cleanup
  • the graph JSON for a real 116-file Python/JS upload

uv pip compile also resolves cleanly for linux x86_64 / Python 3.12.

Behaviour changes to know about

  • Form limits are now enforced. This is the advisory fix. Non-file multipart fields over 1 MB, or urlencoded bodies with more than 1000 fields, now return 400. The frontend sends only file parts, so users are not affected.
  • JSON requests need Content-Type: application/json (FastAPI 0.132). All in-repo clients already send it. External scripts or curl calls without the header now get 422.
  • /api/chat/stream is no longer gzip-compressed (Starlette 0.46). teacher.stream_chat currently yields the whole answer as a single event, so users won't notice a difference.

Deploy

Merging deploys to production: requirements.txt and fly.yml are both in the Fly workflow's paths filter. After the deploy, check:

  1. The new "Check health after deploy" step passes.
  2. A folder upload and a chat message work on vibegraph.dev.
  3. The Fly logs show no new tracebacks.

To roll back, revert this commit.

Out of scope / follow-ups

  • Folder uploads are capped at 1000 files by Starlette's default max_files (FastAPI calls request.form() with no arguments). This contradicts MAX_UPLOAD_FILES = 10000 in app/routers/upload.py. The cap is the same before and after this bump. fix(upload): skip .git, node_modules and secret files before folder upload #644 reduces how often it is hit by not sending .git/node_modules.
  • The Fly deploy is still not gated on CI.
  • setup-flyctl@master is unpinned.
  • Starlette 1.8 / 1.9 hardening can follow later. Those releases need Python 3.11+.

🤖 Generated with Claude Code

Starlette 0.36.3 is affected by several advisories, including
GHSA-f96h-pmfr-66vw (High, multipart/form-data DoS), which applies
directly to /api/upload-project, and GHSA-82w8-qh3p-5jfq (High,
request.form() limits ignored). Starlette 1.7.0 fixes every advisory
currently listed for the package.

FastAPI 0.141.1 is the last release before the OpenTelemetry work and
the burst of releases that started on 2026-10-18; it allows
starlette>=0.46.0.

Also add a post-deploy health check to the Fly workflow so a deploy
that boots a broken app fails the job instead of passing silently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
vibegraph Ready Ready Preview Oct 21, 2026 12:14pm UTC

@madara88645
madara88645 marked this pull request as ready for review October 21, 2026 16:24
@madara88645
madara88645 merged commit 787ce31 into main Oct 21, 2026
8 checks passed

This branch was successfully deployed

1 active deployment
Preview — 5426be00 Deployed Oct 21, 2026 by vercel[bot]
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.

1 participant