Skip to content

Commit e673dfe

Browse files
authored
Add TODO for better integer handling in GetPullRequestDatabaseID
1 parent 8818c0d commit e673dfe

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

pkg/cmd/agent-task/capi/sessions.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,13 @@ func (c *CAPIClient) hydrateSessionPullRequestsAndUsers(sessions []session) ([]*
412412

413413
// GetPullRequestDatabaseID retrieves the database ID and URL of a pull request given its number in a repository.
414414
func (c *CAPIClient) GetPullRequestDatabaseID(ctx context.Context, hostname string, owner string, repo string, number int) (int64, string, error) {
415+
// TODO: better int handling so we don't need to do bounds checks
416+
// to both ensure a panic is impossible and that we do not trigger
417+
// CodeQL alerts.
418+
if number <= 0 || number > math.MaxInt32 {
419+
return 0, "", fmt.Errorf("pull request number %d out of bounds", number)
420+
}
421+
415422
var resp struct {
416423
Repository struct {
417424
PullRequest struct {

0 commit comments

Comments
 (0)