Skip to content

fix(audit): return 400 for invalid from/to dates and strict-parse limit - #378

Merged
davidmckayv merged 4 commits into
CopilotKit:mainfrom
Ayush7614:fix/audit-query-validation
Sep 5, 2026
Merged

fix(audit): return 400 for invalid from/to dates and strict-parse limit#378
davidmckayv merged 4 commits into
CopilotKit:mainfrom
Ayush7614:fix/audit-query-validation

Conversation

@Ayush7614

Copy link
Copy Markdown
Contributor

?from=not-a-date fed an Invalid Date into drizzle gt/lt with no try/catch in the route, surfacing a 500. parseInt also accepted '50abc' as 50 and '3.9' as 3.

Change: auditQueryFromUrl throws AuditQueryError on unparseable from/to (route maps to 400), and strict-parses limit (digits-only, else default 50, still clamped 1-100). Valid queries behave as before.

Verified: manual checks (limit 10/50abc/3.9, valid + invalid from/to); bun test server/tests/audit.test.ts + config.test.ts 94 pass.

@davidmckayv davidmckayv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-run after format fix (prior CI failure was a stale-run race on the pre-format sha). Current head passes format:check + full CI. Substance verified by composed build/tests + deep review.

@davidmckayv
davidmckayv merged commit 667d029 into CopilotKit:main Sep 5, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants