Fix security vulnerabilities, bugs, and performance issues across codebase - #15
Fix security vulnerabilities, bugs, and performance issues across codebase#15Mayank-saraswal with Copilot wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: Mayank-saraswal <171960902+Mayank-saraswal@users.noreply.github.com>
…ation details Co-authored-by: Mayank-saraswal <171960902+Mayank-saraswal@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 87562e390a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| parsed = requestSchema.parse(body); | ||
| } catch (err) { | ||
| const message = err instanceof z.ZodError | ||
| ? err.errors.map((e) => e.message).join(", ") |
There was a problem hiding this comment.
In this validation branch, zod is pinned to ^4.2.1 (package.json), where ZodError exposes issues rather than errors; accessing err.errors.map(...) will itself throw when a request body fails schema validation. That means malformed or out-of-range message payloads still bubble into a 500 instead of returning the intended 400 response from this handler.
Useful? React with 👍 / 👎.
Comprehensive audit identified hardcoded secrets, timing attack vectors, missing input validation, model config drift, and suboptimal resource usage.
Security
NEXT_PUBLIC_SENTRY_DSN,SENTRY_DSN) acrossinstrumentation-client.ts,sentry.server.config.ts,sentry.edge.config.tsrequire("crypto")+===withimport crypto+crypto.timingSafeEqual:JSON.parse(body)andrequest.json()now wrapped in try-catch returning 400z.string().min(1).max(100_000)to messages schemaBug Fixes
layout.tsx— still said "Create Next App"?limit=NaNpassed to Prisma —parseInt(limit)now clamped to[1, 100]with explicit NaN handlingMODEL_MULTIPLIERSwas missing entries forclaude-opus-4.6,claude-haiku-4.5,quasar-alpha,o3-minithat exist inCONVERSATION_MODELS, causing silent fallback to 1x multiplierPerformance
IBM_Plex_Monofrom 7 weights to 4 (400-700), addeddisplay: "swap"Ratelimitinstances as singletons instead of constructing per-request💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.