mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 03:29:23 +08:00
Add an off-by-default `security_guard` setting (system.json, with DEEPTUTOR_GUARD_* deployment overrides) that mounts fastapi-guard's pure-ASGI middleware in front of the routers: per-address rate limit, IP allow/deny lists, ban list and an attack-pattern scan of path, query and headers. Request bodies, WebSocket handshakes, Redis, CORS and security headers are left alone. The guard is added before the access-log and CORS middlewares so CORS stays outermost and 429/403 responses carry CORS headers. When disabled the package is never imported. When enabled without the package the backend fails at startup with an install hint. fastapi-guard ships as the optional `guard` extra (requirements/guard.txt, DEEPTUTOR_EXTRAS).
4 lines
176 B
Plaintext
4 lines
176 B
Plaintext
# Mirrors pyproject.toml `[project.optional-dependencies].guard`.
|
|
# Optional request screening; off unless system.json `security_guard` is enabled.
|
|
fastapi-guard>=8.1.1,<9.0.0
|