# Risk map — encode/starlette

> Canonical page: https://codevetter.com/unpack/starlette/risk-map

# Risk map — encode/starlette

Scanned commit 4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423 (2026-10-01). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

These findings are source observations and explicitly labeled hypotheses, not confirmed vulnerabilities. Material boundaries include optional body limits, client-readable signed sessions, filesystem serving, diagnostic output, and telemetry export. Middleware task boundaries and response-start state create compatibility-sensitive behavior. Existing tests cover several of these boundaries, but they were not executed during this inspection.
- Total request-body size is unlimited by default, Request.body buffers all chunks, and multipart max_part_size applies to non-file parts; spool_max_size is a disk-rollover threshold rather than a file-size cap. Nested limit responders replace the active limit rather than always choosing the minimum. — [starlette/applications.py#L49-L58](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/applications.py#L49-L58) [starlette/requests.py#L254-L260](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/requests.py#L254-L260) [starlette/formparsers.py#L149-L191](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/formparsers.py#L149-L191) [starlette/middleware/body_limit.py#L71-L80](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/body_limit.py#L71-L80)
- Session payloads are base64 JSON protected by TimestampSigner, without encryption in this path; HttpOnly and SameSite=lax are defaults, while Secure requires https_only=True. — [starlette/middleware/sessions.py#L16-L40](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/sessions.py#L16-L40) [starlette/middleware/sessions.py#L50-L78](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/sessions.py#L50-L78)
- Hypothesis: mutating a nested dictionary or list in request.session without assigning through Session can leave modified false and omit Set-Cookie, because tracking covers top-level dict operations rather than recursively wrapped values; the inspected tests do not settle this nested-mutation behavior. (inferred) — [starlette/middleware/sessions.py#L65-L79](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/sessions.py#L65-L79) [starlette/middleware/sessions.py#L94-L137](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/sessions.py#L94-L137) [tests/middleware/test_session.py#L292-L329](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/tests/middleware/test_session.py#L292-L329)
- StaticFiles rejects absolute paths and checks resolved containment by default, but follow_symlink=True uses lexical absolute paths; FileResponse separately accepts application-supplied filesystem paths without applying StaticFiles directory containment. — [starlette/staticfiles.py#L160-L179](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/staticfiles.py#L160-L179) [starlette/responses.py#L303-L321](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/responses.py#L303-L321) [starlette/responses.py#L351-L360](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/responses.py#L351-L360)
- debug=True sends exception tracebacks to clients, choosing HTML from the Accept header or plain text otherwise; ServerErrorMiddleware still re-raises after generating its response. — [starlette/applications.py#L35-L36](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/applications.py#L35-L36) [starlette/middleware/errors.py#L163-L186](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/errors.py#L163-L186) [starlette/middleware/errors.py#L246-L256](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/errors.py#L246-L256)
- Experimental OpenTelemetryMiddleware records query strings, client addresses, and user agents on spans and extracts incoming trace context; its API and emitted telemetry explicitly may change in minor releases without deprecation. — [starlette/middleware/opentelemetry.py#L18-L30](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/opentelemetry.py#L18-L30) [starlette/middleware/opentelemetry.py#L64-L95](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/opentelemetry.py#L64-L95)
- BaseHTTPMiddleware introduces task-group and receive-cache boundaries; the suite explicitly marks backward context-variable propagation as xfail, and consumed streams are forwarded downstream as an empty body rather than replayed. — [starlette/middleware/base.py#L20-L25](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/base.py#L20-L25) [starlette/middleware/base.py#L61-L93](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/base.py#L61-L93) [starlette/middleware/base.py#L112-L153](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/base.py#L112-L153) [tests/middleware/test_base.py#L229-L251](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/tests/middleware/test_base.py#L229-L251)
- BackgroundTasks stop on the first exception after response delivery, when exception handlers cannot replace started responses; the deprecated WSGI adapter also buffers the whole request and uses an unbounded memory stream, making these distinct compatibility and resource-review hotspots. — [starlette/background.py#L34-L36](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/background.py#L34-L36) [starlette/_exception_handler.py#L55-L63](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/_exception_handler.py#L55-L63) [tests/test_background.py#L68-L89](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/tests/test_background.py#L68-L89) [starlette/middleware/wsgi.py#L18-L23](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/wsgi.py#L18-L23) [starlette/middleware/wsgi.py#L92-L108](https://github.com/encode/starlette/blob/4e7fc04e5f2c69f60e418ff2107d0f6d9a0fe423/starlette/middleware/wsgi.py#L92-L108)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
