fix(security): update vulnerable dependencies#97
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (14)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates numerous dependencies across the monorepo, including Hono, Vitest, and Clerk, and introduces configurable rate limits for API requests and project creation via environment variables. The test suite has been improved with a new Vitest configuration, more robust tag filtering tests, and automated database cleanup during setup. Feedback from the reviewer suggests implementing safer parsing for environment variables to prevent rate limits from defaulting to zero and optimizing test performance by batching database deletion operations.
| const configuredRateLimit = Number( | ||
| (c.env as { PROJECT_CREATION_RATE_LIMIT_MAX?: string }).PROJECT_CREATION_RATE_LIMIT_MAX, | ||
| ); | ||
| const rateLimit = Number.isFinite(configuredRateLimit) | ||
| ? configuredRateLimit | ||
| : PROJECT_CREATION_RATE_LIMIT; |
There was a problem hiding this comment.
Using Number() to parse environment variables can lead to unexpected behavior because Number("") and Number(" ") both evaluate to 0. If the environment variable is set to an empty string, the rate limit will be effectively set to zero, blocking all project creations. It is safer to validate that the parsed value is a positive finite number before using it, falling back to the default otherwise.
const rawRateLimit = (c.env as { PROJECT_CREATION_RATE_LIMIT_MAX?: string }).PROJECT_CREATION_RATE_LIMIT_MAX;
const configuredRateLimit = rawRateLimit ? Number(rawRateLimit) : NaN;
const rateLimit = Number.isFinite(configuredRateLimit) && configuredRateLimit > 0
? configuredRateLimit
: PROJECT_CREATION_RATE_LIMIT;| const configuredRateLimit = Number((c.env as { RATE_LIMIT_MAX?: string }).RATE_LIMIT_MAX); | ||
| const rateLimit = Number.isFinite(configuredRateLimit) ? configuredRateLimit : RATE_LIMIT; |
There was a problem hiding this comment.
Similar to the project creation rate limit, parsing the environment variable with Number() without checking for positive values can result in a 0 rate limit if the variable is an empty string. This would block all API traffic. Consider ensuring the limit is a positive number.
| const configuredRateLimit = Number((c.env as { RATE_LIMIT_MAX?: string }).RATE_LIMIT_MAX); | |
| const rateLimit = Number.isFinite(configuredRateLimit) ? configuredRateLimit : RATE_LIMIT; | |
| const rawRateLimit = (c.env as { RATE_LIMIT_MAX?: string }).RATE_LIMIT_MAX; | |
| const configuredRateLimit = rawRateLimit ? Number(rawRateLimit) : NaN; | |
| const rateLimit = Number.isFinite(configuredRateLimit) && configuredRateLimit > 0 ? configuredRateLimit : RATE_LIMIT; |
| for (const table of [ | ||
| "claim_verification_runs", | ||
| "claim_evidence", | ||
| "claims", | ||
| "state_leases", | ||
| "capability_tokens", | ||
| "idempotency_keys", | ||
| "state_tags", | ||
| "state_snapshots", | ||
| "state_events", | ||
| "agent_states", | ||
| "webhooks", | ||
| "conversation_tags", | ||
| "messages", | ||
| "conversations", | ||
| "api_keys", | ||
| "projects", | ||
| "organizations", | ||
| "rate_limits", | ||
| ]) { | ||
| await env.DB.prepare(`DELETE FROM ${table}`).run(); | ||
| } |
There was a problem hiding this comment.
Performing 18 separate DELETE operations in a loop results in 18 sequential roundtrips to the database during test setup. While this works for local testing, it can slow down the test suite as it grows. Consider using db.batch() (if using Drizzle) or env.DB.batch() (D1 API) to execute these deletions in a single batch operation for better performance.
Co-Authored-By: Duyet Le <me@duyet.net> Co-Authored-By: duyetbot <bot@duyet.net>
c40fd6a to
7affc22
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Summary
Verification