-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Security Finding
Severity: CRITICAL
Location: src/pages/DocumentUpload.js:169-171
CWE: CWE-20 (Improper Input Validation)
Description
JSON responses from the LLM are parsed and used without schema validation. This could allow injection of unexpected data structures into application state.
Current Code
const jsonMatch = response.match(/\{[\s\S]*\}/);
if (jsonMatch) {
const parsed = JSON.parse(jsonMatch[0]); // No schema validation
setDocumentAnalysis(parsed);
}Recommended Fix
- Define expected schema using zod or joi
- Validate parsed JSON against schema before use
- Sanitize all string fields
- Implement allowlist of expected properties
- Add type checking for all fields
References
- Arcanum Anti-Patterns: Missing Input Validation (Priority Implement Basic User Authentication #6)
- OWASP: Injection
Found by Arcanum sec-context security review
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels