fix(milestones): reject attaching an issue from a different repository - #241
Merged
chonilius merged 1 commit intoAug 27, 2026
Merged
Conversation
MilestonesService.addIssue reassigned an issue's milestoneId with no check that the issue actually belongs to the milestone's own repository. Since resolveIssue splits the milestone's budget evenly across whatever's attached with no per-issue repository check either, a cross-repository issue attached via a copy-pasted ID or a client bug would silently dilute a sponsor's repository-scoped budget. Rejects with a BadRequestException naming both repository IDs when issue.repositoryId !== milestone.repositoryId. Note: the controller's POST /milestones/:id/issues/:issueId route already carries JwtAuthGuard + RolesGuard(MAINTAINER) in current code, so the auth-gap concern this issue also raised does not apply as filed. Closes MergeFi#59
|
Someone is attempting to deploy a commit to the chonilius' projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@oluwagbemigaphilip Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
What changed
MilestonesService.addIssuenow rejects attaching an issue whoserepositoryIddoesn't match the target milestone'srepositoryId, throwing aBadRequestExceptionnaming both repository IDs.Why
resolveIssuesplits a milestone's remaining budget evenly across whatever issues are currently attached, with no per-issue repository check. SinceaddIssuenever validated the issue and milestone belonged to the same repository, a cross-repository issue (copy-pasted ID, client-side picker bug, wrong UUID) could get attached and silently dilute a sponsor's repository-scoped budget toward unrelated work.Note on scope
The issue also flagged
POST /milestones/:id/issues/:issueIdas unguarded. In the current code that route already carries@UseGuards(JwtAuthGuard, RolesGuard)+@Roles(UserRole.MAINTAINER)— verified inmilestones.controller.ts. That part doesn't apply as filed, so it's not touched here.How verified
issueRepo.saveis never called.repositoryIds explicitly.npx jest milestones.service.spec.ts— 19/19 passing.npx tsc --noEmit— no new errors introduced (pre-existing unrelated errors in other files confirmed present onmainbefore this change).Batch context
closes #18
closes #26
closes #57
Closes #59