Open
Conversation
9b3ecd1 to
c615c67
Compare
|
|
||
| const CHUNK_SIZE = 500; | ||
| const MAX_PARALLEL = 3; | ||
| const emailChunks = chunk(emails, CHUNK_SIZE); |
Check failure
Code scanning / CodeQL
Loop bound injection High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 10 months ago
To fix the issue, we need to validate that the emails parameter is a valid array and enforce a reasonable maximum length before using it in the loop. This can be achieved by:
- Checking if
emailsis an instance ofArray. - Ensuring that its length does not exceed a predefined maximum (e.g., 10,000).
- Throwing a
BadRequestExceptionif the validation fails.
The validation should be added at the beginning of the deleteMembers method, before any operations are performed on emails.
Suggested changeset
1
src/member/member.controller.ts
| @@ -254,2 +254,5 @@ | ||
| ) { | ||
| if (!Array.isArray(emails) || emails.length > 10000) { | ||
| throw new BadRequestException('Invalid emails array. Must be an array with a maximum of 10,000 items.'); | ||
| } | ||
| const { appId, role, memberId } = member; |
Copilot is powered by AI and may make mistakes. Always verify output.
c615c67 to
6ada238
Compare
6ada238 to
9631c6a
Compare
9631c6a to
1e6ff32
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.