From a72578c1e842488be6f2feaa843ffa71f17d2b4e Mon Sep 17 00:00:00 2001 From: mohityadav8 Date: Sat, 28 Nov 2026 16:08:01 +0530 Subject: [PATCH] Reject bool values in pagination limits _page_limits accepted True/False as page_size, max_pages, or max_items since bool is an int subclass in Python, silently treating them as 1/0 instead of raising. _export_page_limit already guards against this; bring _page_limits in line with it. Verified: _page_limits(True, 10, 100) raised nothing before the fix, raises ValueError after. Same 3 pre-existing test failures (openapi-python-client metadata, Windows socket timing flakes) reproduce identically on main, confirming this change introduces no regressions. --- proofline/client.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/proofline/client.py b/proofline/client.py index 1d8c1519..b9f3d364 100644 --- a/proofline/client.py +++ b/proofline/client.py @@ -147,7 +147,15 @@ def _review_url(base_url: str, organization_id: UUID, review_id: UUID) -> str: def _page_limits(page_size: int, max_pages: int, max_items: int) -> None: - if not 1 <= page_size <= 100 or not 1 <= max_pages <= 1_000 or not 1 <= max_items <= 100_000: + if ( + any( + isinstance(value, bool) or not isinstance(value, int) + for value in (page_size, max_pages, max_items) + ) + or not 1 <= page_size <= 100 + or not 1 <= max_pages <= 1_000 + or not 1 <= max_items <= 100_000 + ): raise ValueError( "Pagination requires page_size 1..100, max_pages 1..1000, max_items 1..100000." )