Skip to content

fix : added max length guard to achievement unlock array items (issue #1404) - #1409

Closed
tmdeveloper007 wants to merge 4 commits into
Canopus-Labs:mainfrom
tmdeveloper007:fix/1404-achievement-validator-max-length
Closed

fix : added max length guard to achievement unlock array items (issue #1404)#1409
tmdeveloper007 wants to merge 4 commits into
Canopus-Labs:mainfrom
tmdeveloper007:fix/1404-achievement-validator-max-length

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Summary of What Has Been Done

Added a .max(100) guard to the unlockedAchievements array item strings in savedAchievementsSchema in backend/Input_validators/ValidateAchievement.js.

Changes Made

  • Modified backend/Input_validators/ValidateAchievement.js: Added .max(100, "Achievement ID must be at most 100 characters") to the achievement ID string
  • Added backend/tests/achievementValidator.maxLength.unit.test.js: 6 unit tests covering max-length boundary cases

Impact it Made

  • Adds defense-in-depth against malformed or malicious payloads
  • Ensures consistency even if achievement ID generation logic changes in the future
  • Minimal change with no breaking behavior for valid inputs

Closes #1404

Note: Please assign this PR to the tmdeveloper007 account.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@tmdeveloper007, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c5086756-da0b-4bea-b8c7-433a31eabdd6

📥 Commits

Reviewing files that changed from the base of the PR and between 8acb5b8 and 7aefe43.

📒 Files selected for processing (8)
  • backend/Input_validators/ValidateAchievement.js
  • backend/Input_validators/ValidateFlashcard.js
  • backend/Input_validators/ValidateQuestions.js
  • backend/Input_validators/ValidateSession.js
  • backend/tests/achievementValidator.maxLength.unit.test.js
  • backend/tests/flashcardValidator.maxLength.unit.test.js
  • backend/tests/questionValidator.maxLength.unit.test.js
  • backend/tests/sessionValidator.maxLength.unit.test.js

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the rate-limited Closed automatically: contributor rate limit reached label Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Thank you for your contribution!

To keep reviews manageable and maintain repository quality, contributors may have a maximum of 3 open Issues and 3 open Pull Requests at any given time.

Please wait until one of your existing submissions is reviewed or closed before opening additional ones.

If you believe this was closed by mistake, feel free to contact the maintainers.

@github-actions github-actions Bot closed this Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rate-limited Closed automatically: contributor rate limit reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix : add max length guard to achievement unlock array items

1 participant