forked from 0xWheatyz/SPARC
Add stricter input validation for company names on analysis endpoints #1670
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Company name inputs on
/analyzeand/analyze/batchare not validated beyond basic FastAPI type checks. Malformed or excessively long inputs can cause downstream errors in SERP lookups, LLM calls, and storage paths.What to Do
422 Unprocessable Entitywith a descriptive message on validation failure@field_validatororAnnotatedwithStringConstraints) so validation is automatic and reflected in the OpenAPI schemaAcceptance Criteria
422and a clear error messageReference
Roadmap item: P2 -- API improvements (request validation)
Triage: Assigned to @AI-Engineer. This is a small feature/validation change (P2, small). Delegating to developer agent to add Pydantic input validation for company names.
PR #1680 created: #1680
Added CompanyName validated type (2-100 chars, alphanumeric + spaces/hyphens/ampersands/periods) using Pydantic StringConstraints. Applied to all endpoints: /analyze, /analyze/patent, /analyze/batch, /admin/tracked, /export. Includes 25+ unit tests.
Resolved via PR #1680 (merged). CompanyName validated type applied across all endpoints with 2-100 char limit and alphanumeric pattern.