saveProfile doesn't check the event date server-side #155

Open
opened 2026-11-08 18:16:28 +00:00 by chris-kreidl · 2 comments
chris-kreidl commented 2026-11-08 18:16:28 +00:00 (Migrated from github.com)

saveProfile does not check server-side that an event date is in the future (only the form does). Add it with todayIn if it matters.

Moved from docs/PROGRESS.md → Follow-ups → Later on 2026-11-08.

`saveProfile` does not check server-side that an event date is in the future (only the form does). Add it with `todayIn` if it matters. _Moved from docs/PROGRESS.md → Follow-ups → Later on 2026-11-08._
chris-kreidl commented 2026-11-08 20:08:49 +00:00 (Migrated from github.com)

What this is about. The profile form won't accept an event date in the past, but the server function saveProfile (src/server/athlete.ts) doesn't check it again. Anyone calling the server directly could save a past event date.

Status (checked 2026-11-08): unchanged.

Fix: one check with todayIn(timeZone) in the validator, plus a test. Five minutes; worth doing the next time athlete.ts is touched (session 52, #227, changes the profile).

**What this is about.** The profile form won't accept an event date in the past, but the server function `saveProfile` (`src/server/athlete.ts`) doesn't check it again. Anyone calling the server directly could save a past event date. **Status (checked 2026-11-08):** unchanged. **Fix:** one check with `todayIn(timeZone)` in the validator, plus a test. Five minutes; worth doing the next time `athlete.ts` is touched (session 52, #227, changes the profile).
chris-kreidl commented 2026-11-19 03:21:36 +00:00 (Migrated from github.com)

Status (checked 2026-11-18): still open. Session 52 touched the profile without it. Only the form checks for a future date (src/domain/athlete-form.ts:57). The server's ProfileInput (src/domain/schemas/profile.ts, goalRule) checks only that an event has a date. A shared refinement taking today would cover both.

**Status (checked 2026-11-18):** still open. Session 52 touched the profile without it. Only the form checks for a future date (`src/domain/athlete-form.ts:57`). The server's `ProfileInput` (`src/domain/schemas/profile.ts`, `goalRule`) checks only that an event has a date. A shared refinement taking `today` would cover both.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ckreidl/trainer#155
No description provided.