-
Notifications
You must be signed in to change notification settings - Fork 86
Add geyecloud-ATD service adapter #475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shixiaoman-1111
wants to merge
2
commits into
chaitin:main
Choose a base branch
from
shixiaoman-1111:codex/add-geyecloud-atd-468
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # geyecloud-ATD OctoBus Service | ||
|
|
||
| Read-only OctoBus service adapter for the geyecloud-ATD / Advanced Threat Detection workbench API. | ||
|
|
||
| ## Supported Product | ||
|
|
||
| - Product: geyecloud-ATD, shown by the UI as "高级威胁检测系统" | ||
| - API document: `ATD API接口汇总.pdf` | ||
| - Validated environment shape: `https://<host>:5443/workbenchApi/furious/...` | ||
|
|
||
| ## Authentication | ||
|
|
||
| The UI login returns an `apiKey`. Runtime calls send it as the `api-key` header. The browser bundle also emits ATD request metadata headers: | ||
|
|
||
| - `api-key: <secret.apiKey>` | ||
| - `user-key: ""` | ||
| - `X-Ca-Timestamp` | ||
| - `X-Ca-Nonce` | ||
| - `X-Ca-Sign: md5(timestamp + nonce)` | ||
|
|
||
| The adapter does not store usernames or passwords. | ||
|
|
||
| ## Configuration | ||
|
|
||
| ```json | ||
| { | ||
| "baseUrl": "https://192.0.2.10:5443", | ||
| "skipTlsVerify": true, | ||
| "timeoutMs": 10000 | ||
| } | ||
| ``` | ||
|
|
||
| ## Secret | ||
|
|
||
| ```json | ||
| { | ||
| "apiKey": "<masked>" | ||
| } | ||
| ``` | ||
|
|
||
| ## Methods | ||
|
|
||
| | RPC | Upstream endpoint | Risk | | ||
| |---|---|---| | ||
| | `AggregateThreatEvents` | `POST /workbenchApi/furious/elasticSearch/aggregate` | read-only | | ||
| | `GetNetworkLogTimeTrend` | `POST /workbenchApi/furious/netWorkLog/timeTrend` | read-only | | ||
| | `GetNetworkLogDimensionStatistics` | `POST /workbenchApi/furious/netWorkLog/dimensionStatistics` | read-only | | ||
| | `ListNetworkLogs` | `POST /workbenchApi/furious/netWorkLog/list` | read-only | | ||
| | `GetNetworkLogDetail` | `POST /workbenchApi/furious/netWorkLog/details` | read-only | | ||
| | `ListFileDetectionLogs` | `POST /workbenchApi/furious/fileDetectionLog/list` | read-only | | ||
| | `GetFileDetectionLogDetail` | `POST /workbenchApi/furious/fileDetectionLog/details` | read-only | | ||
| | `GetFileDetectionSeverityStats` | `POST /workbenchApi/furious/fileDetectionLog/severityNumber` | read-only | | ||
| | `ListSceneMonitors` | `POST /workbenchApi/furious/sceneMonitor/querySceneMonitor` | read-only | | ||
| | `SearchSceneMonitorEvents` | `POST /workbenchApi/furious/sceneMonitor/searchFromMonitor` | read-only | | ||
| | `GetSituationOverview` | `GET /workbenchApi/furious/situationAwareness/...` | read-only | | ||
| | `SearchThreatEvents` | `POST /workbenchApi/furious/searchCenter/advanced/searchData` | read-only | | ||
| | `GetThreatEventDetail` | `POST /workbenchApi/furious/searchCenter/advanced/searchDataDetail` | read-only | | ||
|
|
||
| ## Suggested Capset | ||
|
|
||
| Use this service in a read-only investigation capset, for example `geyecloud-atd-readonly-investigation`. | ||
|
|
||
| ## Validation | ||
|
|
||
| Local checks: | ||
|
|
||
| ```bash | ||
| npm test | ||
| npm run validate | ||
| npm run pack:check | ||
| ``` | ||
|
|
||
| Real API validation performed against the provided demo environment: | ||
|
|
||
| - Request: `POST /workbenchApi/furious/elasticSearch/aggregate` | ||
| - Headers: `api-key` masked, ATD signature headers present | ||
| - Body: `{"terms":"severity","tableName":"hw","from":1,"size":10,...}` | ||
| - Result: `HTTP 200`, `code: 200`, `msg: "success"`, aggregate buckets returned | ||
| - P0 expansion adds mocked coverage for file detection pagination, situation overview GET calls, and advanced threat search response mapping. | ||
|
|
||
| ## Known Limits | ||
|
|
||
| - First version is intentionally read-only. | ||
| - Login automation is not part of the adapter because the current environment has captcha enabled. Provide an `apiKey` from login/API-key provisioning as the secret. | ||
| - The PDF contains many writable configuration and management APIs; those are deferred until a controlled write-test object and cleanup path are available. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| import { fileURLToPath } from "node:url"; | ||
| import { runServiceMain } from "@chaitin-ai/octobus-sdk"; | ||
|
|
||
| import { service } from "../src/service.js"; | ||
|
|
||
| runServiceMain(service, { | ||
| entryFile: fileURLToPath(new URL("./geyecloud-atd.js", import.meta.url)), | ||
| }); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "type": "object", | ||
| "required": [ | ||
| "baseUrl" | ||
| ], | ||
| "properties": { | ||
| "baseUrl": { | ||
| "type": "string", | ||
| "title": "geyecloud-ATD Base URL", | ||
| "description": "geyecloud-ATD workbench base URL, for example https://192.0.2.10:5443" | ||
| }, | ||
| "timeoutMs": { | ||
| "type": "integer", | ||
| "title": "Request Timeout (ms)", | ||
| "default": 10000, | ||
| "minimum": 1000 | ||
| }, | ||
| "skipTlsVerify": { | ||
| "type": "boolean", | ||
| "title": "Skip TLS Verification", | ||
| "default": false | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "name": "geyecloud-atd", | ||
| "version": "0.0.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "files": [ | ||
| "README.md", | ||
| "bin/", | ||
| "src/", | ||
| "proto/", | ||
| "service.json", | ||
| "config.schema.json", | ||
| "secret.schema.json" | ||
| ], | ||
| "bin": { | ||
| "geyecloud-atd": "bin/geyecloud-atd.js" | ||
| }, | ||
| "scripts": { | ||
| "test": "node --test test/*.test.js", | ||
| "pack:check": "npm pack --dry-run", | ||
| "validate": "octobus-sdk validate --strict" | ||
| }, | ||
| "dependencies": { | ||
| "@chaitin-ai/octobus-sdk": "^0.5.0" | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package.json 中 octobus-sdk 版本与仓库主分支不一致
仓库主分支已通过 PR #433 将 octobus-sdk 升级至 0.6.0,但本服务新增 package.json 中仍依赖 ^0.5.0。这会导致 monorepo 内 SDK 版本不一致,可能引发 CLI 验证行为差异、依赖解析冲突或未来维护负担。
Problem code:
Recommendation:
将依赖版本统一为 ^0.6.0,与仓库其余服务保持一致。
Suggested diff: