From bf65e4437e7e77c02410525f75b6d8a13a856352 Mon Sep 17 00:00:00 2001 From: Aaron Cooper <39556126+cooperaa@users.noreply.github.com> Date: Wed, 3 Apr 2024 09:26:54 -0400 Subject: [PATCH 1/2] raise ValueError on start index that exceeds MAX_ITEMS --- pyral/config.py | 2 +- pyral/restapi.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pyral/config.py b/pyral/config.py index bf7f5f4..38f51da 100644 --- a/pyral/config.py +++ b/pyral/config.py @@ -29,7 +29,7 @@ START_INDEX = 1 KILO_PAGESIZE= 1000 MAX_PAGESIZE = 2000 -MAX_ITEMS = 1000000 # a million seems an eminently reasonable limit ... +MAX_ITEMS = 10000000 DEFAULT_SESSION_TIMEOUT = 10 # in seconds RALLY_REST_HEADERS = \ diff --git a/pyral/restapi.py b/pyral/restapi.py index 821490e..3427980 100644 --- a/pyral/restapi.py +++ b/pyral/restapi.py @@ -803,6 +803,8 @@ def _buildRequest(self, entity, fetch, query, order, kwargs): usi = int(kwargs['start']) # usi - user supplied start index if 0 < usi < MAX_ITEMS: # start index must be greater than 0 and less than max startIndex = usi + else: + raise ValueError('Provided start index is greater than pyral MAX_ITEMS configured value.') except ValueError as ex: pass From 374a6e2f0eb9291f2f73d4a671f5609933b5f8b5 Mon Sep 17 00:00:00 2001 From: Aaron Cooper <39556126+cooperaa@users.noreply.github.com> Date: Wed, 3 Apr 2024 09:28:13 -0400 Subject: [PATCH 2/2] undo config change --- pyral/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyral/config.py b/pyral/config.py index 38f51da..bf7f5f4 100644 --- a/pyral/config.py +++ b/pyral/config.py @@ -29,7 +29,7 @@ START_INDEX = 1 KILO_PAGESIZE= 1000 MAX_PAGESIZE = 2000 -MAX_ITEMS = 10000000 +MAX_ITEMS = 1000000 # a million seems an eminently reasonable limit ... DEFAULT_SESSION_TIMEOUT = 10 # in seconds RALLY_REST_HEADERS = \