Fix negative indexing and ReadTimeOut errors#3474
Fix negative indexing and ReadTimeOut errors#3474OM-JADHAV25 wants to merge 10 commits intoOWASP:mainfrom
Conversation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughValidations and hard limits were added across GraphQL resolvers and queries: new constants introduced, negative/non-positive limits now return empty lists, per-request limits are clamped, some ordering and projection adjustments made, and tests updated to accommodate queryset .only(...) usage. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
|
|
Closing in favor of #3478 |



Proposed change
Resolves #3414
This PR fixes a fuzz-test failure caused by negative limit values being passed into recentMilestones, which resulted in Django raising:
Negative indexing is not supportedNow, if a negative (or zero) limit is provided, the resolver safely returns an empty list instead of slicing with a negative value.
Additional improvement
During fuzz testing, the logs also showed ReadTimeout errors when extremely large limit values were generated, causing huge responses and expensive database queries.
By clamping limits, queries remain bounded and the GraphQL API becomes more stable under fuzzing, resolving these timeout issues.
Checklist
make check-testlocally: all warnings addressed, tests passed