This repository was archived by the owner on Oct 19, 2026. It is now read-only.
Repository navigation
Commit 2398a92
authored
fix(lfs): reject invalid lock list limit instead of panicking (#2175)
* fix(lfs): reject invalid lock list limit instead of panicking
The `limit` query parameter of GET /info/lfs/locks flows as a raw
string into `limit.parse::<i64>().unwrap()`:
- `?limit=abc` panics on the unwrap.
- A negative value such as `?limit=-1` passes the parse, then
`size as usize` wraps to usize::MAX and `split_off` / indexing
panic out of bounds.
Both are unauthenticated request-triggered handler panics.
Parse the limit as usize (rejecting negatives naturally), map
malformed values to a GeneralError that the router maps to a 400,
and extract the pagination into a pure helper so it is directly
unit-testable.
Signed-off-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>
* fix(lfs): keep invalid lock list limit classified as 400
lfs_retrieve_lock replaced every error from lfs_get_filtered_locks with
the generic 'Lookup operation failed!', so the 'Invalid limit parameter'
error produced by apply_lock_limit lost its classification and the
router's map_lfs_error turned it into a 500 instead of the intended 400.
Pass input-validation errors through unmasked and keep masking only
genuine lookup failures; strengthen the limit-rejection test to pin the
'Invalid' message prefix the router contract depends on.
Signed-off-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>
Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>
---------
Signed-off-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>
Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>
Co-authored-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>1 parent 3b813a0 commit 2398a92
1 file changed
Lines changed: 78 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
391 | 397 | | |
392 | 398 | | |
393 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
394 | 409 | | |
| 410 | + | |
395 | 411 | | |
396 | | - | |
397 | | - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
398 | 416 | | |
399 | | - | |
400 | | - | |
| 417 | + | |
| 418 | + | |
401 | 419 | | |
402 | | - | |
| 420 | + | |
403 | 421 | | |
404 | 422 | | |
405 | 423 | | |
| |||
625 | 643 | | |
626 | 644 | | |
627 | 645 | | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
628 | 700 | | |
629 | 701 | | |
630 | 702 | | |
| |||
0 commit comments