Summary
CSV import has no visible limits or validation for file size, row count, column count, header shape, duplicate/empty headers, or cell size before parsing and writing to Firestore.
Evidence
src/lib/utils/csvParser.ts:9-28 parses arbitrary CSV with Papa.parse and returns headers/rows directly.
src/app/(main)/admin/tasks/create/page.tsx:37-53 accepts the selected CSV without size/shape checks.
src/app/(main)/admin/tasks/create/page.tsx:153-159 maps all parsed rows into Firestore row payloads.
src/lib/firebase/firestore.ts:231-257 batch-writes rows to Firestore.
Impact
Large or malformed CSV files can cause browser memory issues, excessive Firestore writes/cost, documents exceeding Firestore limits, silent overwrites from duplicate headers, and corrupted task data from empty headers or unbounded cell values.
Minimal Fix
Add validation before creating any task/rows:
- maximum file size
- maximum row count
- maximum column count
- maximum header length
- maximum cell length
- reject empty headers
- reject duplicate headers
- reject or normalize invalid rows before write
Also consider enforcing schema/field limits in Firestore rules where possible.
Acceptance Criteria
- Oversized CSV files are rejected before parsing or before Firestore writes.
- CSVs with empty or duplicate headers are rejected with a clear error.
- Excessive rows/columns/cell lengths are rejected with a clear error.
- A failed CSV import leaves no partial task document or partial row data behind.
Summary
CSV import has no visible limits or validation for file size, row count, column count, header shape, duplicate/empty headers, or cell size before parsing and writing to Firestore.
Evidence
src/lib/utils/csvParser.ts:9-28parses arbitrary CSV withPapa.parseand returns headers/rows directly.src/app/(main)/admin/tasks/create/page.tsx:37-53accepts the selected CSV without size/shape checks.src/app/(main)/admin/tasks/create/page.tsx:153-159maps all parsed rows into Firestore row payloads.src/lib/firebase/firestore.ts:231-257batch-writes rows to Firestore.Impact
Large or malformed CSV files can cause browser memory issues, excessive Firestore writes/cost, documents exceeding Firestore limits, silent overwrites from duplicate headers, and corrupted task data from empty headers or unbounded cell values.
Minimal Fix
Add validation before creating any task/rows:
Also consider enforcing schema/field limits in Firestore rules where possible.
Acceptance Criteria