Skip to content

Bound PageSize in ListUnadoptedRepositories#36884

Merged
lunny merged 2 commits intogo-gitea:mainfrom
silverwind:adopt-pagesize-fix
Mar 13, 2026
Merged

Bound PageSize in ListUnadoptedRepositories#36884
lunny merged 2 commits intogo-gitea:mainfrom
silverwind:adopt-pagesize-fix

Conversation

@silverwind
Copy link
Copy Markdown
Member

@silverwind silverwind commented Mar 10, 2026

Add SetDefaultValues() call to ensure PageSize is bounded, preventing potential excessive memory allocation from unbounded pagination parameters.

Fixes CodeQL alert #188. All other 49 open alerts were false-positives and are dismissed with appropriate comments.

Add SetDefaultValues() call to ensure PageSize is bounded,
preventing potential excessive memory allocation from unbounded
pagination parameters.

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 10, 2026
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Mar 10, 2026
@silverwind silverwind requested a review from Copilot March 10, 2026 19:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens ListUnadoptedRepositories against unbounded pagination input by applying db.ListOptions defaulting/bounding before using PageSize for slice capacity calculations, addressing a CodeQL alert about potential excessive memory allocation.

Changes:

  • Call opts.SetDefaultValues() at the start of ListUnadoptedRepositories to clamp PageSize and normalize Page.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@silverwind silverwind changed the title Bound PageSize in ListUnadoptedRepositories Bound PageSize in ListUnadoptedRepositories Mar 10, 2026
@silverwind silverwind added the topic/security Something leaks user information or is otherwise vulnerable. Should be fixed! label Mar 11, 2026
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Mar 12, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 13, 2026
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 13, 2026
@lunny lunny enabled auto-merge (squash) March 13, 2026 00:53
@lunny lunny merged commit 2601f50 into go-gitea:main Mar 13, 2026
26 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Mar 13, 2026
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 13, 2026
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 13, 2026
* giteaofficial/main:
  Bound PageSize in `ListUnadoptedRepositories` (go-gitea#36884)
  Fix timeline event layout overflow with long content (go-gitea#36595)
  [skip ci] Updated translations via Crowdin
  Replace index with id in actions routes (go-gitea#36842)
  Enable eslint concurrency (go-gitea#36878)
@silverwind silverwind deleted the adopt-pagesize-fix branch March 13, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code topic/security Something leaks user information or is otherwise vulnerable. Should be fixed!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants