sdk-go

module
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: GPL-3.0

README

OpenCTEM SDK

Go SDK for building sensors, tools and integrations for the OpenCTEM platform. Product documentation: https://docs.openctem.io.

License Go Go Reference

Overview

OpenCTEM SDK provides Go packages for:

  • pkg/sensorkit: the sensor runtime in one call (identity, connection, heartbeat, commands, durable outbox, per-task tool sandbox, local policy, preflight checks and the config report)
  • pkg/client: the platform protocol client
  • pkg/ctis: the CTIS result types
  • pkg/httpsec: SSRF-safe HTTP clients
  • pkg/conformance: a fake platform and the sensor conformance suite
  • cmd/openctem: openctem tool init|validate|run|test|diff|describe, to scaffold a tool from a capability and check it with the conformance kit (docs/tools/cli.md)

The scanner wrappers (Semgrep, CodeQL, Trivy, Betterleaks, Nuclei and the recon tools) live in the sensor (github.com/openctemio/sensor), not in the SDK. What each package promises is in docs/STABILITY.md; where the SDK is going is in docs/rfcs/sensor-sdk-v2.md.

Installation

go get github.com/openctemio/sdk-go

Upgrading from v0.6 (agent → sensor)

v0.7.0 renames the agent vocabulary to sensor (core.BaseAgent → core.BaseSensor, client.WithAgentID → client.WithSensorID, …). Upgrade your module with the codemod, which rewrites only SDK identifiers, type-safely, then moves you to the new SDK:

go run github.com/openctemio/sdk-go/cmd/sensor-migrate@v0.7.0 -dry-run   # review
go run github.com/openctemio/sdk-go/cmd/sensor-migrate@v0.7.0            # apply

The SDK migrates a sensor's saved credentials by itself. The old setting names (AGENT_ID, AGENT_NAME, AGENT_ALLOW_PRIVATE_TARGETS, API_URL, API_KEY, REGION, PLATFORM_KEY_AUTORENEW, OPENCTEM_SDK_ALLOW_PRIVATE_TARGETS) are no longer read: a sensor refuses to start (exit 2) while one is set and names its replacement. Current SDK releases speak sensor protocol v3 (gRPC over mutual TLS, or HTTPS) and fall back to v2 on a platform without v3; protocol v1 is retired, so they need an OpenCTEM platform from 2026-10 on. See CHANGELOG.md for the full list.

Quick Start

Push a report
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/openctemio/sdk-go/pkg/client"
	"github.com/openctemio/sdk-go/pkg/ctis"
)

func main() {
	c := client.New(&client.Config{
		BaseURL: "https://openctem.example.com", // the API base URL, not the web UI
		APIKey:  os.Getenv("SENSOR_API_KEY"),           // a sensor key from Settings > Sensors
	})
	defer c.Close()

	report := ctis.NewReport()
	report.Tool = &ctis.Tool{Name: "my-scanner", Version: "1.0.0"}
	report.Findings = append(report.Findings, ctis.Finding{
		ID:       "finding-001",
		Type:     ctis.FindingTypeVulnerability,
		Title:    "SQL Injection",
		Severity: ctis.SeverityHigh,
		Location: &ctis.FindingLocation{Path: "src/db.go", StartLine: 42},
	})

	res, err := c.PushFindings(context.Background(), report)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", res)
}

Build a sensor in 30 lines

pkg/sensorkit is the whole sensor runtime in one call. A sensor implements its tools; the kit reads the settings, connects (sensor protocol v2, features negotiated on hello), reports the tools on every heartbeat, waits while the key is rejected, follows the heartbeat doorbell, claims commands into resource-sized slots, delivers results through the durable outbox, renews the API key and drains on SIGTERM.

package main

import (
	"context"
	"time"

	"github.com/openctemio/sdk-go/pkg/core"
	"github.com/openctemio/sdk-go/pkg/sensorkit"
)

var version = "dev"

func main() {
	tool := core.NewBaseScanner(&core.BaseScannerConfig{ // your tool's binary
		Name: "mytool", Binary: "mytool", Capabilities: []string{"sast"},
		DefaultArgs: []string{"scan", "--sarif", "{target}"}, Timeout: 30 * time.Minute,
	})
	kit, err := sensorkit.New(sensorkit.Options{Name: "my-sensor", Version: version})
	sensorkit.Exit(err)    // a clear message and exit code for a bad setting
	kit.AddScanner(tool)   // reported (installed? version?), dispatched, scheduled
	sensorkit.Exit(kit.Run(context.Background())) // blocks; SIGINT/SIGTERM drain
}

Run it with SENSOR_API_URL. Without SENSOR_API_KEY the sensor pairs on first start (an administrator approves it under Sensors > Pair a sensor); with SENSOR_API_KEY (a sensor key from Settings > Sensors) it uses that key. examples/minimal-sensor is a complete one with an in-process tool.

