Commit cd6470a
committed
fix(api): reject NaN/Inf in min-savings query params
parseMinSavingsParam used strconv.ParseFloat, which accepts "NaN",
"Inf", "+Inf" and "Infinity" (case-insensitively), and only rejected
v < 0, which is false for NaN. A NaN min_savings_usd bound into
"monthly_savings >= $n" excludes every row with HTTP 200, and a NaN
min_savings_pct is a silent no-op floor. Reject non-finite values at
the input boundary with a 400 client error instead, per the fail-loud
policy.
Extends TestParseMinSavingsParam with NaN, +Inf, -Inf, bare/word
infinity, and pct-path cases; the new cases fail on the pre-fix code.
Closes #11831 parent 4108e51 commit cd6470a
2 files changed
Lines changed: 20 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
591 | 592 | | |
592 | 593 | | |
593 | 594 | | |
594 | | - | |
595 | | - | |
596 | | - | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
597 | 599 | | |
598 | 600 | | |
599 | 601 | | |
| |||
603 | 605 | | |
604 | 606 | | |
605 | 607 | | |
606 | | - | |
607 | | - | |
| 608 | + | |
| 609 | + | |
608 | 610 | | |
609 | 611 | | |
610 | 612 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
534 | 547 | | |
535 | 548 | | |
536 | 549 | | |
| |||
0 commit comments