Repository navigation
Enforce size limit when paged searches are enabled - #445
Merged
HarlemSquirrel merged 4 commits intoNov 18, 2026
Merged
Conversation
When paging is enabled and the requested size exceeds 126, the client now correctly stops fetching additional pages once the size limit is reached.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Entries can still exceed the documented maximum because the limit is checked only after yielding a complete page.
3 open findings
What changed in this PR
Adds client-side termination for size-limited paged LDAP searches.
Changes:
- Stops paging after reaching the requested size.
- Adds a regression test.
- Updates release history.
| File | Description |
|---|---|
lib/net/ldap/connection.rb |
Adds paging termination logic. |
test/test_ldap_connection.rb |
Tests size-limited paging. |
History.rdoc |
Documents the fix. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Later page requests send a different sizelimit from the first one, which RFC 2696 says they must not, so a server can send a full page past the caller's :size. Also moves the per-page sizelimit calculation into a helper so search stays within the project's RuboCop metrics. - Moved the per-page sizelimit calculation into search_query_limit - Stopped returning entries once :size is reached, still reading the rest of the page - Replaced the test with page-boundary and over-full last page cases
Contributor
Author
|
@HarlemSquirrel thanks for merging master in. I've pushed afd10f6, which addresses the Copilot review and the RuboCop failures from the last run |
HarlemSquirrel
enabled auto-merge (squash)
November 18, 2026 01:24
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.


Fixes the
:sizeoption being ignored when paged searches are enabled and the requested size is larger than the page size of 126.Problem
Each page request carries a sizelimit of
0(no limit) while 126 or more entries remain, and the exact remainder after that. When the results reach:sizeexactly at the end of a page, nothing remains, so the next request goes out with a sizelimit of0and the server returns everything that's left.Later page requests also send a different sizelimit from the first one, which RFC 2696 (section 3) says they must not. A server that keeps the first request's limit can return a full page past
:size, and the client returned all of it.Changes
:sizeis reached:sizeis reached, while still reading the rest of the page so the connection stays in syncsearch_query_limit, as the existing comment suggestedRelated: #437, #36