From 87e95e89935cec1fb0f0208f8ee7fd68502cca10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Tue, 9 Jun 2026 16:52:20 +0200 Subject: [PATCH] Reject --before combined with --first MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NewCursorFromFlags validated --first/--last, --after/--before, and --after/--last as mutually exclusive, but missing the symmetric --first/--before guard. Passing --first with --before fell into the backward branch, where size defaulted from the unset --last and the direction silently flipped to Tail, discarding --first and reversing pagination. Reject the combination up front like the other invalid pairings. Signed-off-by: Émile Ré --- pkg/proboctl/cmdutil/paginate.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/proboctl/cmdutil/paginate.go b/pkg/proboctl/cmdutil/paginate.go index 27a91aabd..676e8e401 100644 --- a/pkg/proboctl/cmdutil/paginate.go +++ b/pkg/proboctl/cmdutil/paginate.go @@ -87,6 +87,10 @@ func NewCursorFromFlags[F page.OrderField]( return nil, fmt.Errorf("--after cannot be combined with --last") } + if pf.Before != "" && pf.First > 0 { + return nil, fmt.Errorf("--before cannot be combined with --first") + } + var ( size int from *page.CursorKey