feat(shodan-internetdb): add Shodan InternetDB IP intelligence service package#348
feat(shodan-internetdb): add Shodan InternetDB IP intelligence service package#348dingzhejianjian wants to merge 3 commits into
Conversation
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 这个 PR 新增了一个 Shodan InternetDB 的 OctoBus 服务包,提供了基于 Shodan InternetDB API 的 IP 情报查询功能(端口、主机名、CVE 等)。主要变更包括服务实现、Proto 定义、测试、配置以及根级服务的注册。 整体代码结构清晰,使用了 AbortController 处理超时,错误映射也较为合理。但在测试代码中发现了一个会导致测试无法运行的 API 误用问题,另外存在上游错误响应体泄露到 gRPC 错误消息中的风险,以及缺少对输入 IP 格式的验证。 |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次修改在 |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次 PR 仅移除了 |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: No changed files to review. |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次 PR 对
整体评估:这是一个正确的错误处理改进。将 |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次修改仅涉及 关键设计决策:为 总体评估:修复合理且必要,降低了因异常输入导致服务崩溃或堆栈溢出的风险。代码逻辑简洁,未发现引入新的行为回归或安全缺陷。 |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次 PR 在 |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次 PR 在 services/bin/octobus-tentacles.js 的 services 注册表中新增了 8 个服务条目:alibaba-cloud-simple-application-server-firewall、defectdojo、elastic-kibana-7-17-26、imperva-waf-gateway-v13-6-90、sangfor-xdr-v2-0-45、slack-group-robot、threatbook-claudsandbox-v3、topsec-waf-v3-2294-20238。变更仅涉及静态配置对象的扩展,未修改运行时逻辑。新增条目的路径和键名与现有模式保持一致。但发现其中一个新增条目可能存在拼写错误:threatbook-claudsandbox-v3 中的 "claudsandbox" 极有可能是 "cloudsandbox" 的笔误,若实际目录名为 cloudsandbox,则会导致模块加载失败。 |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次 PR 修改了
经核对,新增的所有 |
dingzhejianjian
left a comment
There was a problem hiding this comment.
✅ 已完成手动验证。LookupIP 返回 8.8.8.8 的端口和主机名数据,IP 校验正常。
|
Reviewer note: this PR currently has merge conflicts with the target branch, so it cannot be merged or reviewed safely in its current state. Please rebase or merge the latest base branch, resolve the conflicts, and make sure GitHub Actions pass again. I am marking/keeping this PR as draft until the conflicts are resolved. |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次变更仅在 |
|
MonkeyScan 已经开始评审,完成后会更新到本评论中,请稍后刷新查看。 |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次 PR 仅在 |
手动验证结果 ✅
结论:1/1 通过,可进入 review。 |
手动验证结果(完整)LookupIP (8.8.8.8)命令: 返回: {
"message": "ok",
"ip": "8.8.8.8",
"hostnames": ["dns.google"],
"ports": [53, 443]
}✅ 结论:1/1 通过,可进入 review。 |
54cc1b9 to
5ac548f
Compare
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: Reviewed the service SDK upgrades and new service packages. Identified four actionable issues: a critical AES-CBC IV reuse vulnerability in |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次修改针对 Shodan InternetDB 服务做了两项改进:
测试同步补充了 401/403 的用例,覆盖了新增行为。整体逻辑正确,修复了此前 |
5437a4c to
f7f267e
Compare
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次PR修复了Shodan InternetDB服务中的HTTP错误码映射和fetchJson异常处理问题:
整体评估:变更逻辑正确,测试充分,没有发现可行动的问题。 |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次 PR 修改了 具体变更包括:
经核对,所有 |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次 PR 修改了 |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: No changed files to review. |
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: No changed files to review. |
…e package
Shodan InternetDB — free, no-signup, no-key IP intelligence API.
Returns ports, hostnames, CVEs, tags, CPEs for a given IP.
1 RPC method:
- LookupIP (GET /{ip})
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- mapHttpError now handles 401 and 403 as PERMISSION_DENIED - Removed unused snippet variable (dead code) - Move res.text() and mapHttpError inside try block for AbortController coverage - Added GrpcError passthrough in catch to prevent re-wrapping - Added 401 and 403 test cases
f10c740 to
dc3087e
Compare
|
PR Title: feat(shodan-internetdb): add Shodan InternetDB IP ... Commit: 本次 PR 新增了一个 Shodan InternetDB 服务包(services/shodan__internetdb/),用于通过 Shodan 的免费 IP 情报 API 查询端口、主机名、CVE 等信息。核心实现包括:
整体代码结构清晰,输入校验和错误处理基本到位。主要风险点在于:测试对 |
| export const handlers = { | ||
| [METHOD_LOOKUP_FULL]: (ctx) => makeRuntime(ctx).runLookup(ctx.request ?? {}), | ||
| }; | ||
|
|
There was a problem hiding this comment.
handler 请求对象来源与 resolveCallContext 的归一化逻辑不一致
resolveCallContext 内部显式做了 req: ctx.req ?? ctx.request ?? {} 的归一化,意味着作者预期运行时可能通过 ctx.req 传递请求体。但 handlers 中直接调用 makeRuntime(ctx).runLookup(ctx.request ?? {}),完全绕过了该归一化结果。若实际框架使用 ctx.req 而非 ctx.request,runLookup 会收到空对象,导致 IP 必填校验直接失败。
Problem code:
Changed code at services/shodan__internetdb/src/shodan-internetdb.js:141-143
Recommendation:
在 handler 中将请求体传入改为 ctx.req ?? ctx.request ?? {},或如果框架始终使用 request,则移除 resolveCallContext 中未实际消费的 req 归一化逻辑,避免误导后续维护者。
| globalThis.fetch = originalFetch; | ||
| console.log = originalConsoleLog; | ||
| console.error = originalConsoleError; | ||
| }); |
There was a problem hiding this comment.
缺少对非法 IP 格式输入的测试覆盖
现有测试仅验证了 request: {}(缺失 ip)的场景,但未覆盖 net.isIP(ip) 返回 0 的非法 IP 格式分支,例如 'not-an-ip'、'256.0.0.1'、'1.2.3.4.5' 或空字符串。该分支是实现中的显式校验逻辑,缺乏测试意味着后续重构时可能意外削弱校验或改变错误行为。
Problem code:
Changed code at services/shodan__internetdb/test/shodan-internetdb.test.js:56-58
Recommendation:
补充非法 IP 格式的测试用例,断言其抛出 legacyCode 为 INVALID_ARGUMENT 的 GrpcError。
| assert.ok(result.hostnames.includes('dns.google')); | ||
| assert.ok(result.ports.includes(53)); | ||
| assert.ok(result.cpes.includes('cpe:/a:google:dns')); | ||
| assert.ok(result.tags.includes('cdn')); |
There was a problem hiding this comment.
缺少对 fetch 异常/超时回退路径的测试覆盖
fetchJson 的 catch 分支负责将非 GrpcError 异常(如网络断开、DNS 失败、请求超时等)统一包装为 UNAVAILABLE。当前测试仅覆盖了 HTTP 错误状态码,未覆盖 fetch 本身抛出异常或 AbortController 触发超时的场景。该路径若在未来重构中被意外移除或修改,会导致底层异常直接外泄或错误码映射丢失。
Problem code:
Changed code at services/shodan__internetdb/test/shodan-internetdb.test.js:76-106
Recommendation:
补充 mock fetch 抛出异常(如 new Error('getaddrinfo ENOTFOUND') 或 AbortError)的测试用例,断言最终错误 legacyCode 为 UNAVAILABLE。

接入设备
Shodan InternetDB — 免费、无需注册、无需 API Key 的 IP 情报查询服务,由 Shodan(知名网络设备搜索引擎公司)提供。
认证方式
无需认证,
secret.schema.json为空。实现方法
LookupIPGET /{ip}联调证据
MCP 工具列表
返回工具:
shodan-internetdb__shodan-test__lookup_i_pConnect RPC 验证
{"message":"ok","ip":"8.8.8.8","hostnames":["dns.google"],"ports":[53,443]}{"message":"ok","ip":"1.1.1.1","hostnames":["one.one.one.one"],"ports":[53,80,443,2083,8880],"cpes":["cpe:/a:cloudflare:cloudflare"]}测试结果
Closes #347