π‘οΈ Sentinel: [MEDIUM] Add input length limits to API requests#47
π‘οΈ Sentinel: [MEDIUM] Add input length limits to API requests#47n24q02m wants to merge 1 commit into
Conversation
Add strict length limits to Pydantic request models (AskRequest, DistillRequest, GraphIngestRequest) in src/tacet/serve/server.py to prevent Denial of Service (DoS) attacks caused by unbounded payloads. Co-authored-by: n24q02m <135627235+n24q02m@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
π¨ Severity: MEDIUM
π‘ Vulnerability: Unbounded input fields in Pydantic request models (
AskRequest,DistillRequest,GraphIngestRequest). Default Pydantic strings and lists allow indefinitely large payloads, posing a risk of memory exhaustion.π― Impact: Malicious actors could send extremely large strings or nested lists, causing Denial of Service (DoS) by exhausting server memory or parsing resources.
π§ Fix: Implemented length boundaries. Strings are capped at 1,000 characters using
typing.Annotated[str, Field(max_length=1000)]. List sizes are bounded at 10,000 for tuples and 1,000 for simple string elements.β Verification: Ran
uv run pytestto ensure legitimate requests are not rejected. Passed formatting (uv run ruff format .) and lint checks (uv run ruff check .).PR created automatically by Jules for task 12817441361953420958 started by @n24q02m