Keep the state directory. A key renewal retires the key the sensor was started with; the renewed key is saved in sensor-credentials.json in the state directory (0600) and used on the next start instead of SENSOR_API_KEY. In a container, mount one data volume at /var/lib/openctem (-v my-sensor-data:/var/lib/openctem; it holds state/, outbox/ and content/, which the kit creates 0700 when missing): without one the kit does not renew, because a recreated container would come back with the retired key. A volume on /var/lib/openctem/state itself works too: a directory counts as persistent when its nearest mount is a real volume. When an administrator regenerates the key and SENSOR_API_KEY is set to the new one, the new key wins. Every heartbeat also carries the process's instance_id, so the platform flags one key running in two places.

Setting Environment (an Options field wins) Default
Platform SENSOR_API_URL, SENSOR_API_KEY, SENSOR_ID required to run commands (exit 2 with what is missing)
Pairing code SENSOR_PAIRING_CODE (XXXX-XXXX, from "expect a sensor"): a sensor with no identity attaches to it on first start; ignored once paired; never logged none: the sensor prints a code to enter in the console
Name SENSOR_NAME sensor-<hostname>
Protocol SENSOR_PROTOCOL = auto, v2 (same; v1 is retired and refused) auto
Transport (protocol v3) SENSOR_TRANSPORT = auto (gRPC over mutual TLS, then HTTPS, then protocol v2), grpc, https, v2 auto
Tool confinement SENSOR_SANDBOX = auto, required, off; SENSOR_SANDBOX_NETWORK = auto (each task in its own network namespace where the host allows user namespaces), required (refuse to start without it), off auto
Key binding SENSOR_KEY_BIND = auto (an API key is replaced by a signing key the sensor makes), off auto
Local policy SENSOR_LOCAL_POLICY (file), SENSOR_ALLOWED_RANGES / SENSOR_ALLOWED_PORTS (shorthand), SENSOR_REQUIRE_LOCAL_POLICY, SENSOR_KILL_SWITCH_FILE /etc/openctem/sensor-policy.yaml
Concurrency cap SENSOR_MAX_JOBS (1-100) none: slots follow CPU, memory and tool cost
Tool allowlist (deprecated) SENSOR_TOOLS (comma-separated): only narrows the installed tools; built-ins (sensorkit.Builtin()) are kept. Use the local policy's tools.allow instead none
Drain grace SENSOR_DRAIN_GRACE (1s-1h) 30s
Scanner priority SENSOR_SCANNER_PRIORITY = low, normal low: scanners at nice +10, lowest best-effort I/O, oom_score_adj 500 (Linux)
Sensor OOM protection SENSOR_PROTECT_FROM_OOM=true|false: the sensor sets its own oom_score_adj to -500 (Linux; needs CAP_SYS_RESOURCE, e.g. docker run --cap-add SYS_RESOURCE; without it, one warning and the sensor runs unprotected). Scanners never inherit it off
Outbox SENSOR_OUTBOX, SENSOR_OUTBOX_DIR, _MAX_BYTES, _MAX_AGE, _KEY_FILE on, /var/lib/openctem/outbox
State (the renewed API key, tool cost history) SENSOR_STATE_DIR /var/lib/openctem/state when writable, else ~/.openctem: mount a persistent volume at /var/lib/openctem
Private CA SENSOR_CA_CERT_FILE (PEM, added to the system roots; trusted for the platform and content downloads, so a TLS-inspecting proxy works) system roots
Template-signing keys SENSOR_TEMPLATE_SIGNING_KEYS (base64 Ed25519 public keys, comma-separated, the tenant's keys from the platform's GET /api/v1/scanner-templates/signing-key): custom templates in a scan run only with a signature one of them verifies none: commands carrying custom templates fail
Proxy to the platform SENSOR_CONTROL_PROXY (URL or direct), else HTTPS_PROXY, HTTP_PROXY, NO_PROXY none
Proxy for content and feeds SENSOR_CONTENT_PROXY (URL or direct), else the platform setting the platform setting
Proxy variables for scanners SENSOR_SCAN_PROXY: inherit (scanners get the sensor's HTTP(S)_PROXY; warned at start) or direct inherit
Key renewal SENSOR_KEY_AUTORENEW=true|false, Options.KeyAutoRenew / NoKeyAutoRenew, Options.CredentialsFile on when the state directory persists (outside a container; inside one, a mounted, non-tmpfs volume), else off
Pre-rename names AGENT_ID, AGENT_NAME, AGENT_ALLOW_PRIVATE_TARGETS and the other removed names refused: the sensor exits 2 and names the replacement; only the -agent-id flag is still applied, with a warning

Plug your own parts in: kit.AddCollector, kit.AddParser (your tool's output format), kit.HandleCommand("type", executor), kit.UseCommandMiddleware(mw, "type") (wrap every command), Options.Content (managed scanner content on the heartbeat), Options.ScanTargetPolicy, Options.AssetResolver, kit.Tools() (more tools or capabilities). The resolvers (ResolveMaxJobs, ResolveOutbox, ResolveProtocol, CheckCredentials, MigrateSettings) are exported for a sensor with its own flags or configuration file. pkg/core stays available for anything the kit does not cover; the sections below describe it.

Writing a sensor: you implement executors; the SDK owns queue, slots, leases and reporting

The platform's queue is authoritative (api RFC-030). A sensor only says what it can run; core.CommandPoller does the rest:

The SDK does How
Slots resource.Manager sizes them from what the sensor may use: CPU cores and memory read from cgroup v2/v1 (quota, cpuset, memory limit) or the host, divided by the learned per-job cost of the sensor's tools (defaults per tool, refined from finished jobs, saved to a small JSON file). An AIMD window halves them after an OOM kill, a timeout or CPU throttling and grows back one slot per window of successes. A configured cap (ManagerConfig.Cap) is an upper bound, never a fixed number.
Claiming Takes a free slot first, polls with limit = free slots, claims nothing while all are busy: no prefetch, so the platform keeps work for sensors that can run it now.
Local queue Orders a batch by class (verify > interactive > scheduled > background) then priority (critical > high > normal > low); at most limits.per_host_concurrency (default 1) held commands touch one host, under the politeness keys the platform sent with the command (host_keys) or, from an older platform, the same keys computed by github.com/openctemio/ctis/politeness; a command over it is left pending, not claimed.
Leases Every heartbeat lists the held command ids (running) for the platform to renew.
Cancel A heartbeat's cancel_command_ids cancels those commands' contexts; they are released, not reported.
Drain Stop or a canceled context stops claiming, gives running commands DrainGrace (30 s) and then cancels them; unstarted and aborted commands are released (POST …/commands/{id}/release; failed with "released: …" on a platform without it) so the platform re-queues them at once. A refused start is never executed.
Reporting The heartbeat carries active_jobs, max_concurrent_jobs (the cap), resources, capacity (slots and per-tool cost) and queue.
poller := core.NewCommandPoller(apiClient, executor, &core.CommandPollerConfig{PollInterval: 30 * time.Second})
poller.SetResourceManager(resource.NewManager(resource.ManagerConfig{
	Cap:       0, // no operator cap: slots follow the resources (up to 64)
	Tools:     []string{"nuclei", "trivy"},
	StateFile: "/var/lib/openctem/tool-costs.json",
	Prober:    &resource.Prober{WorkDir: "/var/lib/openctem"},
}))
poller.SetDoorbell(doorbell)
sensor.SetLoadReporter(poller) // heartbeat: load, resources, capacity, queue, running
go poller.Start(ctx)

An executor that starts processes itself calls core.RecordProcessState(ctx, cmd.ProcessState) after Wait so its CPU time and peak memory teach the cost history (the SDK's exec helpers already do).

Tools: register them, the SDK reports them

The platform does not need to know a sensor's tools: the sensor registers what it runs when it starts, and every heartbeat reports it (api RFC-029 §4.3.1). The platform dispatches by that report, and its administrator can only narrow it.

s := core.NewBaseSensor(cfg, apiClient)
s.AddScanner(myScanner)                 // registered: probed with IsInstalled
executor.SetToolRegistry(s.Tools())     // the executor's scanners and collectors too
s.Tools().Register(core.ToolSpec{       // any other tool, with an optional probe
	Name: "zap", Version: "2.15.0", Capabilities: []string{"dast"},
	Probe: func(ctx context.Context) (bool, string, error) { return zapVersion(ctx) },
	Cost:  &resource.ToolCostHint{Cores: 2, MemBytes: 2 << 30, SecondsPerTarget: 60},
})
s.Tools().AddCapabilities("validate")   // served whatever the tools
s.Tools().Limit(strings.Split(os.Getenv("MY_TOOLS"), ",")...) // optional operator allowlist
  • A tool whose probe fails is reported as not installed and gets no jobs. Installed tools report their version.
  • Probes are cached for 10 minutes (SetProbeTTL, Refresh).
  • Feed the slot sizer the same list: resource.ManagerConfig{Tools: s.Tools().Names(), CostHints: s.Tools().CostHints()}.
  • SetCapabilityReporter replaces the registry with your own reporter.

Write a tool

A tool is a manifest plus a run function (pkg/tool); the sensor runs it out of process, admits its targets against the local policy and checks every record it emits. A simple tool is declared with the builder:

var Dotenv = tool.Define("dotenv", "1.0.0").
	Targets("http_service").
	Produces("finding:misconfiguration").
	Params(tool.StringParam("path").Label("Path").Default("/.env").Pattern("^/")).
	Handle(func(ctx tool.Context, job *tool.Job, emit tool.Emit) error {
		for _, t := range job.Targets() {
			// probe t.URL(job.Param("path").String()) with ctx.HTTP()
			_ = emit.Misconfiguration(t, tool.Issue{RuleID: "dotenv-exposed", Title: ".env is readable", Severity: "high"})
			ctx.TargetDone(t)
		}
		return nil
	}).
	MustBuild()

Add it to a sensor with kit.AddTool(Dotenv) (and adapter.Dispatch(Dotenv) at the top of main) and test it with testkit.Run. The design: docs/rfcs/sensor-sdk-v2.md.

A tool outside the sensor binary is a directory with its tool.yaml descriptor and program, scaffolded and checked with the openctem tool CLI (docs/tools/cli.md) and installed in a directory listed in SENSOR_ADAPTER_DIRS. Either way:

  • The descriptor's config is the tool's settings schema, in the closed subset of JSON Schema defined by github.com/openctemio/ctis/settings (Params of the builder write it). The platform validates administrators' values with the same package, sends them inside the signed job (settings_layers), and the sensor resolves them against the schema before every task.
  • The sensor manifest reports each tool's contract with its full descriptor (core.ToolContract, tool.Manifest.Contract). A tool reported with a valid contract joins the organization's tool catalog on the platform, with no platform change.
  • The platform assigns tier and trust: a tool it does not know as built into the released sensor runs as unverified, T2.

The full guide: Writing a tool.

Packages

What the SDK promises, what is stable, what is moving to the sensor, and how it grows without breaking sensors: docs/STABILITY.md.

Package Description
pkg/client API client for OpenCTEM API
pkg/sensorkit The sensor runtime in one call: settings, connection, heartbeat, commands, outbox, key renewal, drain
pkg/core Core types and interfaces
pkg/tool The tool contract: manifest, run function, emitter, Define builder
pkg/testkit Run a tool in-process with the runtime's rules
pkg/conformance Fake platform and the sensor and tool conformance suites
pkg/errors Error types and handling
pkg/retry Retry utilities
pkg/metrics Prometheus metrics
pkg/health Health check utilities
pkg/transport/grpc Deprecated gRPC transport (no platform serves it; removal planned)
pkg/httpsec Hardened HTTP client (SafeHTTPClient) with SSRF protection
pkg/credentials Credential management
pkg/connectors Deprecated SCM connector base (GitHub)
pkg/enrichers Deprecated EPSS and KEV enrichers (the platform enriches findings)
pkg/audit Structured audit logging for sensor operations
pkg/platform Credentials file and key renewal used by sensorkit
pkg/sensorproto/legacyv1 Migration of pre-sensor settings and credentials (frozen)
pkg/ctis CTIS (CTEM Ingest Schema) types, re-exported from github.com/openctemio/ctis

Examples

See examples/ for complete examples:

Building

# Run tests
make test        # or: go test ./...

# Lint
make lint

Documentation

Contributing

Contributions are welcome: see CONTRIBUTING.md.

Security

Report vulnerabilities privately: see SECURITY.md.

  • openctemio/openctem - the platform: API (api/) and web console (web/), formerly openctemio/api and openctemio/ui
  • openctemio/sensor - the OpenCTEM sensor (binary openctemio-sensor, image ghcr.io/openctemio/sensor)

License

GNU General Public License v3.0; see LICENSE.

Directories

Path Synopsis
cmd
openctem command
Command openctem is the OpenCTEM developer CLI.
Command openctem is the OpenCTEM developer CLI.
openctem-conformance command
Command openctem-conformance checks a tool written in any language against adapter protocol v1 and its contract, the way a sensor will run it.
Command openctem-conformance checks a tool written in any language against adapter protocol v1 and its contract, the way a sensor will run it.
sensor-migrate command
Command sensor-migrate upgrades a Go module from the SDK's pre-sensor API (sdk-go v0.6 and older: core.BaseAgent, client.WithAgentID, platform.AgentCredentials, ...) to the sensor API (RFC-023 §9.5).
Command sensor-migrate upgrades a Go module from the SDK's pre-sensor API (sdk-go v0.6 and older: core.BaseAgent, client.WithAgentID, platform.AgentCredentials, ...) to the sensor API (RFC-023 §9.5).
examples
custom-adapter command
Example: converting a tool's SARIF output to CTIS
Example: converting a tool's SARIF output to CTIS
custom-connector command
Example: Building a Custom Connector
Example: Building a Custom Connector
custom-provider command
Example: Using the GitHub Provider
Example: Using the GitHub Provider
custom-scanner command
Example: Custom Scanner Implementation
Example: Custom Scanner Implementation
integration-test command
Package main provides an integration test example for the OpenCTEM SDK.
Package main provides an integration test example for the OpenCTEM SDK.
minimal-sensor command
Example: a complete OpenCTEM sensor in one file.
Example: a complete OpenCTEM sensor in one file.
internal
sensorrename
Package sensorrename is the type-aware "agent" -> "sensor" rename shared by the SDK's own rename script (scripts/rename/sensorrename) and the codemod third parties run on their code (cmd/sensor-migrate).
Package sensorrename is the type-aware "agent" -> "sensor" rename shared by the SDK's own rename script (scripts/rename/sensorrename) and the codemod third parties run on their code (cmd/sensor-migrate).
toolcli
Package toolcli is the "openctem tool" command: scaffold, validate, run, test, diff and describe a tool.
Package toolcli is the "openctem tool" command: scaffold, validate, run, test, diff and describe a tool.
toolrt
Package toolrt holds the rules every tool's output passes, shared by the tool side (pkg/tool/adapter, pkg/testkit) and the runtime side (pkg/sensorkit/toolhost): record validation against CTIS and the manifest's produces, sanitization, size and count caps, report assembly and provenance stamping.
Package toolrt holds the rules every tool's output passes, shared by the tool side (pkg/tool/adapter, pkg/testkit) and the runtime side (pkg/sensorkit/toolhost): record validation against CTIS and the manifest's produces, sanitization, size and count caps, report assembly and provenance stamping.
tools/apitiers command
Command apitiers prints the stability tier of every public package of a module tree, from its package documentation (docs/STABILITY.md):
Command apitiers prints the stability tier of every public package of a module tree, from its package documentation (docs/STABILITY.md):
toolwire
Package toolwire holds the messages of adapter protocol v1: newline- delimited JSON between the runtime and a tool process, over the tool's stdin and stdout, one task per process (docs/rfcs/sensor-sdk-v2.md, D.4.2).
Package toolwire holds the messages of adapter protocol v1: newline- delimited JSON between the runtime and a tool process, over the tool's stdin and stdout, one task per process (docs/rfcs/sensor-sdk-v2.md, D.4.2).
pkg
adapt
Package adapt holds the sensor's adaptive controllers and the one table of their bounds (RFC-074 in openctemio/openctem api/docs/rfcs, RFC-074-adaptive-sensor-control.md).
Package adapt holds the sensor's adaptive controllers and the one table of their bounds (RFC-074 in openctemio/openctem api/docs/rfcs, RFC-074-adaptive-sensor-control.md).
audit
Package audit provides structured audit logging for sensor operations.
Package audit provides structured audit logging for sensor operations.
blobsig
Package blobsig verifies a sigstore (cosign keyless) signature of a downloaded file, offline: the certificate chains to the Sigstore public good Fulcio roots, the signature is in the Rekor transparency log (the inclusion proof and signed timestamp travel in the bundle), and the certificate names exactly the signer the caller expects (OIDC issuer and subject, for a GitHub workflow its file and ref).
Package blobsig verifies a sigstore (cosign keyless) signature of a downloaded file, offline: the certificate chains to the Sigstore public good Fulcio roots, the signature is in the Rekor transparency log (the inclusion proof and signed timestamp travel in the bundle), and the certificate names exactly the signer the caller expects (OIDC issuer and subject, for a GitHub workflow its file and ref).
chunk
Package chunk splits a large CTIS report into protocol v2 segments (api RFC-026 §3.5): SplitSegments returns complete CTIS documents, each with the report's tool and metadata and the assets its findings reference, within the platform's per-segment limits.
Package chunk splits a large CTIS report into protocol v2 segments (api RFC-026 §3.5): SplitSegments returns complete CTIS documents, each with the report's tool and metadata and the assets its findings reference, within the platform's per-segment limits.
client
Package client provides the OpenCTEM API client.
Package client provides the OpenCTEM API client.
compress
Package compress provides compression utilities for large payloads.
Package compress provides compression utilities for large payloads.
conformance
Package conformance is the sensor protocol conformance suite (RFC-026 WP-S3, RFC-023 D23), starting with results ingest.
Package conformance is the sensor protocol conformance suite (RFC-026 WP-S3, RFC-023 D23), starting with results ingest.
connectors
Package connectors provides base implementations and utilities for external system connectors.
Package connectors provides base implementations and utilities for external system connectors.
connectors/github
Package github provides a GitHub connector for the OpenCTEM SDK.
Package github provides a GitHub connector for the OpenCTEM SDK.
core
Package core provides the core interfaces and base implementations for the OpenCTEM Scanner SDK.
Package core provides the core interfaces and base implementations for the OpenCTEM Scanner SDK.
credentials
Package credentials provides credential management for the OpenCTEM SDK.
Package credentials provides credential management for the OpenCTEM SDK.
ctis
Package ctis is the SDK's name for the CTIS data model (github.com/openctemio/ctis).
Package ctis is the SDK's name for the CTIS data model (github.com/openctemio/ctis).
ctis/internal/genalias command
Command genalias writes pkg/ctis/zz_generated_aliases.go: one type alias, constant, variable or wrapper function in package ctis for every exported identifier of the root package of github.com/openctemio/ctis, at the version go.mod requires.
Command genalias writes pkg/ctis/zz_generated_aliases.go: one type alias, constant, variable or wrapper function in package ctis for every exported identifier of the root package of github.com/openctemio/ctis, at the version go.mod requires.
enrichers/epss
Package epss provides EPSS (Exploit Prediction Scoring System) enrichment for CVEs.
Package epss provides EPSS (Exploit Prediction Scoring System) enrichment for CVEs.
enrichers/kev
Package kev provides KEV (Known Exploited Vulnerabilities) enrichment.
Package kev provides KEV (Known Exploited Vulnerabilities) enrichment.
errors
Package errors provides custom error types for the OpenCTEM SDK.
Package errors provides custom error types for the OpenCTEM SDK.
gitenv
Package gitenv provides auto-detection and abstraction for CI/CD environments.
Package gitenv provides auto-detection and abstraction for CI/CD environments.
health
Package health provides health check endpoints for the OpenCTEM SDK.
Package health provides health check endpoints for the OpenCTEM SDK.
httpsec
Package httpsec provides SSRF-safe URL validation and HTTP client construction for the OpenCTEM SDK.
Package httpsec provides SSRF-safe URL validation and HTTP client construction for the OpenCTEM SDK.
importtool
Package importtool is the file importer as a parser-class tool of the tool contract (pkg/tool): it converts files other security tools export (Nessus v2 XML, Qualys detection XML with its KnowledgeBase, DefectDojo Generic Findings JSON, CycloneDX, SPDX, osv-scanner results, CSAF and OpenVEX) into CTIS with the ctis importer package, so the conversion runs in the tool sandbox of a sensor instead of on the platform.
Package importtool is the file importer as a parser-class tool of the tool contract (pkg/tool): it converts files other security tools export (Nessus v2 XML, Qualys detection XML with its KnowledgeBase, DefectDojo Generic Findings JSON, CycloneDX, SPDX, osv-scanner results, CSAF and OpenVEX) into CTIS with the ctis importer package, so the conversion runs in the tool sandbox of a sensor instead of on the platform.
internal/absname
Package absname makes a target name absolute (a trailing dot) for the SDK's own lookups.
Package absname makes a target name absolute (a trailing dot) for the SDK's own lookups.
internal/assetctx
Package assetctx gives the SDK's converters the asset their findings belong to.
Package assetctx gives the SDK's converters the asset their findings belong to.
internal/cirepo
Package cirepo reads the repository a CI job is building from the CI environment (GitHub Actions, GitLab CI), for converters that must name the repository their findings belong to when the caller did not.
Package cirepo reads the repository a CI job is building from the CI environment (GitHub Actions, GitLab CI), for converters that must name the repository their findings belong to when the caller did not.
jobsig
Package jobsig verifies signed jobs on the sensor (api docs/rfcs/RFC-040-platform-sensor-mutual-distrust.md §5.6; wire format in api docs/architecture/job-signing.md).
Package jobsig verifies signed jobs on the sensor (api docs/rfcs/RFC-040-platform-sensor-mutual-distrust.md §5.6; wire format in api docs/architecture/job-signing.md).
metrics
Package metrics provides metrics collection and reporting for the OpenCTEM SDK.
Package metrics provides metrics collection and reporting for the OpenCTEM SDK.
mocks
Package mocks provides mock implementations for testing.
Package mocks provides mock implementations for testing.
netctx
Package netctx is a sensor's network self-description: what the host owner declares (site, routes it reaches, DNS suffixes, internet mode), what the SDK detects on the host (interfaces, routes, resolvers, the egress path to the platform) and a fingerprint that changes when the sensor moves.
Package netctx is a sensor's network self-description: what the host owner declares (site, routes it reaches, DNS suffixes, internet mode), what the SDK detects on the host (interfaces, routes, resolvers, the egress path to the platform) and a fingerprint that changes when the sensor moves.
options
Package options provides functional options pattern for SDK configuration.
Package options provides functional options pattern for SDK configuration.
outbox
Package outbox is the sensor's durable, write-ahead queue of results waiting for the platform.
Package outbox is the sensor's durable, write-ahead queue of results waiting for the platform.
pipeline
Package pipeline provides async pipeline for separating scan and upload.
Package pipeline provides async pipeline for separating scan and upload.
platform
Package platform provides components for running sensors in platform mode.
Package platform provides components for running sensors in platform mode.
providers/github
Package github provides a GitHub provider for the OpenCTEM SDK.
Package github provides a GitHub provider for the OpenCTEM SDK.
reach
Package reach tells, per target, whether this sensor got a path to it, and summarizes it on the job result so the platform can tell "nothing found" from "not reached" and route the next job to a sensor that can reach the target (RFC-089 in openctemio/openctem, api/docs/rfcs).
Package reach tells, per target, whether this sensor got a path to it, and summarizes it on the job result so the platform can tell "nothing found" from "not reached" and route the next job to a sensor that can reach the target (RFC-089 in openctemio/openctem, api/docs/rfcs).
resource
Package resource provides system resource monitoring and control.
Package resource provides system resource monitoring and control.
retry
Package retry provides persistent retry queue functionality for failed API operations.
Package retry provides persistent retry queue functionality for failed API operations.
scopelimit
Package scopelimit is the port, protocol and path limits of a job's targets (api docs/rfcs/RFC-065-bug-bounty-programs.md §16.8): a target the organization's scope covers only through a port-limited entry ("api.example.com:8443/tcp") or a path-limited URL entry ("https://example.com/api/") may be scanned only on those ports and under that path.
Package scopelimit is the port, protocol and path limits of a job's targets (api docs/rfcs/RFC-065-bug-bounty-programs.md §16.8): a target the organization's scope covers only through a port-limited entry ("api.example.com:8443/tcp") or a path-limited URL entry ("https://example.com/api/") may be scanned only on those ports and under that path.
sdk
Package sdk identifies this SDK: its name and release version.
Package sdk identifies this SDK: its name and release version.
sensorkit
Package sensorkit is everything a sensor needs to work with the OpenCTEM platform, in one call: a sensor implements its tools, the kit runs the rest.
Package sensorkit is everything a sensor needs to work with the OpenCTEM platform, in one call: a sensor implements its tools, the kit runs the rest.
sensorkit/contentcache
Package contentcache is the sensor's cache of content packs (api docs/rfcs/RFC-061-content-packs.md §3.4): immutable archives of templates, rules and wordlists, addressed by their sha256 digest and signed by the platform.
Package contentcache is the sensor's cache of content packs (api docs/rfcs/RFC-061-content-packs.md §3.4): immutable archives of templates, rules and wordlists, addressed by their sha256 digest and signed by the platform.
sensorkit/egress
Package egress is a task's way out to the network: a forwarder that every connection of a confined tool goes through (RFC-060 in openctemio/openctem api/docs/rfcs; the forwarder RFC-034 designs for proxied zones is the same one).
Package egress is a task's way out to the network: a forwarder that every connection of a confined tool goes through (RFC-060 in openctemio/openctem api/docs/rfcs; the forwarder RFC-034 designs for proxied zones is the same one).
sensorkit/executor
Package executor runs one task (one tool invocation) for a sensor, in a sandbox.
Package executor runs one task (one tool invocation) for a sensor, in a sandbox.
sensorkit/identity
Package identity is a key-bound sensor's identity on disk and the interactive pairing that creates it (api RFC-052): the sensor makes its own Ed25519 key, pairs with the platform (an administrator compares the short authentication string and approves), and from then on signs every request with that key.
Package identity is a key-bound sensor's identity on disk and the interactive pairing that creates it (api RFC-052): the sensor makes its own Ed25519 key, pairs with the platform (an administrator compares the short authentication string and approves), and from then on signs every request with that key.
sensorkit/settings
Package settings is the sensor settings registry: every setting a sensor reads, declared once with its name, type, whether it is required, its default, whether it is a secret, a description, a docs link and a validation.
Package settings is the sensor settings registry: every setting a sensor reads, declared once with its name, type, whether it is required, its default, whether it is a secret, a description, a docs link and a validation.
sensorkit/toolhost
Package toolhost is the runtime side of the tool contract: it runs one task of a tool (pkg/tool) out of process, inside the Executor sandbox (pkg/sensorkit/executor), and turns what the tool reports into a checked, stamped CTIS report.
Package toolhost is the runtime side of the tool contract: it runs one task of a tool (pkg/tool) out of process, inside the Executor sandbox (pkg/sensorkit/executor), and turns what the tool reports into a checked, stamped CTIS report.
sensorproto/legacyv1
Package legacyv1 is the only place the SDK still spells the pre-sensor "agent" vocabulary (RFC-023 §9.5).
Package legacyv1 is the only place the SDK still spells the pre-sensor "agent" vocabulary (RFC-023 §9.5).
sensorproto/pairing
Package pairing is the interactive sensor pairing protocol (api RFC-052): a sensor that has only the platform URL creates its own Ed25519 key, asks the platform to pair, and an administrator approves it after comparing a short authentication string (SAS) shown on both sides.
Package pairing is the interactive sensor pairing protocol (api RFC-052): a sensor that has only the platform URL creates its own Ed25519 key, asks the platform to pair, and an administrator approves it after comparing a short authentication string (SAS) shown on both sides.
sensorproto/v2
Package v2 is the client side of sensor protocol v2 results ingest (RFC-026, api docs/rfcs/RFC-026-sensor-results-ingest.md): the paths, media type, headers, problem types, status resource, hello document and the Content-Digest the SDK sends.
Package v2 is the client side of sensor protocol v2 results ingest (RFC-026, api docs/rfcs/RFC-026-sensor-results-ingest.md): the paths, media type, headers, problem types, status resource, hello document and the Content-Digest the SDK sends.
sensorproto/v3
Package sensorv3 is the generated Go code of sensor protocol v3 (openctem api RFC-059), from proto/sensor-v3, a byte-for-byte copy of the platform's proto.
Package sensorv3 is the generated Go code of sensor protocol v3 (openctem api RFC-059), from proto/sensor-v3, a byte-for-byte copy of the platform's proto.
sensorproto/v3/sensorv3connect
Package sensorv3connect is the generated Connect (gRPC, gRPC-Web, Connect) client and handler of sensor protocol v3 (openctem api RFC-059).
Package sensorv3connect is the generated Connect (gRPC, gRPC-Web, Connect) client and handler of sensor protocol v3 (openctem api RFC-059).
sensorsig
Package sensorsig is the HTTP message signature profile a key-bound sensor uses on every platform request (api RFC-032 E5, api RFC-052): RFC 9421 signatures with the sensor's Ed25519 key and an RFC 9530 Content-Digest over the body.
Package sensorsig is the HTTP message signature profile a key-bound sensor uses on every platform request (api RFC-032 E5, api RFC-052): RFC 9421 signatures with the sensor's Ed25519 key and an RFC 9530 Content-Digest over the body.
shared/fingerprint
Package fingerprint provides unified fingerprint generation algorithms for deduplication of security findings across SDK and Backend.
Package fingerprint provides unified fingerprint generation algorithms for deduplication of security findings across SDK and Backend.
shared/severity
Package severity provides unified severity level definitions and mappings for security findings across SDK and Backend.
Package severity provides unified severity level definitions and mappings for security findings across SDK and Backend.
source
Package source fetches the code of a platform code scan: exactly one commit of one repository (ctis source.Repository), read-only, into a private directory a scanner then reads.
Package source fetches the code of a platform code scan: exactly one commit of one repository (ctis source.Repository), read-only, into a private directory a scanner then reads.
testkit
Package testkit runs a tool (pkg/tool) in-process for tests, with the rules the runtime applies in production: the manifest must be valid, the configuration must match its schema, only declared credentials are delivered, every record is checked (CTIS validity, declared output types, size and count limits, control characters), and the report is assembled and stamped as the runtime does.
Package testkit runs a tool (pkg/tool) in-process for tests, with the rules the runtime applies in production: the manifest must be valid, the configuration must match its schema, only declared credentials are delivered, every record is checked (CTIS validity, declared output types, size and count limits, control characters), and the report is assembled and stamped as the runtime does.
tool
Package tool is the one contract for every workload a sensor runs: a target scanner, a connector to a vendor API, a parser of a file or an enricher of findings.
Package tool is the one contract for every workload a sensor runs: a target scanner, a connector to a vendor API, a parser of a file or an enricher of findings.
tool/adapter
Package adapter runs a tool (pkg/tool) as an adapter process: the tool's side of adapter protocol v1, newline-delimited JSON on stdin and stdout, one task per process (docs/rfcs/sensor-sdk-v2.md, D.4.2).
Package adapter runs a tool (pkg/tool) as an adapter process: the tool's side of adapter protocol v1, newline-delimited JSON on stdin and stdout, one task per process (docs/rfcs/sensor-sdk-v2.md, D.4.2).
tool/toolcompat
Package toolcompat runs code written against the older interfaces (core.Scanner, core.Collector) as tools of the tool contract (pkg/tool), so it gets the contract's runtime without a rewrite: out-of-process execution in the task sandbox, admission against the policy, declared credentials only, checked and stamped output.
Package toolcompat runs code written against the older interfaces (core.Scanner, core.Collector) as tools of the tool contract (pkg/tool), so it gets the contract's runtime without a rewrite: out-of-process execution in the task sandbox, admission against the policy, declared credentials only, checked and stamped output.
transport/grpc
Package grpc provides a gRPC transport layer for the OpenCTEM SDK client.
Package grpc provides a gRPC transport layer for the OpenCTEM SDK client.
useragent
Package useragent builds the User-Agent the SDK sends to the platform and to the services its collectors and enrichers call:
Package useragent builds the User-Agent the SDK sends to the platform and to the services its collectors and enrichers call:
webscope
Package webscope is the web scope of a job: which hosts, paths and methods a web tool (a crawler, a DAST scanner) may request.
Package webscope is the web scope of a job: which hosts, paths and methods a web tool (a crawler, a DAST scanner) may request.
politeness module
scripts
rename/sensorrename command
Command sensorrename performs the type-aware "agent" -> "sensor" rename of the SDK's own Go code (RFC-023 §9.5).
Command sensorrename performs the type-aware "agent" -> "sensor" rename of the SDK's own Go code (RFC-023 §9.5).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL