Packages

FastAPI 0.165.0: Quadratic DoS Fix, Form Limits, and Python 3.11+ Migration Guide

Technical breakdown of FastAPI 0.162 through 0.165.0 (MIT, Python 3.11-3.15): patches AIKIDO-2026-463717 quadratic parameter-scanning DoS (0.163.2+), adds request body and form parsing limits (HTTP 413/400), Depends(max_concurrency=...), and drops Python 3.10.

By 0xScorPionSon

8 min read

FastAPI 0.165.0: Quadratic DoS Fix, Form Limits, and Python 3.11+ Migration Guide

FastAPI 0.165.0 quadratic DoS fix and body/form limits architecture infographic

Executive Summary

FastAPI (fastapi on PyPI, MIT license), Python's flagship type-hinted ASGI web and AI API framework built on Starlette and Pydantic, shipped a rapid series of architectural and security releases culminating in 0.165.0 on November 18, 2026 (verified as of December 3, 2026). Across 0.162.0 through 0.165.0, the framework moved to Python 3.11–3.15 (dropping Python 3.10), added Depends(max_concurrency=...) for dependency-level concurrency throttling, introduced request body size limits (0.164.0) and configurable form parsing limits (0.165.0), and patched a High-severity quadratic CPU DoS vulnerability (AIKIDO-2026-463717, affecting 0.115.0–0.163.1, fixed in 0.163.2).

Because FastAPI serves as the API layer for high-throughput AI inference services, RAG backends, and microservice gateways—such as multi-GPU retrieval pipelines handling ~19 queries/sec at 64–128 concurrent requests (arXiv:2611.21003)—upgrading to 0.165.0 closes an event-loop starvation vector while giving teams native HTTP 413 and HTTP 400 payload guardrails.

Confidence Assessment: High for GitHub release tags (0.162.0–0.165.0), Arch Linux package metadata (0.165.0-1, 325.7 KB / 2.5 MB installed), Aikido advisory AIKIDO-2026-463717, and skakarh.com's November 2026 release breakdown. Medium for exact trailing 30-day PyPI download totals for fastapi, as PyPI's public snippet omits the raw monthly counter.


Adoption Telemetry & Version Changelog

PyPI, Distro & Dependency Telemetry (Verified December 3, 2026)

Metric Verified Value Source & Verification Date
Package & Ecosystem fastapi (PyPI, conda-forge, Arch Linux, Debian Sid, MIT) PyPI / Arch Linux (Dec 3, 2026)
Latest Release 0.165.0 (Signed GPG release 05e6df7, Nov 18, 2026) GitHub Releases
Python Compatibility Python 3.11 – 3.15 (3.10 dropped in 0.162.6 on Nov 13, 2026) skakarh.com
Package Footprint 325.7 KB compressed · 2.5 MB installed (python-fastapi 0.165.0-1) Arch Linux
Core & Runtime Deps starlette, pydantic (2.14+), anyio >= 4.1.0, opentelemetry-api, fastar (0.12.0), httpx2 / httpx conda-forge / FastAPI Release Notes

Recent Release Timeline (0.162.0 – 0.165.0)

According to GitHub Releases and FastAPI 2026 Release Notes:

  1. 0.162.0 – 0.162.7 (Oct 23 – Nov 13, 2026): Restored standard Pydantic default handling for omitted bool / bool | None form fields (0.162.0), added Python 3.15 support and locked Pydantic 2.14 (0.162.3), required AnyIO >= 4.1.0 (0.162.4), and dropped Python 3.10 (0.162.6). Also bumped fastar to 0.12.0 and made opentelemetry-api a runtime dependency (OpenEmbedded patch).
  2. 0.163.0 – 0.163.2 (Nov 14 – Nov 17, 2026): Added Depends(max_concurrency=...) (0.163.0), fixed OpenAPI schema generation for response models with nested computed fields (0.163.1), and shipped the quadratic parameter-scanning DoS fix (0.163.2).
  3. 0.164.0 & 0.165.0 (Nov 18, 2026): Shipped request body size limits (HTTP 413 on 0.164.0) followed immediately by configurable form parsing limits (PR #16784, HTTP 400 on 0.165.0) plus an official coding-agent skill installable via uvx library-skills.

Security Patches, Breaking Changes & Internals

AIKIDO-2026-463717: Quadratic Parameter-Scanning DoS (Fixed in 0.163.2)

On November 24, 2026, Aikido Intel published advisory AIKIDO-2026-463717 (Aikido Score 75, High Denial of Service) affecting fastapi 0.115.0 through 0.163.1:

  • Root Cause: FastAPI repeatedly scanned incoming request parameters while extracting unused query, header, and form fields. Requests packed with many parameters triggered quadratic $O(n^2)$ CPU work directly on the ASGI worker's event loop, stalling unrelated concurrent API requests.
  • Who Is Exposed: Any service on 0.115.0–0.163.1 exposing endpoints that extract Query or Header parameters (including Pydantic query/header parameter models) or accept Form() / File() payloads.
  • The Fix (0.163.2+): FastAPI refactored parameter extraction to group parameter values in a single linear traversal, eliminating quadratic rescanning even when a small request body stays well under reverse-proxy byte caps.

Breaking Changes: Python 3.10 Drop, Boolean Forms & HTTP 413/400 Limits

Teams upgrading from earlier 2026 releases (0.141.x–0.161.x) should audit four behavioral changes before deploying 0.165.0:

  1. Python >= 3.11 Required (0.162.6+): Python 3.10 is no longer supported. Container base images must run Python 3.11 through 3.15 alongside anyio >= 4.1.0.
  2. Omitted Boolean Form Fields (0.162.0+): FastAPI no longer infers False when a bool or bool | None form field is omitted; it now applies the field's declared default or returns a missing-field validation error, matching standard Pydantic behavior.
  3. Configurable Body & Form Limits (0.164.0–0.165.0): Oversized request bodies now trigger HTTP 413, while exceeding configured form field or file limits returns HTTP 400. Limits can be scoped at the FastAPI app, APIRouter, include_router(), or individual path-operation level.
  4. Depends(max_concurrency=...) (0.163.0+): Lets you cap concurrent holders of an expensive dependency (such as a database session or local GPU inference lock) so excess callers wait asynchronously without blocking worker threads.

Parameter Model Changes (0.156.0 – 0.161.1) & Header Hardening

Teams jumping straight from 0.141.x or 0.151.x to 0.165.0 also inherit several parameter-handling shifts documented across skakarh.com and FastAPI's official release notes:

  • Field() Metadata Preserved (0.156.0): Pydantic Field() attributes and metadata are now retained on request parameter models rather than dropped during OpenAPI generation.
  • Combined Parameter Models (0.157.0) & extra Config (0.160.0): Routes can combine query, header, and cookie parameter models cleanly, and since 0.160.0, each parameter model's extra configuration (forbid, ignore, allow) applies to its sibling fields.
  • Underscore Header Rejection (0.136.3+): When convert_underscores=True (the default), FastAPI rejects raw underscore headers to prevent header-smuggling ambiguity across reverse proxies.

Scoped Form Limits & Official uvx library-skills Support

In 0.165.0, form parsing limits are not limited to a single global setting: you can configure them at the FastAPI app, APIRouter, include_router(), or individual path-operation level—letting public upload routes enforce tight field caps while internal admin routes allow larger multipart forms. Notably, FastAPI 0.164.0 and 0.165.0 also bundle an official coding-agent skill (uvx library-skills) so AI assistants like Claude Code and Cursor generate 0.165-accurate Depends(max_concurrency=...) and limit configurations instead of deprecated 0.11x idioms.

Updated Usage Example (0.165.0 Concurrency & Form Guardrails)

from typing import Annotated
from fastapi import Depends, FastAPI, Form

app = FastAPI()

async def get_inference_slot():
    # Release slot when request finishes
    yield "slot_acquired"

@app.post("/v1/analyze")
async def analyze_payload(
    prompt: Annotated[str, Form()],
    _slot: Annotated[str, Depends(get_inference_slot, max_concurrency=5)],
):
    return {"status": "queued", "prompt_len": len(prompt)}

For TestClient suites, note that FastAPI now supports httpx2 (or httpx) as an optional test dependency (PR #16512 moved httpx2 to optional dependencies while resolving deprecation warnings).


Ecosystem Comparison & Upgrade Checklist

Python API & Async Framework Comparison (Verified December 2026)

Framework Latest Verified Version Python Floor & License Key Security & Concurrency Highlights
fastapi 0.165.0 (Nov 18, 2026) Python 3.11–3.15 · MIT Patches AIKIDO-2026-463717 (0.163.2+), Depends(max_concurrency=...), HTTP 413/400 limits
aiohttp 3.14.5 (Oct 10, 2026) Python 3.10–3.15t · Apache-2.0 Patches CVE-2026-128126 (3.14.4+), full client+server stack, cp315t free-threading wheels
litestar / flask Varies by branch Python 3.9+ / 3.10+ Litestar offers built-in DI/DTOs; Flask requires sync WSGI or ASGI wrappers and manual schema validation

Production Context & fastapi[standard] Runtime Stack

On PyPI, FastAPI highlights production deployments across Microsoft (ML services), Uber (Ludwig prediction REST server), Netflix (Dispatch crisis orchestration), and Cisco (Virtual TAC Engineer). Installing fastapi[standard] pulls in uvicorn[standard] (with uvloop), python-multipart (required for request.form() and Form()/File() endpoints), jinja2, and fastapi-cli, while Typer serves as FastAPI's companion CLI framework.

Distro & Embedded Packaging (Arch, Debian, OpenEmbedded)

Downstream OS and embedded distributions are actively tracking the 0.162–0.165 jump:

  • Rolling & Unstable Distros: Arch Linux shipped python-fastapi 0.165.0-1 (325.7 KB package, 2.5 MB installed) on November 21, 2026, while Debian Sid and NetBSD pkgsrc carry 0.162.4 alongside py-httpx2.
  • Embedded Linux (OpenEmbedded): An October 31, 2026 Yocto/OpenEmbedded patch upgrading python3-fastapi from 0.141.1 to 0.162.0 notes that opentelemetry-api is now a runtime dependency and opentelemetry-sdk is required for ptest suites (with logfire-dependent telemetry tests skipped).

Safe Upgrade & Pinning Checklist

  1. Check Python Runtime Before Bumping: Ensure all Dockerfiles and CI runners use Python 3.11 or newer (3.11–3.15), as fastapi >= 0.162.6 drops Python 3.10.
  2. Pin Exact 0.165.0 in pyproject.toml: Because FastAPI ships breaking parsing and limit changes in 0.x minor releases, pin an exact version in CI:
    uv add "fastapi[standard]==0.165.0" "anyio>=4.1.0"
    
  3. Add Negative QA Tests for HTTP 413 & 400: As recommended in skakarh.com's tester guide, add automated tests posting one form field or file over your configured limit to verify HTTP 400 and oversized bodies to verify HTTP 413.
  4. Audit bool Form Endpoints, Observability & Agent Skills: Test any legacy HTML/form endpoints expecting omitted checkboxes to coerce to False, verify opentelemetry-api compatibility in minimal container builds, and run uvx library-skills if your team uses AI coding assistants on the repo.

Frequently Asked Questions

1. Which FastAPI versions are affected by AIKIDO-2026-463717?

Versions 0.115.0 through 0.163.1 are affected by the quadratic parameter-scanning CPU DoS flaw, impacting routes that extract Query or Header parameters (including Pydantic models) or accept Form()/File() data. Upgrading to 0.163.2 or 0.165.0 resolves it by grouping parameter values in a single traversal.

2. Does FastAPI 0.165.0 still support Python 3.10?

No. FastAPI dropped Python 3.10 support in 0.162.6 (November 13, 2026). Current releases require Python 3.11 through 3.15.

3. How does Depends(max_concurrency=...) work in FastAPI 0.163+?

Added in 0.163.0, Depends(dep, max_concurrency=5) caps how many concurrent requests can hold that dependency (such as a database session) at once; additional requests wait asynchronously without blocking a worker thread.

4. What HTTP status codes do the new FastAPI 0.164/0.165 limits return?

Oversized request bodies introduced in 0.164.0 return HTTP 413, while exceeding configurable form field or file limits introduced in 0.165.0 returns HTTP 400, configurable per app, APIRouter, include_router(), or individual route.

5. Why did opentelemetry-api appear in recent FastAPI dependency lists?

Recent 0.162.x builds added opentelemetry-api as a runtime dependency alongside anyio >= 4.1.0, starlette / fastar, and pydantic (2.14+), while httpx2 moved to optional dependencies (PR #16512).


Sources

  1. GitHub (fastapi/fastapi) — Releases: 0.162.3 through 0.165.0 (https://github.com/fastapi/fastapi/releases) — Released Nov 18, 2026 (05e6df7).
  2. Aikido Intel — AIKIDO-2026-463717: FastAPI 0.115.0–0.163.1 High DoS Vulnerability (https://intel.aikido.dev/cve/AIKIDO-2026-463717) — Published Nov 24, 2026.
  3. skakarh.com — FastAPI Release Notes 2026: Every Version Explained (0.137–0.165) (https://www.skakarh.com/blog/fastapi-release-notes) — Published Nov 23, 2026 (updated Nov 27, 2026).
  4. Arch Linux Packages — python-fastapi 0.165.0-1 Package Metadata (https://archlinux.org/packages/extra/any/python-fastapi/) — Updated Nov 21, 2026.
  5. PyPI (fastapi) & FastAPI Official Release Notes — FastAPI Documentation & Release Notes (https://pypi.org/project/fastapi/ and https://fastapi.tiangolo.com/release-notes/) — Updated Nov 18, 2026.
  6. prefix.dev / conda-forge — fastapi v0.162.4 Dependency Graph (https://prefix.dev/channels/conda-forge/packages/fastapi) — Synced Nov 12, 2026.
  7. OpenEmbedded / Yocto Patchwork — python3-fastapi: Upgrade 0.141.1 -> 0.162.0 (https://patchwork.yoctoproject.org/project/oe/patch/20261031035748.2130261-6-khem.raj@oss.qualcomm.com/) — Posted Oct 31, 2026.
  8. arXiv (2611.21003v1) — K2-Horizon FastAPI 8-GPU Retrieval Benchmark (https://arxiv.org/html/2611.21003v1) — Published Nov 16, 2026.

More on Packages

Tell us what is not working

A thirty-minute call, no deck and no obligation. You will leave with a straight answer about whether this is worth building - including if that answer is no.

Start a project

Direct line

hello@codebumble.net
Dhaka, Bangladesh  :   local timeCalls in English or Bangla