Go SDK for building integrations with the OpenCTEM security platform.
OpenCTEM SDK provides Go packages for:
- API client for interacting with OpenCTEM API
- Scanner integrations (Semgrep, Trivy, Nuclei, etc.)
- Output formatters (SARIF, JSON)
- Common utilities and helpers
go get github.com/openctemio/sdkpackage main
import (
"context"
"github.com/openctemio/sdk/pkg/client"
)
func main() {
// Create client
c := client.New(
client.WithBaseURL("http://localhost:8080"),
client.WithAPIKey("your-api-key"),
)
// List assets
assets, err := c.Assets().List(context.Background())
if err != nil {
panic(err)
}
// Create finding
finding := &client.Finding{
Title: "SQL Injection",
Severity: "HIGH",
// ...
}
err = c.Findings().Create(context.Background(), finding)
}package main
import (
"github.com/openctemio/sdk/pkg/scanners/semgrep"
"github.com/openctemio/sdk/pkg/handler"
)
func main() {
// Create scanner
scanner := semgrep.New(
semgrep.WithConfig("p/security-audit"),
)
// Run scan
results, err := scanner.Scan(context.Background(), "./src")
if err != nil {
panic(err)
}
// Handle results
h := handler.New(
handler.WithAPIClient(client),
handler.WithOutputFile("results.sarif"),
)
h.Handle(results)
}| Package | Description |
|---|---|
pkg/client |
API client for OpenCTEM API |
pkg/scanners |
Scanner integrations (Semgrep, Trivy, Nuclei, Gitleaks) |
pkg/handler |
Result handlers and output formatters |
pkg/core |
Core types and interfaces |
pkg/errors |
Error types and handling |
pkg/retry |
Retry utilities |
pkg/metrics |
Prometheus metrics |
pkg/health |
Health check utilities |
pkg/transport |
HTTP/gRPC transport |
pkg/credentials |
Credential management |
pkg/connectors |
SCM connectors (GitHub, GitLab) |
pkg/enrichers |
Data enrichment (CVE, NVD) |
See examples/ for complete examples:
- Basic API client usage
- Scanner integration
- CI/CD pipeline integration
- Custom scanner development
# Run tests
go test ./...
# Generate proto files
make proto
# Lint
make lintWe welcome contributions! Please see CONTRIBUTING.md.
- openctemio/api - Backend API
- openctemio/ui - Web UI
- openctemio/agent - Scanning Agent
For advanced features and enterprise support, see OpenCTEM Enterprise.
Apache License 2.0 - see LICENSE.