Harden PostReview against unbounded diff size #92
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Identified during review of PR #90 (Gitea adapter phase 2). Both the security-review-bot and self-review flagged this.
Problem
In
gitea/adapter.go,PostReviewcallsGetPullRequestDiffwithout any size guard when translating comment positions. For very large PRs, this fetches the full diff into memory unconditionally, which could cause elevated memory/CPU usage (potential DoS vector).Suggested Approach
Content-Lengthchecking before reading the bodyAcceptance Criteria
PostReviewrespects a maximum diff size