Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions services/bin/infobyte-faraday-v5-22.js
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 "../infobyte__faraday_v5-22/src/service.js";

runServiceMain(service, {
entryFile: fileURLToPath(new URL("../infobyte__faraday_v5-22/bin/infobyte-faraday-v5-22.js", import.meta.url)),
});
4 changes: 4 additions & 0 deletions services/bin/octobus-tentacles.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ const services = {
entryFile: "../imperva__waf-gateway_v13-6-90/bin/imperva-waf-gateway-v13-6-90.js",
serviceModule: "../imperva__waf-gateway_v13-6-90/src/service.js",
},
"infobyte-faraday-v5-22": {
entryFile: "../infobyte__faraday_v5-22/bin/infobyte-faraday-v5-22.js",
serviceModule: "../infobyte__faraday_v5-22/src/service.js",
},
"nsfocus-ads-v4-5-r90-f06": {
entryFile: "../nsfocus__ads_v4-5-r90-f06/bin/nsfocus-ads-v4-5-r90-f06.js",
serviceModule: "../nsfocus__ads_v4-5-r90-f06/src/service.js",
Expand Down
71 changes: 71 additions & 0 deletions services/infobyte__faraday_v5-22/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Faraday v5.22 OctoBus Service

This package adapts Faraday v5.22.0 workspace, host, and vulnerability APIs for OctoBus.

## Configuration

`config`:

- `faraday_base_url`: Faraday base URL, for example `http://127.0.0.1:5985`.
- `headers`: optional extra HTTP headers.
- `timeoutMs`: optional HTTP timeout in milliseconds, default `5000`.

`secret`:

- `faraday_username`: Faraday username.
- `faraday_password`: Faraday password.

Authentication uses Faraday Basic authentication. The service intentionally rejects `skipTlsVerify`, `tlsInsecureSkipVerify`, and `insecureSkipVerify`; use a trusted TLS certificate for HTTPS endpoints.

## Methods

- `InfobyteFaradayV522.Faraday/ListWorkspaces`: `GET /_api/v3/ws`
- `InfobyteFaradayV522.Faraday/CreateWorkspace`: `POST /_api/v3/ws`
- `InfobyteFaradayV522.Faraday/ListHosts`: `GET /_api/v3/ws/{workspace_name}/hosts`
- `InfobyteFaradayV522.Faraday/CreateHost`: `POST /_api/v3/ws/{workspace_name}/hosts`
- `InfobyteFaradayV522.Faraday/ListVulnerabilities`: `GET /_api/v3/ws/{workspace_name}/vulns`
- `InfobyteFaradayV522.Faraday/GetVulnerability`: `GET /_api/v3/ws/{workspace_name}/vulns/{object_id}`
- `InfobyteFaradayV522.Faraday/CreateVulnerability`: `POST /_api/v3/ws/{workspace_name}/vulns`

## Risk and Authorization Notes

Recommended capset split:

- Read-only operations: `ListWorkspaces`, `ListHosts`, `ListVulnerabilities`, `GetVulnerability`.
- Write operations: `CreateWorkspace`, `CreateHost`, `CreateVulnerability`.

Write operations create data in Faraday and should be granted only to automation that is allowed to synchronize security assessment assets and vulnerabilities. Use a dedicated Faraday account with the minimum workspace permissions required by the workflow.

Write behavior:

- `CreateWorkspace` creates a workspace. If the same name already exists, Faraday returns an upstream error; callers should treat workspace names as unique.
- `CreateHost` creates a host in the target workspace. Use test-only IPs and hostnames when validating.
- `CreateVulnerability` creates a vulnerability under a host or other Faraday parent object. Use a test parent object and an `external_id` that identifies the source workflow.
- The service does not implement delete or update operations, so rollback should be performed in Faraday UI/API by deleting the test workspace or created objects.
- Audit fields can be carried through `external_id`, `tool`, `metadata`, `description`, and Faraday response metadata such as `owner`, `create_time`, and `update_time`.

Known limits:

- TLS verification cannot be disabled through service config.
- Responses include Faraday raw response bodies to preserve evidence and troubleshooting details; do not pass production secrets or sensitive business data in free-form fields.

## Example

```bash
node services/bin/infobyte-faraday-v5-22.js list-workspaces \
--config '{"faraday_base_url":"http://127.0.0.1:5985"}' \
--secret '{"faraday_username":"faraday","faraday_password":"***"}'
```

Responses include the upstream HTTP status, raw response body, parsed raw JSON, and list results where applicable so PR validation can cite the real Faraday request and response without inventing evidence.

## Validation

```bash
cd services
npm run validate -- --service-dir infobyte__faraday_v5-22
npm test -- --service-dir infobyte__faraday_v5-22
npm run pack:check
```

For integration validation, import the service into OctoBus, create an instance with `faraday_base_url`, `faraday_username`, and `faraday_password`, add that instance to a capset, and call at least one read method and one write method against a test Faraday workspace.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env node
import { runServiceMain } from '@chaitin-ai/octobus-sdk';

import { service } from '../src/service.js';

runServiceMain(service);
32 changes: 32 additions & 0 deletions services/infobyte__faraday_v5-22/config.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"additionalProperties": true,
"properties": {
"faraday_base_url": {
"type": "string",
"description": "Faraday base URL, for example http://localhost:5985."
},
"baseUrl": {
"type": "string",
"description": "Alias for faraday_base_url."
},
"restBaseUrl": {
"type": "string",
"description": "Legacy alias for faraday_base_url."
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Optional extra HTTP headers sent to Faraday."
},
"timeoutMs": {
"type": "integer",
"minimum": 1,
"default": 5000,
"description": "HTTP timeout in milliseconds."
}
}
}
12 changes: 12 additions & 0 deletions services/infobyte__faraday_v5-22/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "infobyte-faraday-v5-22",
"version": "0.0.0",
"private": true,
"type": "module",
"bin": {
"infobyte-faraday-v5-22": "bin/infobyte-faraday-v5-22.js"
},
"dependencies": {
"@chaitin-ai/octobus-sdk": "^0.5.0"
}
}
114 changes: 114 additions & 0 deletions services/infobyte__faraday_v5-22/proto/infobyte_faraday_v5_22.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
syntax = "proto3";

package InfobyteFaradayV522;

import "google/protobuf/struct.proto";
import "google/protobuf/wrappers.proto";

option go_package = "miner/grpc-service/InfobyteFaradayV522";

service Faraday {
// 获取 Faraday 工作区列表。
rpc ListWorkspaces(ListWorkspacesRequest) returns (ListResponse) {}

// 创建 Faraday 工作区。
rpc CreateWorkspace(CreateWorkspaceRequest) returns (ObjectResponse) {}

// 获取指定工作区的主机列表。
rpc ListHosts(ListHostsRequest) returns (ListResponse) {}

// 在指定工作区创建主机。
rpc CreateHost(CreateHostRequest) returns (ObjectResponse) {}

// 获取指定工作区的漏洞列表。
rpc ListVulnerabilities(ListVulnerabilitiesRequest) returns (ListResponse) {}

// 获取指定工作区的单个漏洞。
rpc GetVulnerability(GetVulnerabilityRequest) returns (ObjectResponse) {}

// 在指定工作区创建漏洞。
rpc CreateVulnerability(CreateVulnerabilityRequest) returns (ObjectResponse) {}
}

message ListWorkspacesRequest {
google.protobuf.BoolValue histogram = 1;
google.protobuf.Int64Value histogram_days = 2;
}

message CreateWorkspaceRequest {
string name = 1;
string description = 2;
string customer = 3;
google.protobuf.BoolValue active = 4;
google.protobuf.BoolValue public = 5;
google.protobuf.Int64Value importance = 6;
google.protobuf.Struct extra_fields = 7;
}

