Skip to content

fix(api): refuse invalid dates and years on read endpoints - #236

Merged
skjnldsv merged 1 commit into
mainfrom
fix/validate-read-params
Nov 17, 2026
Merged

skjnldsv merged 1 commit into
mainfrom
fix/validate-read-params

Conversation

@skjnldsv

Copy link
Copy Markdown
Member

Thirteen read routes passed from, to or year through unchecked, so an invalid value reached the database. They now answer 422 with a message, using the app's existing date and year checks. The access matrix covers all 19 combinations.

👾 This pull request was assisted by Claude Code, commits carry an Assisted-by trailer.

@skjnldsv skjnldsv added 3. to review Waiting for reviews bug Something isn't working AI assisted This PR contains AI-assisted commits labels Nov 17, 2026
@skjnldsv skjnldsv self-assigned this Nov 17, 2026
The request list passed `from` and `to` to the database as they came, and
the balance, team balance, employees list, entitlement, pro rata, report
and balance export endpoints took any `year`. An invalid value reached the
queries and the date arithmetic unchecked.

The request list now checks both dates like a request's own dates, and the
year endpoints accept 2000 to 2100 only, with the check the entitlement API
already uses. Anything else is a 422 with a message.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
@skjnldsv
skjnldsv force-pushed the fix/validate-read-params branch from d426549 to d706cfc Compare November 17, 2026 15:20
@skjnldsv
skjnldsv merged commit 3e50914 into main Nov 17, 2026
48 checks passed
@skjnldsv
skjnldsv deleted the fix/validate-read-params branch November 17, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted This PR contains AI-assisted commits bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant