Repository navigation
ACOMMONS-231 Find IP addresses throughout string literals - #605
erwan-leforestier-sonarsource wants to merge 6 commits into
Conversation
Code Review ✅ Approved 6 closed / 6 findings🟡 Medium risk · The new extractAll scanner parses addresses across text and URLs; edge-case misparsing could omit literals or return incorrect candidates. Adds ✅ 6 closed✅ Edge Case: CIDR suffix swallows rest of list entry, dropping later addresses
✅ Edge Case: URL host followed by punctuation is dropped, unlike bare addresses
✅ Bug: Enclosing '[' check drops bracketed IPv6 hosts in URLs with a path
✅ Edge Case: Zoned bracketed IPv6 URL hosts still dropped when followed by punctuation
✅ Edge Case: Closing bracket bounds zones in URL hosts only, not in bare text
...and 1 more closed from earlier reviews Verification Rules 2/2 met Knowledge 🔎 1 Repos 10 inspected · PRs 1 inspectedFunctional validation No results Rules 2 passed 1 not applicable
Knowledge 🔎 1 informed a finding
Broader impact Repos 10 inspected PRs 1 inspectedCross-repo 10 repositories inspected 0 open impacts
5 more repositories Cross-PR 1 PR inspected 0 open impacts
Auto-approval Not enabledFor more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|
|
This comment will be updated automatically if new data arrives. 🔗 Commit SHA: 19608cd | Docs | View more details | Give us feedback! |




Add
IpAddressCandidateExtractor.extractAll(String)to find validated IP address literals throughout text, paths, lists, and URL components. Results preserve source order, duplicate occurrences, address spelling, zones, and valid standalone CIDR suffixes; endpoint brackets and valid ports are removed. URL schemes and authority credentials are excluded, and malformed entries cannot yield shorter valid addresses.The existing
extract(String)operation and address classification remain unchanged. Tests cover the Kubernetes storage-path example, multiple addresses, URL components and credentials, endpoint validation, CIDR/path distinctions, recovery after malformed entries, bounded CIDR suffixes before later values, punctuation enclosing URL hosts, wrapped IPv6 URLs with paths/queries/fragments, bracketed zones in URLs and text, and malformed port rejection.Validation: the pinned baseline passes
mvn clean install(1,626 tests). The implementation passes the focused extractor/classifier suite (647 tests) and fullmvn -Pcoverage clean install(1,854 tests), including the library size check. All Maven commands used the required build resource gate.