Repository navigation
Description
Problem Description
When a Shodan InternetDB lookup fails, ShodanInternetDBClient.check_ip (src/devops_cli/security/vulnerability_lookup.py) gives a record with outcome="ok". The except branch sets only the summary "Unchecked / Lookup timeout". It does not set outcome, so the record keeps the model default "ok" (NetworkReputationRecord.outcome in src/devops_cli/models/vulnerability.py). The client also keeps the failed record in self._cache for the life of the client, so the address is not asked about again.
The review pipeline shows a network reference as "Unchecked" only when outcome is unavailable or failed (_determine_network_security_status in src/devops_cli/ai/review/pipeline.py). Thus a failed lookup of a public address shows as "✓ Safe / Low Risk". This is the same defect that #1429 fixed for Cloudflare Radar: a failed lookup must be reported as unavailable or failed, never as verified.
A lookup fails at a timeout, at a failed connect, and, after #2430, when the egress-checked factory refuses a non-public DNS answer for internetdb.shodan.io.
Reproduction Steps
- Stub
socket.getaddrinfoto answer10.0.0.1forinternetdb.shodan.io, and makesocket.socket.connectraiseOSError. - Run
ShodanInternetDBClient().check_ip("93.184.215.14"). - Read
outcomeandreputation_summaryof the record, and see if the client cached the record.
The same result comes from any failed connect or timeout before #2430.
Expected vs Actual Behavior
Expected: a failed lookup gives outcome="failed", as CloudflareRadarClient and OSVClient do. The review shows the reference as "Unchecked". A decision on the cache of a failed record is recorded (Radar keeps a failed record in its in-memory cache and not in Valkey; OSV caches no failed lookup).
Actual: outcome="ok", summary "Unchecked / Lookup timeout", and the record is cached. The review shows the reference as "✓ Safe / Low Risk".
Environment Diagnostics
devops-cli 0.10.0, from the source tree of the topic branch of #2430. Linux, Python 3.14. The probe made no network request.
Logs, Traces, or Terminal Output
outcome: ok | summary: Unchecked / Lookup timeout
cached: True
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Source: #2430
Proposed design
Problem statement
A failed Shodan InternetDB lookup keeps the model default outcome "ok" because the except branch does not set it. The review pipeline reads outcome and shows the address as "Safe / Low Risk" instead of "Unchecked". The failed record is also cached, so the address is never re-checked for the life of the client.
Acceptance criteria
- Criterion 1: A failed Shodan InternetDB lookup returns a record with outcome set to "failed".
Verification: Stub socket.getaddrinfo to answer a private address and make socket.socket.connect raise OSError. Call ShodanInternetDBClient().check_ip("93.184.215.14"). Assert record.outcome equals "failed". - Criterion 2: The review pipeline shows a failed Shodan lookup as "Unchecked".
Verification: Call _determine_network_security_status with a NetworkReputationRecord whose outcome is "failed". Assert the return value is "Unchecked". - Criterion 3: A failed Shodan InternetDB record is not stored in the client in-memory cache.
Verification: After a failed check_ip call, assert the ip key is not in client._cache. - Criterion 4: A successful Shodan InternetDB lookup (200 or 404) is still cached.
Verification: Stub the HTTP client to return 200 or 404. Call check_ip. Assert the ip key is in client._cache and outcome is "ok".
Key questions
- What outcome value should a failed Shodan InternetDB lookup record carry?: "failed". This matches CloudflareRadarClient, which sets record.outcome = "failed" in its except block, and OSVClient, which returns a result with status "failed". The value "unavailable" is reserved for rate-limiting (HTTP 429) in Radar. (best practice) [sources: src/devops_cli/security/vulnerability_lookup.py, src/devops_cli/models/vulnerability.py]
- Chosen: failed. Matches CloudflareRadarClient and OSVClient. The pipeline already maps "failed" to "Unchecked".
- Rejected: unavailable. Radar uses this only for HTTP 429 rate limiting. A connect failure or timeout is a failure, not an availability signal.
- Rejected: ok (current default). This is the defect. It causes the pipeline to show the address as Safe.
- Should a failed Shodan InternetDB record be cached in the client in-memory cache?: No. A failed record is not cached. This matches OSVClient, which writes to its cache only in the try block and returns a failed result without caching on exception. Not caching allows the next call to retry the lookup after a transient failure. (best practice) [sources: src/devops_cli/security/vulnerability_lookup.py]
- Chosen: Do not cache failed records. Matches OSVClient. A transient network failure does not permanently block re-checking. Simpler logic: the cache write stays in the try block.
- Rejected: Cache failed records in L1 only. Matches CloudflareRadarClient L1 behavior. But Shodan has no L2 tier, and a single transient failure would block re-checking for the life of the client. The body lists this as part of the defect.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Oct 28, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
A failed security lookup is reported as safe, which is a false negative in security tooling.A security tool showing an unchecked address as Safe misleads users into a false sense of protection.Users rely on the review to flag unverified addresses; a false Safe result undermines trust in the entire security pipeline.The fix sets outcome to failed in one except branch and adjusts one cache decision, as done for Cloudflare Radar in #1429.Both address failed security lookups shown as safe, but #708 fixes the scanner report pipeline while this fixes the Shodan client outcome field and cache.docs(openspec): the plan of 2430 records the result of a refusal for …
fix(security): the osv, internetdb, radar and cloudflare api clients …
devops-cli-service commentedon Oct 29, 2026
Status set to Ready at ef6e028 (see proposed design in issue body).
chore(main): release 0.16.3 (#2658)
docs(openspec): plan #2636 make clean-default model fields required (#…
fix(security): make clean-default model fields required (#3807)
docs(docs): add a no clean default rule for result models (#3844)