checks: `missing-input-length-bound` accepts any `.len()` call as a bound (#702 regression)
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 45/100
Research direction
Start in crates/checks/src/missing_input_length_bound.rs, around line 94, where has_length_check matches any param.len() or param.is_empty() call in the function body. The fix is to count only length calls that sit in an upper-bound comparison inside a diverging if, assert!, require! or panic_with_error!. Done when unit tests show that an unused len() and an is_empty()-only body still raise the finding, while assert!(data.len() <= MAX) suppresses it.
Written by the indexing model from the issue text.
Description
Problem
has_length_check returns true if <param>.len() or <param>.is_empty() appears anywhere in the body, whether or not it is compared against a bound. Examples: let n = data.len(); used only as a loop bound, log!(.., data.len()), or an is_empty() check (which bounds nothing from above). Each of these suppresses the finding. #702 described exactly this and was closed, but the visitor is unchanged.
Evidence (main @ 418f39e)
Expected behaviour
Only count param.len() used in a comparison with an upper bound (<, <=, >, >= against a literal / const / storage-read config value) inside an if that diverges, assert!, require!, or panic_with_error!. is_empty() alone does not count.
Acceptance criteria
- Predicate tightened.
- Unit tests: unused
len()andis_empty()-only do not suppress;assert!(data.len() <= MAX)does.
- Dominant language
- Rust
- Stars
- 2
- Forks
- 120
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SorobanGuard/Guard-CLI
-
cli-crate enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
SorobanGuard/Guard-CLI#1076 ·
-
bug cli-crate good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
SorobanGuard/Guard-CLI#1075 ·
-
cli-crate enhancement good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
SorobanGuard/Guard-CLI#1074 ·
-
analyzer-crate bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SorobanGuard/Guard-CLI#1072 ·
-
cli-crate enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
SorobanGuard/Guard-CLI#1070 ·
All issues in SorobanGuard/Guard-CLI
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
eventflux-io/eventflux#203 ·
Maintainers usually reply within 1 day
-
bug ui
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
userFRM/egui-charts#4068 ·
Maintainers usually reply within 1 day
-
fuzz-crash review-followup
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
marketing
Difficulty 2/5 Half a day Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
aws/aws-emulator#610 ·