Security: No input validation on data import — importAllData blindly trusts JSON payload #6
Labels
No labels
blocked:depends-p1
blocked:gate-research
blocked:lint-failed
blocked:needs-decision
blocked:needs-human
blocked:verify-failed
bug
data-loss
documentation
enhancement
feature-request
in-progress
needs-decompose
needs-triage
pwa
quickfix
security
security/high
security/medium
test
test-coverage
triage-approved
vault
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/kimi_agent_kin_app_sync#6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
Severity: HIGH (data integrity)
Location
src/lib/db.ts:273-298—importAllData()functionDescription
importAllData()clears ALL IndexedDB tables and callsbulkAdd()on whatever data is passed with zero validation:Impact
data.peoplecontains objects missing required fields, Dexie silently stores garbageRecommendation
Add Zod schema validation before clearing any tables. Validate the full payload structure against defined schemas first, reject the import if validation fails, and surface clear error messages to the user.
Code context
src/lib/db.ts:273-298— importAllData functionsrc/lib/types.ts— TypeScript interfaces exist but are compile-time only, no runtime guardszod@^4.3.5) is already installed but unused for validationFixed in commit. Closing.