feat(services): add MISP Threat Intelligence Platform (misp__misp) service package#273
feat(services): add MISP Threat Intelligence Platform (misp__misp) service package#273boy331 wants to merge 4 commits into
Conversation
…rvice package Add OctoBus service package for MISP (Malware Information Sharing Platform) threat intelligence sharing with REST API key auth. Implements: - SearchEvents / GetEvent - threat event query - CreateEvent - event creation - SearchAttributes / AddAttribute - IoC search and management - SearchTags - tag collection search Relates to chaitin#268
|
本次 PR 新增 MISP 威胁情报平台服务包,整体结构规范,包含 proto 定义、核心实现、测试及文档。审查中发现两个需要关注的安全与可靠性问题:1) getEvent 和 addAttribute 中 |
✅ 真实设备验证完成使用本地 Docker 部署的 MISP 实例完成了完整验证: 验证结果
修复内容
本机部署命令docker run -d --name misp-db -e MYSQL_ROOT_PASSWORD=rootpass \
-e MYSQL_DATABASE=misp -e MYSQL_USER=misp -e MYSQL_PASSWORD=misppass \
mariadb:10.11
# ... (导入 SQL + 创建用户后) 配置 API key 为 40 位字母数字 |
- Fix path injection risk: add encodeURIComponent() for event_id in getEvent and addAttribute paths - Fix non-standard fetch option: replace timeoutMs with AbortSignal.timeout() for proper timeout handling - Improve timeout error message differentiation
|
本次 PR 对
此外,错误处理也得到增强,能够准确区分超时错误( 整体评估:PR 修复了历史发现的关键安全和可靠性问题(URL 注入、非标准 fetch 选项),但在 TLS 跳过校验的实现上, |
|
Review 阻塞:这个 service package PR 有测试文件,但我没有在 PR 描述、评论或改动文件中找到真实的测试截图证据(图片链接或提交的图片文件)。请补充能证明该 service package 跑通的截图,例如 |
…nstead of https.Agent The https.Agent + agent option is silently ignored by Node.js native fetch (undici), making skipTlsVerify ineffective. Use the OctoBus runtime convention (insecureSkipVerify/tlsInsecureSkipVerify as fetch options) which is supported by all existing merged service packages.
|
本次 PR 修改了 |
| }; | ||
|
|
||
| const skipVerify = toBoolean(bindings.skipTlsVerify) || toBoolean(bindings.tlsInsecureSkipVerify); | ||
| const tlsOptions = skipVerify ? { insecureSkipVerify: true, tlsInsecureSkipVerify: true } : {}; |
There was a problem hiding this comment.
fetch 选项中的 insecureSkipVerify 在标准 Node.js 环境下仍会被静默忽略,TLS 跳过功能可能依然无效
代码将 { insecureSkipVerify: true, tlsInsecureSkipVerify: true } 通过 ...tlsOptions 展开传入 fetch 的请求选项。然而,在标准 Node.js fetch(undici)实现中,insecureSkipVerify 和 tlsInsecureSkipVerify 均不是受支持的请求选项,会被静默忽略。此前历史发现已确认,旧代码使用相同字段时 TLS 跳过无效;本次改回后,若 OctoBus 运行时未对全局 fetch 做特殊封装或 patch,则 skipTlsVerify / tlsInsecureSkipVerify 配置仍会失效,导致用户配置了跳过 TLS 验证后连接自签名证书 MISP 实例依然失败。
Problem code:
Changed code at services/misp__misp/src/misp.js:179
Recommendation:
确认当前 OctoBus 运行时是否确实识别并处理 fetch 选项中的 insecureSkipVerify。若运行时仅为标准 Node.js fetch,应改用运行时已支持的方式(如 undici 的 dispatcher、环境变量 NODE_TLS_REJECT_UNAUTHORIZED,或 OctoBus SDK 提供的 HTTP 客户端)来实现 TLS 跳过。
已修复 TLS skip 方案感谢 @monkeyscan 的 review 反馈,已在本轮提交中修复以下问题: 修改内容
代码变更- import https from 'node:https';
- const agent = skipVerify ? new https.Agent({ rejectUnauthorized: false }) : undefined;
+ const tlsOptions = skipVerify ? { insecureSkipVerify: true, tlsInsecureSkipVerify: true } : {};
- res = await fetch(url, { ...headers, body, signal: AbortSignal.timeout(timeoutMs), agent });
+ res = await fetch(url, { ...headers, body, ...tlsOptions, signal: AbortSignal.timeout(timeoutMs) });测试验证37 项单元测试全部通过。 关于 @innomentats 要求的真实测试截图,我会在后续补充。 |
MISP (Malware Information Sharing Platform) Service Package
适配 GitHub Issue #268。
已实现方法
认证方式
Authorization请求头)验证结果
npm run validate -- --service-dir misp__misp通过npm test -- --service-dir misp__misp— 37 项测试全部通过npm run pack:check通过文件清单
已知限制
CreateEvent和AddAttribute为非幂等写操作,注意重复调用