fix: add bounds checking for CLI array index accesses#221
Conversation
Standardize all required args[] accesses in cli/index.ts to check args.length first, then access with type assertion. This applies to cmdHealth (trend), cmdMigrate, cmdSuggest, cmdBundle, cmdCompare, cmdValidate, and cmdCdn — replacing the pattern of access-then-check with the consistent check-before-access pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ 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: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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 |
Summary
src/cli/index.ts has 12+ locations that access args[0], args[1] without bounds checking before access. Example at lines 375-376:
While TypeScript's noUncheckedIndexedAccess flag makes these return
T | undefined, the pattern is inconsistent — some locations check before access, others after. Standardize to check array length first, then access.Acceptance criteria:
Created automatically by Automaker