Add ThreatBook ClaudSandbox service#257
Merged
innomentats merged 1 commit intoJun 26, 2026
Merged
Conversation
Member
|
Review 阻塞:这个 service package PR 有测试文件,但没有可用的测试截图证据。PR 里只有一个未完成的 GitHub 上传占位( |
Author
pr信息已更新 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
接入产品
ThreatBook 微步在线云 API - ClaudSandbox V3 文件沙箱能力。
本次新增 OctoBus service package:
services/threatbook__claudsandbox_v3threatbook-claudsandbox-v3threatbook-claudsandboxthreat-intel接入接口:
POST /v3/file/upload:提交文件分析GET /v3/file/report:查询文件信誉报告GET /v3/file/report/multiengines:查询文件反病毒引擎检测报告参考文档:
产品版本
@chaitin-ai/octobus-sdk认证方式
使用 ThreatBook API Key 认证。
敏感配置放在
secret.schema.json:{
"apiKey": ""
}
非敏感配置放在 config.schema.json:
{
"baseUrl": "https://api.threatbook.cn",
"timeoutMs": 5000
}
实现中同时兼容以下别名:
API Key: threatbook_apikey, apikey, apiKey
Base URL: threatbook_domain, domain, restBaseUrl, baseUrl
实现方法
新增 service package 目录:
services/threatbook__claudsandbox_v3/
service.json
proto/threatbook_claudsandbox_v3.proto
src/service.js
src/threatbook-claudsandbox-v3.js
bin/threatbook-claudsandbox-v3.js
config.schema.json
secret.schema.json
README.md
test/threatbook-claudsandbox-v3.test.js
test/mock_upstream.js
新增 root wrapper:
services/bin/threatbook-claudsandbox-v3.js
并在以下文件中注册 service:
services/package.json
services/bin/octobus-tentacles.js
暴露的 RPC 方法:
ThreatBook_ClaudSandbox_V3.ThreatBook_ClaudSandbox_V3/UploadFile
ThreatBook_ClaudSandbox_V3.ThreatBook_ClaudSandbox_V3/GetFileReport
ThreatBook_ClaudSandbox_V3.ThreatBook_ClaudSandbox_V3/GetMultiEnginesReport
错误映射:
参数错误:INVALID_ARGUMENT
缺少 API Key:UNAUTHENTICATED
HTTP 401:UNAUTHENTICATED
HTTP 403:PERMISSION_DENIED
其他 HTTP 4xx:FAILED_PRECONDITION
HTTP 5xx / 网络错误 / 响应读取失败:UNAVAILABLE
非 JSON / 缺少 response_code:UNKNOWN
HTTP 200 但 response_code != 0:FAILED_PRECONDITION
测试命令
cd services
npm run validate -- --service-dir threatbook__claudsandbox_v3
npm test -- --service-dir threatbook__claudsandbox_v3
npm_config_cache=/private/tmp/octobus-npm-cache npm run pack:check
测试结果
验证通过:
npm run validate -- --service-dir threatbook__claudsandbox_v3
service package naming checks passed
单包测试通过:
npm test -- --service-dir threatbook__claudsandbox_v3
tests 26
pass 26
fail 0
已知限制
UploadFile 会向 ThreatBook 提交样本,可能消耗 API 配额。
上传操作无 package-side rollback,提交后无法由本 service 回滚远端分析任务。
查询报告时建议使用 resource 字段传文件 sha256,以贴合 ThreatBook 原始 API 参数。
PR、日志、截图中不得包含真实 API Key、token、cookie、生产样本或敏感文件 hash。
测试截图