message ListHostsRequest {
string workspace_name = 1;
google.protobuf.BoolValue stats = 2;
}

message CreateHostRequest {
string workspace_name = 1;
string ip = 2;
string description = 3;
string os = 4;
string mac = 5;
google.protobuf.BoolValue owned = 6;
google.protobuf.Int64Value importance = 7;
google.protobuf.ListValue hostnames = 8;
google.protobuf.Struct metadata = 9;
google.protobuf.Struct extra_fields = 10;
}

message ListVulnerabilitiesRequest {
string workspace_name = 1;
}

message GetVulnerabilityRequest {
string workspace_name = 1;
int64 object_id = 2;
}

message CreateVulnerabilityRequest {
string workspace_name = 1;
string name = 2;
string severity = 3;
string type = 4;
string desc = 5;
string data = 6;
string resolution = 7;
string status = 8;
google.protobuf.BoolValue confirmed = 9;
string tool = 10;
string external_id = 11;
google.protobuf.ListValue cve = 12;
google.protobuf.ListValue cwe = 13;
google.protobuf.ListValue refs = 14;
google.protobuf.Struct metadata = 15;
google.protobuf.Value parent = 16;
string parent_type = 17;
string website = 18;
string path = 19;
string method = 20;
string request = 21;
string response = 22;
google.protobuf.Int64Value status_code = 23;
google.protobuf.Struct extra_fields = 24;
}

message ListResponse {
int32 http_status = 1;
string raw_body = 2;
int64 count = 3;
repeated google.protobuf.Value results = 4;
google.protobuf.Value raw_json = 5;
}

message ObjectResponse {
int32 http_status = 1;
string raw_body = 2;
google.protobuf.Value raw_json = 3;
}
23 changes: 23 additions & 0 deletions services/infobyte__faraday_v5-22/secret.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"additionalProperties": true,
"properties": {
"faraday_username": {
"type": "string",
"description": "Faraday username for Basic authentication."
},
"faraday_password": {
"type": "string",
"description": "Faraday password for Basic authentication."
},
"username": {
"type": "string",
"description": "Alias for faraday_username."
},
"password": {
"type": "string",
"description": "Alias for faraday_password."
}
}
}
53 changes: 53 additions & 0 deletions services/infobyte__faraday_v5-22/service.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"schema": "chaitin.octobus.service.v1",
"name": "infobyte-faraday-v5-22",
"displayName": "Faraday v5.22",
"description": "OctoBus package for Faraday v5.22.0 workspace, host, and vulnerability APIs.",
"runtime": {
"mode": "long-running"
},
"proto": {
"roots": [
"proto"
],
"files": [
"proto/infobyte_faraday_v5_22.proto"
]
},
"configSchema": "config.schema.json",
"secretSchema": "secret.schema.json",
"sdk": {
"cli": {
"commands": {
"InfobyteFaradayV522.Faraday/ListWorkspaces": {
"name": "list-workspaces",
"description": "List Faraday workspaces."
},
"InfobyteFaradayV522.Faraday/CreateWorkspace": {
"name": "create-workspace",
"description": "Create a Faraday workspace."
},
"InfobyteFaradayV522.Faraday/ListHosts": {
"name": "list-hosts",
"description": "List Faraday hosts in a workspace."
},
"InfobyteFaradayV522.Faraday/CreateHost": {
"name": "create-host",
"description": "Create a Faraday host in a workspace."
},
"InfobyteFaradayV522.Faraday/ListVulnerabilities": {
"name": "list-vulnerabilities",
"description": "List Faraday vulnerabilities in a workspace."
},
"InfobyteFaradayV522.Faraday/GetVulnerability": {
"name": "get-vulnerability",
"description": "Get one Faraday vulnerability by object ID."
},
"InfobyteFaradayV522.Faraday/CreateVulnerability": {
"name": "create-vulnerability",
"description": "Create a Faraday vulnerability in a workspace."
}
}
}
}
}
Loading
Loading