SECURITY: Missing input validation on lat/lng in items API #6
Labels
No labels
blocked:needs-decision
bug
chore
in-progress
security/high
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AuWoMe/planish#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?
Description
The items API endpoints (
POST /api/trips/[tripId]/itemsandPATCH /api/items/[itemId]) acceptlatandlngparameters without server-side validation before inserting into the database. The domain layer has aGeoLocationvalue object with validation, but the API routes don't use it.The Issue
In
src/app/api/trips/[tripId]/items/route.ts(lines 71-88):The same issue exists in the PATCH endpoint at
src/app/api/items/[itemId]/route.ts(lines 60-61).Impact
Fix
Add validation before insertion:
Or reuse the existing
GeoLocation.create()/GeoLocation.isValid()from@/domain/value-objects/geo-location.Fixed in commit
a5510ba: items POST/PATCH accepted unvalidated lat/lng. Now range-checked via GeoLocation (-90..90 / -180..180), item type enum-validated, title required; also fixed day-filter off-by-one (lte -> lt).