Copilot commented on code in PR #43148:
URL: https://github.com/apache/superset/pull/43148#discussion_r3786331971


##########
superset/views/datasource/utils.py:
##########
@@ -45,9 +49,11 @@ def get_limit_clause(page: Optional[int], per_page: 
Optional[int]) -> dict[str,
 
     if isinstance(page, int) and isinstance(per_page, int):
         limit = int(per_page)
-        if limit < 0 or limit > samples_row_limit:
+        if limit < 0:
             # reset limit value if input is invalid
             limit = samples_row_limit
+        elif limit:
+            limit = apply_max_row_limit(limit)

Review Comment:
   `get_limit_clause` applies `apply_max_row_limit(limit)`, which can reduce an 
explicitly validated `per_page` (SamplesRequestSchema allows up to 10000) when 
`SQL_MAX_ROW` is configured below the requested value. In that case the 
endpoint will silently cap the request and also compute `row_offset` using the 
capped `limit`, which changes pagination semantics (e.g. page 2 offsets by the 
capped size, not the requested size). Consider aligning request validation with 
the effective maximum (e.g. reject `per_page` above `SQL_MAX_ROW`), and/or 
returning/using the effective capped per-page consistently so callers aren’t 
surprised by a silent override.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to