Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

style(go): gofmt the tree and drop reStructuredText markers from doc comments

Beenu Arora7c1b4865c71b
diff --git a/packages/plugin-sdk-go/aisoc/client.go b/packages/plugin-sdk-go/aisoc/client.go
index 1da47c839..76fda6fd7 100644
--- a/packages/plugin-sdk-go/aisoc/client.go
+++ b/packages/plugin-sdk-go/aisoc/client.go
@@ -33,9 +33,9 @@ func (e *ClientError) Error() string {
// client := aisoc.NewClient(pctx)
// data, err := client.GetCase(ctx, "case-123")
type Client struct {
- base string
- token string
- http *http.Client
+ base string
+ token string
+ http *http.Client
}
// NewClient creates a Client using credentials from the given PluginContext.
diff --git a/packages/plugin-sdk-go/aisoc/connector.go b/packages/plugin-sdk-go/aisoc/connector.go
index 9aeba86a1..4ac4b8c47 100644
--- a/packages/plugin-sdk-go/aisoc/connector.go
+++ b/packages/plugin-sdk-go/aisoc/connector.go
@@ -4,10 +4,10 @@ import "context"
// ConnectorConfig holds per-instance configuration for a connector plugin.
type ConnectorConfig struct {
- ConnectorID string `json:"connector_id"`
- Enabled bool `json:"enabled"`
- PollIntervalSeconds int `json:"poll_interval_seconds"`
- Extra map[string]any `json:"extra,omitempty"`
+ ConnectorID string `json:"connector_id"`
+ Enabled bool `json:"enabled"`
+ PollIntervalSeconds int `json:"poll_interval_seconds"`
+ Extra map[string]any `json:"extra,omitempty"`
}
// Connector is implemented by plugins that ingest events from external data sources.
diff --git a/packages/sdk-go/aisoc/models.go b/packages/sdk-go/aisoc/models.go
index 89da7709c..5376ec167 100644
--- a/packages/sdk-go/aisoc/models.go
+++ b/packages/sdk-go/aisoc/models.go
@@ -18,9 +18,9 @@ const (
type AlertStatus string
const (
- AlertStatusOpen AlertStatus = "open"
- AlertStatusInProgress AlertStatus = "in_progress"
- AlertStatusClosed AlertStatus = "closed"
+ AlertStatusOpen AlertStatus = "open"
+ AlertStatusInProgress AlertStatus = "in_progress"
+ AlertStatusClosed AlertStatus = "closed"
AlertStatusFalsePositive AlertStatus = "false_positive"
)
diff --git a/services/demo-producer/main.go b/services/demo-producer/main.go
index 65e5417aa..c002381ea 100644
--- a/services/demo-producer/main.go
+++ b/services/demo-producer/main.go
@@ -103,16 +103,16 @@ func crowdstrikeEvent(r *rand.Rand) map[string]interface{} {
func defenderEvent(r *rand.Rand) map[string]interface{} {
host := hosts[r.Intn(len(hosts))]
return map[string]interface{}{
- "AlertId": fmt.Sprintf("da%d", r.Int63()),
- "AlertTitle": "Suspicious LSASS access",
- "Severity": severities[r.Intn(len(severities))],
- "Category": "CredentialAccess",
+ "AlertId": fmt.Sprintf("da%d", r.Int63()),
+ "AlertTitle": "Suspicious LSASS access",
+ "Severity": severities[r.Intn(len(severities))],
+ "Category": "CredentialAccess",
"ComputerDnsName": host,
"InitiatedByUser": users[r.Intn(len(users))],
- "FileName": "lsass.exe",
+ "FileName": "lsass.exe",
"DetectionSource": "WindowsDefenderAv",
- "SrcIP": randIP(r),
- "Timestamp": time.Now().UTC().Format(time.RFC3339),
+ "SrcIP": randIP(r),
+ "Timestamp": time.Now().UTC().Format(time.RFC3339),
}
}
@@ -126,9 +126,9 @@ func suricataEvent(r *rand.Rand) map[string]interface{} {
"dest_port": 443,
"proto": "TCP",
"alert": map[string]interface{}{
- "signature": "ET TROJAN Possible Cobalt Strike Beacon",
- "category": "A Network Trojan was Detected",
- "severity": 1,
+ "signature": "ET TROJAN Possible Cobalt Strike Beacon",
+ "category": "A Network Trojan was Detected",
+ "severity": 1,
"signature_id": 2024555,
},
}
@@ -157,27 +157,27 @@ func guarddutyEvent(r *rand.Rand) map[string]interface{} {
func oktaEvent(r *rand.Rand) map[string]interface{} {
return map[string]interface{}{
- "eventType": "user.session.start",
- "published": time.Now().UTC().Format(time.RFC3339),
- "actor": map[string]string{"alternateId": users[r.Intn(len(users))]},
- "client": map[string]interface{}{"ipAddress": randIP(r), "userAgent": map[string]string{"os": "Mac OS X"}},
- "outcome": map[string]string{"result": []string{"SUCCESS", "FAILURE"}[r.Intn(2)]},
- "severity": severities[r.Intn(len(severities))],
+ "eventType": "user.session.start",
+ "published": time.Now().UTC().Format(time.RFC3339),
+ "actor": map[string]string{"alternateId": users[r.Intn(len(users))]},
+ "client": map[string]interface{}{"ipAddress": randIP(r), "userAgent": map[string]string{"os": "Mac OS X"}},
+ "outcome": map[string]string{"result": []string{"SUCCESS", "FAILURE"}[r.Intn(2)]},
+ "severity": severities[r.Intn(len(severities))],
"displayMessage": "User login attempt",
}
}
func splunkEvent(r *rand.Rand) map[string]interface{} {
return map[string]interface{}{
- "_time": time.Now().UTC().Unix(),
+ "_time": time.Now().UTC().Unix(),
"sourcetype": "wineventlog:security",
- "source": "WinEventLog:Security",
- "host": hosts[r.Intn(len(hosts))],
- "EventCode": 4625,
- "message": "An account failed to log on",
- "user": users[r.Intn(len(users))],
- "src_ip": randIP(r),
- "severity": severities[r.Intn(len(severities))],
+ "source": "WinEventLog:Security",
+ "host": hosts[r.Intn(len(hosts))],
+ "EventCode": 4625,
+ "message": "An account failed to log on",
+ "user": users[r.Intn(len(users))],
+ "src_ip": randIP(r),
+ "severity": severities[r.Intn(len(severities))],
}
}
diff --git a/services/enrichment/internal/enricher/commercial.go b/services/enrichment/internal/enricher/commercial.go
index 425d06dbb..26d24ee52 100644
--- a/services/enrichment/internal/enricher/commercial.go
+++ b/services/enrichment/internal/enricher/commercial.go
@@ -92,21 +92,21 @@ func (c *AnomaliClient) configured() bool {
type anomaliResponse struct {
Objects []struct {
- Value string `json:"value"`
- Confidence int `json:"confidence"`
- Severity string `json:"severity"` // low | medium | high | very-high
- Type string `json:"type"`
- Source string `json:"source"`
+ Value string `json:"value"`
+ Confidence int `json:"confidence"`
+ Severity string `json:"severity"` // low | medium | high | very-high
+ Type string `json:"type"`
+ Source string `json:"source"`
Tags []struct {
Name string `json:"name"`
} `json:"tags"`
- Classification string `json:"classification"`
+ Classification string `json:"classification"`
ITypes []string `json:"itype"`
- Country string `json:"country"`
- ASN int64 `json:"asn"`
- Org string `json:"org"`
- ModifiedTS string `json:"modified_ts"`
- CreatedTS string `json:"created_ts"`
+ Country string `json:"country"`
+ ASN int64 `json:"asn"`
+ Org string `json:"org"`
+ ModifiedTS string `json:"modified_ts"`
+ CreatedTS string `json:"created_ts"`
} `json:"objects"`
}
@@ -236,8 +236,8 @@ func (c *XForceClient) configured() bool {
}
type xforceIPReport struct {
- IP string `json:"ip"`
- Score float64 `json:"score"` // 1-10
+ IP string `json:"ip"`
+ Score float64 `json:"score"` // 1-10
Cats map[string]int `json:"cats"`
Geo struct {
Country string `json:"country"`
@@ -286,7 +286,7 @@ func (c *XForceClient) EnrichDomain(ctx context.Context, domain string) (*Enrich
}
var rep struct {
Result struct {
- Score float64 `json:"score"`
+ Score float64 `json:"score"`
Cats map[string]bool `json:"cats"`
} `json:"result"`
}
@@ -356,14 +356,14 @@ type flashpointResponse struct {
} `json:"total"`
Hits []struct {
Source struct {
- Indicator string `json:"indicator"`
- Type string `json:"type"`
- Confidence int `json:"confidence"`
- Tags []string `json:"tags"`
- Categories []string `json:"categories"`
- FirstSeen string `json:"first_observed_at"`
- LastSeen string `json:"last_observed_at"`
- ForumMentions int `json:"forum_mentions"`
+ Indicator string `json:"indicator"`
+ Type string `json:"type"`
+ Confidence int `json:"confidence"`
+ Tags []string `json:"tags"`
+ Categories []string `json:"categories"`
+ FirstSeen string `json:"first_observed_at"`
+ LastSeen string `json:"last_observed_at"`
+ ForumMentions int `json:"forum_mentions"`
Sources []string `json:"sources"`
Excerpt string `json:"excerpt"`
} `json:"_source"`
@@ -490,9 +490,9 @@ type intel471Response struct {
Type string `json:"type"`
Value string `json:"value"`
} `json:"indicator"`
- Confidence string `json:"confidence"` // low | medium | high
+ Confidence string `json:"confidence"` // low | medium | high
MitreTactics []string `json:"mitreTactics"`
- Threat struct {
+ Threat struct {
Type string `json:"type"`
Data struct {
FamilyProfile struct {
@@ -730,9 +730,9 @@ func (c *RiskIQClient) configured() bool {
}
type riskIQReputation struct {
- Score int `json:"score"` // 0-100
+ Score int `json:"score"` // 0-100
Classification string `json:"classification"`
- Rules []struct {
+ Rules []struct {
Name string `json:"name"`
Description string `json:"description"`
Severity int `json:"severity"`
@@ -869,15 +869,15 @@ func (c *CrowdstrikeIntelClient) token(ctx context.Context) (string, error) {
type crowdstrikeIndicator struct {
Resources []struct {
- Indicator string `json:"indicator"`
- Type string `json:"type"`
- MaliciousConfidence string `json:"malicious_confidence"` // high | medium | low | unverified
- PublishedDate int64 `json:"published_date"`
- LastUpdated int64 `json:"last_updated"`
- Actors []string `json:"actors"`
- MalwareFamilies []string `json:"malware_families"`
- KillChains []string `json:"kill_chains"`
- Labels []struct {
+ Indicator string `json:"indicator"`
+ Type string `json:"type"`
+ MaliciousConfidence string `json:"malicious_confidence"` // high | medium | low | unverified
+ PublishedDate int64 `json:"published_date"`
+ LastUpdated int64 `json:"last_updated"`
+ Actors []string `json:"actors"`
+ MalwareFamilies []string `json:"malware_families"`
+ KillChains []string `json:"kill_chains"`
+ Labels []struct {
Name string `json:"name"`
} `json:"labels"`
} `json:"resources"`
diff --git a/services/enrichment/internal/enricher/cyble.go b/services/enrichment/internal/enricher/cyble.go
index b3e5a29d8..c5dec0106 100644
--- a/services/enrichment/internal/enricher/cyble.go
+++ b/services/enrichment/internal/enricher/cyble.go
@@ -6,7 +6,8 @@
// brand-risk signals.
//
// API docs (gated, requires a tenant):
-// https://docs.cyble.com/cyble-vision/api/v2/
+//
+// https://docs.cyble.com/cyble-vision/api/v2/
//
// This client targets the v2 REST surface and degrades gracefully:
// - returns (nil, nil) when no API key is configured
@@ -88,14 +89,14 @@ func (c *CybleClient) configured() bool { return c != nil && c.apiKey != "" }
// cybleIndicatorResponse is the v2 indicator schema (subset).
type cybleIndicatorResponse struct {
Data struct {
- Indicator string `json:"indicator"`
- Type string `json:"type"`
- RiskScore float64 `json:"risk_score"` // 0-100
- Confidence float64 `json:"confidence"` // 0-100
- Reputation int `json:"reputation"` // -100 to 100
- FirstSeen string `json:"first_seen"`
- LastSeen string `json:"last_seen"`
- Verdict string `json:"verdict"` // malicious | suspicious | benign | unknown
+ Indicator string `json:"indicator"`
+ Type string `json:"type"`
+ RiskScore float64 `json:"risk_score"` // 0-100
+ Confidence float64 `json:"confidence"` // 0-100
+ Reputation int `json:"reputation"` // -100 to 100
+ FirstSeen string `json:"first_seen"`
+ LastSeen string `json:"last_seen"`
+ Verdict string `json:"verdict"` // malicious | suspicious | benign | unknown
Categories []string `json:"categories"`
Tags []string `json:"tags"`
Actors []string `json:"threat_actors"`
diff --git a/services/enrichment/internal/enricher/greynoise.go b/services/enrichment/internal/enricher/greynoise.go
index 3d3ce1786..bff05d016 100644
--- a/services/enrichment/internal/enricher/greynoise.go
+++ b/services/enrichment/internal/enricher/greynoise.go
@@ -30,7 +30,7 @@ func NewGreyNoiseClient(apiKey string) *GreyNoiseClient {
type greyNoiseIPResponse struct {
IP string `json:"ip"`
Noise bool `json:"noise"`
- Riot bool `json:"riot"` // benign internet activity
+ Riot bool `json:"riot"` // benign internet activity
Classification string `json:"classification"` // benign, malicious, unknown
Name string `json:"name"`
Link string `json:"link"`
diff --git a/services/enrichment/internal/enricher/mandiant.go b/services/enrichment/internal/enricher/mandiant.go
index 58c2cf80e..413b5e6e7 100644
--- a/services/enrichment/internal/enricher/mandiant.go
+++ b/services/enrichment/internal/enricher/mandiant.go
@@ -99,12 +99,12 @@ func (c *MandiantClient) token(ctx context.Context) (string, error) {
// mandiantIndicator captures the v4 /indicator schema (subset).
type mandiantIndicator struct {
- ID string `json:"id"`
- Type string `json:"type"`
- Value string `json:"value"`
- Mscore int `json:"mscore"` // 0-100
- FirstSeen string `json:"first_seen"`
- LastSeen string `json:"last_seen"`
+ ID string `json:"id"`
+ Type string `json:"type"`
+ Value string `json:"value"`
+ Mscore int `json:"mscore"` // 0-100
+ FirstSeen string `json:"first_seen"`
+ LastSeen string `json:"last_seen"`
ThreatRating struct {
ThreatScore int `json:"threat_score"`
Severity string `json:"severity"`
@@ -116,7 +116,7 @@ type mandiantIndicator struct {
} `json:"attributed_associations"`
Categories []string `json:"categories"`
MISPTags []string `json:"misp"`
- Sources []struct {
+ Sources []struct {
FirstSeen string `json:"first_seen"`
LastSeen string `json:"last_seen"`
OsintURL string `json:"osint_url"`
diff --git a/services/enrichment/internal/enricher/recorded_future.go b/services/enrichment/internal/enricher/recorded_future.go
index 529392c8b..c38041f8c 100644
--- a/services/enrichment/internal/enricher/recorded_future.go
+++ b/services/enrichment/internal/enricher/recorded_future.go
@@ -46,19 +46,19 @@ func (c *RecordedFutureClient) configured() bool { return c != nil && c.apiKey !
type rfResponse struct {
Data struct {
Risk struct {
- Score int `json:"score"` // 0-99
- Criticality int `json:"criticality"` // 0-4
- CriticalityLabel string `json:"criticalityLabel"` // None | Unusual | Suspicious | Malicious | Very Malicious
- RiskString string `json:"riskString"`
- RiskSummary string `json:"riskSummary"`
- Rules int `json:"rules"` // count of triggered rules
- EvidenceDetails []rfEvidenceDetail `json:"evidenceDetails"`
+ Score int `json:"score"` // 0-99
+ Criticality int `json:"criticality"` // 0-4
+ CriticalityLabel string `json:"criticalityLabel"` // None | Unusual | Suspicious | Malicious | Very Malicious
+ RiskString string `json:"riskString"`
+ RiskSummary string `json:"riskSummary"`
+ Rules int `json:"rules"` // count of triggered rules
+ EvidenceDetails []rfEvidenceDetail `json:"evidenceDetails"`
} `json:"risk"`
ThreatLists []struct {
Name string `json:"name"`
Description string `json:"description"`
} `json:"threatLists"`
- IntelCard string `json:"intelCard"`
+ IntelCard string `json:"intelCard"`
Timestamps struct {
FirstSeen string `json:"firstSeen"`
LastSeen string `json:"lastSeen"`
@@ -88,12 +88,12 @@ type rfResponse struct {
}
type rfEvidenceDetail struct {
- Rule string `json:"rule"`
- EvidenceString string `json:"evidenceString"`
- CriticalityLabel string `json:"criticalityLabel"`
- Criticality int `json:"criticality"`
- Timestamp string `json:"timestamp"`
- MitigationString string `json:"mitigationString"`
+ Rule string `json:"rule"`
+ EvidenceString string `json:"evidenceString"`
+ CriticalityLabel string `json:"criticalityLabel"`
+ Criticality int `json:"criticality"`
+ Timestamp string `json:"timestamp"`
+ MitigationString string `json:"mitigationString"`
}
// EnrichIP queries Recorded Future for IP risk + context.
diff --git a/services/enrichment/internal/enricher/types.go b/services/enrichment/internal/enricher/types.go
index 8fb57b2ff..65b270d5c 100644
--- a/services/enrichment/internal/enricher/types.go
+++ b/services/enrichment/internal/enricher/types.go
@@ -37,11 +37,11 @@ type GeoLocation struct {
// PortInfo describes an open port detected by Shodan.
type PortInfo struct {
- Port int `json:"port"`
- Protocol string `json:"protocol"`
- Service string `json:"service,omitempty"`
- Banner string `json:"banner,omitempty"`
- Vulns []string `json:"vulns,omitempty"`
+ Port int `json:"port"`
+ Protocol string `json:"protocol"`
+ Service string `json:"service,omitempty"`
+ Banner string `json:"banner,omitempty"`
+ Vulns []string `json:"vulns,omitempty"`
}
// EnrichmentSource tracks which data sources contributed to enrichment.
@@ -55,44 +55,44 @@ type EnrichmentSource struct {
// DarkWebContext captures dark-web / underground forum mentions
// (Cyble, Flashpoint, Intel 471).
type DarkWebContext struct {
- Mentions int `json:"mentions"`
- Sources []string `json:"sources,omitempty"` // forum / market names
+ Mentions int `json:"mentions"`
+ Sources []string `json:"sources,omitempty"` // forum / market names
FirstSeen *time.Time `json:"first_seen,omitempty"`
LastSeen *time.Time `json:"last_seen,omitempty"`
- Categories []string `json:"categories,omitempty"` // e.g. "ransomware-leak", "credential-dump"
- Excerpt string `json:"excerpt,omitempty"` // redacted snippet
+ Categories []string `json:"categories,omitempty"` // e.g. "ransomware-leak", "credential-dump"
+ Excerpt string `json:"excerpt,omitempty"` // redacted snippet
}
// VulnerabilityRef links an IOC to disclosed vulnerabilities.
type VulnerabilityRef struct {
- CVE string `json:"cve"`
- CVSS float64 `json:"cvss,omitempty"`
- EPSS float64 `json:"epss,omitempty"`
- Exploited bool `json:"exploited"`
- KEV bool `json:"kev"` // CISA Known Exploited Vuln
- Description string `json:"description,omitempty"`
+ CVE string `json:"cve"`
+ CVSS float64 `json:"cvss,omitempty"`
+ EPSS float64 `json:"epss,omitempty"`
+ Exploited bool `json:"exploited"`
+ KEV bool `json:"kev"` // CISA Known Exploited Vuln
+ Description string `json:"description,omitempty"`
}
// BrandRisk surfaces brand-protection signals (Cyble, RiskIQ, DomainTools).
type BrandRisk struct {
- Score int `json:"score"` // 0-100
- LookalikeOf string `json:"lookalike_of,omitempty"`
- Phishing bool `json:"phishing"`
- Defacement bool `json:"defacement"`
- Indicators []string `json:"indicators,omitempty"`
+ Score int `json:"score"` // 0-100
+ LookalikeOf string `json:"lookalike_of,omitempty"`
+ Phishing bool `json:"phishing"`
+ Defacement bool `json:"defacement"`
+ Indicators []string `json:"indicators,omitempty"`
}
// EnrichmentResult is the unified enrichment output for any IOC type.
type EnrichmentResult struct {
IOCType IOCType `json:"ioc_type"`
Value string `json:"value"`
- RiskScore float64 `json:"risk_score"` // 0-100
- Confidence float64 `json:"confidence"` // 0-100
+ RiskScore float64 `json:"risk_score"` // 0-100
+ Confidence float64 `json:"confidence"` // 0-100
MaliciousVotes int `json:"malicious_votes"`
HarmlessVotes int `json:"harmless_votes"`
TotalEngines int `json:"total_engines"`
Tags []string `json:"tags,omitempty"`
- Reputation int `json:"reputation"` // -128 to 127
+ Reputation int `json:"reputation"` // -128 to 127
ThreatCategory string `json:"threat_category,omitempty"`
Classification ThreatClassification `json:"classification"`
GeoLocation *GeoLocation `json:"geo_location,omitempty"`
diff --git a/services/enrichment/internal/enricher/virustotal.go b/services/enrichment/internal/enricher/virustotal.go
index 6e430afc3..76d00f411 100644
--- a/services/enrichment/internal/enricher/virustotal.go
+++ b/services/enrichment/internal/enricher/virustotal.go
@@ -30,13 +30,13 @@ func NewVirusTotalClient(apiKey string) *VirusTotalClient {
}
type vtAttributes struct {
- LastAnalysisStats map[string]int `json:"last_analysis_stats"`
- Reputation int `json:"reputation"`
- Tags []string `json:"tags"`
- Country string `json:"country"`
- ASN int64 `json:"asn"`
- ASOwner string `json:"as_owner"`
- Network string `json:"network"`
+ LastAnalysisStats map[string]int `json:"last_analysis_stats"`
+ Reputation int `json:"reputation"`
+ Tags []string `json:"tags"`
+ Country string `json:"country"`
+ ASN int64 `json:"asn"`
+ ASOwner string `json:"as_owner"`
+ Network string `json:"network"`
LastModificationDate int64 `json:"last_modification_date"`
}
diff --git a/services/ingest/internal/attck/loader.go b/services/ingest/internal/attck/loader.go
index 7c3b558f8..9fee45d05 100644
--- a/services/ingest/internal/attck/loader.go
+++ b/services/ingest/internal/attck/loader.go
@@ -16,8 +16,8 @@ import (
)
const (
- cdnURL = "https://raw.githubusercontent.com/mitre/cti/master/enterprise-attack/enterprise-attack.json"
- cacheTTLHours = 24
+ cdnURL = "https://raw.githubusercontent.com/mitre/cti/master/enterprise-attack/enterprise-attack.json"
+ cacheTTLHours = 24
)
// Technique holds key ATT&CK technique fields.
@@ -32,11 +32,11 @@ type Technique struct {
}
var (
- mu sync.RWMutex
- techniques = map[string]*Technique{}
- tacticMap = map[string]string{} // phase_name → display_name
- loaded bool
- loadedAt time.Time
+ mu sync.RWMutex
+ techniques = map[string]*Technique{}
+ tacticMap = map[string]string{} // phase_name → display_name
+ loaded bool
+ loadedAt time.Time
)
// Loaded returns true if the corpus has been successfully loaded.
diff --git a/services/ingest/internal/config/config.go b/services/ingest/internal/config/config.go
index d308534c1..953761b38 100644
--- a/services/ingest/internal/config/config.go
+++ b/services/ingest/internal/config/config.go
@@ -38,20 +38,20 @@ type Config struct {
// topic with no reader. It remains available as an opt-in export for an
// external consumer; the messages carry an `event_type:
// VULNERABILITY_MATCH` header for exactly that.
- VulnCorrelEnabled bool
- VulnKafkaTopic string // topic for VULNERABILITY_MATCH events
- NvdAPIKey string // optional NVD API key for higher rate limits
+ VulnCorrelEnabled bool
+ VulnKafkaTopic string // topic for VULNERABILITY_MATCH events
+ NvdAPIKey string // optional NVD API key for higher rate limits
// Workstream 6 — universal capture push paths.
// InboxEnabled toggles the /v1/inbox/* routes. Off by default in
// development if no DATABASE_DSN is set, since the inbox store needs
// Postgres to resolve tokens.
- InboxEnabled bool
- InboxTemplatesDir string // path to vendor template YAMLs
+ InboxEnabled bool
+ InboxTemplatesDir string // path to vendor template YAMLs
// InboxMaxBodyBytes caps a single inbox webhook body. Anything
// bigger gets a 413; vendors that page through alerts should batch
// at the source rather than push 50MB at once.
- InboxMaxBodyBytes int64
+ InboxMaxBodyBytes int64
// Per-tenant rate limits on the inbox. /v1/inbox/* is the one route
// deliberately open to the internet, authenticated only by a bearer
// token that lives in a vendor's webhook config, and it previously had
@@ -129,9 +129,9 @@ type Config struct {
//
// SnapshotEnabled toggles the per-event resource config snapshotter.
// When on, every event referencing a resource triggers a (cached)
- // ``get_resource_config`` call on the relevant connector and the
+ // get_resource_config call on the relevant connector and the
// result lands as a versioned :Configuration node connected via
- // ``:CONFIGURED_AS {ts}``. Off by default — the writer still runs,
+ // :CONFIGURED_AS {ts}. Off by default — the writer still runs,
// it just skips the snapshot lookup until the operator opts in.
SnapshotEnabled bool
// SnapshotCacheTTLSecs is the TTL for the Redis-backed config cache.
@@ -139,7 +139,7 @@ type Config struct {
// minute) only do one round-trip to the connector per TTL window.
SnapshotCacheTTLSecs int
// SnapshotProviderURL is the HTTP base URL of the connectors service
- // that serves ``GET /v1/connectors/{id}/resource-config``. The
+ // that serves GET /v1/connectors/{id}/resource-config. The
// snapshotter calls this in lieu of importing the connector code
// directly (the connectors live in Python; the writer is Go).
// Empty disables remote lookups — the snapshotter then only emits
@@ -156,11 +156,11 @@ type Config struct {
func Load() (*Config, error) {
cfg := &Config{
HTTPPort: mustGetEnvInt("HTTP_PORT", 8080),
- // Canonical env var is ``KAFKA_BOOTSTRAP_SERVERS`` (matches
- // ``.env.example`` and docker-compose). ``KAFKA_BROKERS`` is honored
+ // Canonical env var is KAFKA_BOOTSTRAP_SERVERS (matches
+ // .env.example and docker-compose). KAFKA_BROKERS is honored
// as a back-compat alias for older deployments.
- KafkaBrokers: getEnvFallback("KAFKA_BOOTSTRAP_SERVERS", "KAFKA_BROKERS", "localhost:9092"),
- KafkaTopic: getEnv("KAFKA_TOPIC", "aisoc.raw_events"),
+ KafkaBrokers: getEnvFallback("KAFKA_BOOTSTRAP_SERVERS", "KAFKA_BROKERS", "localhost:9092"),
+ KafkaTopic: getEnv("KAFKA_TOPIC", "aisoc.raw_events"),
RedisAddr: getEnv("REDIS_ADDR", "localhost:6379"),
DatabaseDSN: getEnv("DATABASE_DSN", ""),
AttckDataPath: getEnv("ATTCK_DATA_PATH", "/data/enterprise-attack.json"),
@@ -227,9 +227,9 @@ func Load() (*Config, error) {
}
// JWT_SECRET is required outside development-class environments. The
- // previous check exact-matched ``ENV == "development"`` only, so an
- // operator who set ``ENVIRONMENT=development`` (the alias the Python
- // API treats as equivalent) without also setting ``ENV`` would crash
+ // previous check exact-matched ENV == "development" only, so an
+ // operator who set ENVIRONMENT=development (the alias the Python
+ // API treats as equivalent) without also setting ENV would crash
// here even though every other service treated their stack as dev.
// envmode.IsDevRuntime closes that gap.
if cfg.JWTSecret == "" && !envmode.IsDevRuntime() {
diff --git a/services/ingest/internal/config/config_test.go b/services/ingest/internal/config/config_test.go
index ba75ed17b..93fce015c 100644
--- a/services/ingest/internal/config/config_test.go
+++ b/services/ingest/internal/config/config_test.go
@@ -1,6 +1,6 @@
// Package config tests cover the JWT_SECRET dev-mode gate. The
-// pre-H-8 implementation accepted only ``ENV=development``; these
-// cases pin the new behaviour so ``ENVIRONMENT=development`` (the
+// pre-H-8 implementation accepted only ENV=development; these
+// cases pin the new behaviour so ENVIRONMENT=development (the
// alias every other service honours) and the rest of the
// development-class allow-list keep working.
package config
@@ -51,8 +51,8 @@ func TestLoad_DevEnvAllowsMissingJWTSecret(t *testing.T) {
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
// Always clear both names before applying the case so a
- // stale ``ENV=production`` from the parent shell can't
- // swamp the ``ENVIRONMENT`` alias under test.
+ // stale ENV=production from the parent shell can't
+ // swamp the ENVIRONMENT alias under test.
withEnv(t, "ENV", "")
withEnv(t, "ENVIRONMENT", "")
withEnv(t, "JWT_SECRET", "")
@@ -116,7 +116,7 @@ func TestLoad_NonDevEnvWithJWTSecretSucceeds(t *testing.T) {
}
func TestLoad_ENVTakesPrecedenceOverENVIRONMENT(t *testing.T) {
- // If both are set, ``ENV`` wins, matching envmode.Current(). The
+ // If both are set, ENV wins, matching envmode.Current(). The
// pre-H-8 code already had this implicit behaviour because it
// only looked at ENV; the test pins it now that ENVIRONMENT is
// also consulted.
diff --git a/services/ingest/internal/config_snapshot/cache.go b/services/ingest/internal/config_snapshot/cache.go
index 8a317c0fb..688fbb79a 100644
--- a/services/ingest/internal/config_snapshot/cache.go
+++ b/services/ingest/internal/config_snapshot/cache.go
@@ -1,25 +1,25 @@
// cache.go — TTL cache for resource-config lookups.
//
// The snapshotter (snapshotter.go) sits on the graph-flush path. Every event
-// that references a resource may trigger a ``get_resource_config`` round-trip
+// that references a resource may trigger a get_resource_config round-trip
// to the connectors service. In a busy SOC the same EC2 instance, GitHub
// repo, or Okta app shows up in dozens of events per minute; without a cache
// the connectors service would get hammered for the same resource over and
// over.
//
-// Two backends are exposed behind a single ``Cache`` interface:
+// Two backends are exposed behind a single Cache interface:
//
-// - ``RedisCache`` — production. Backed by ``github.com/redis/go-redis/v9``.
+// - RedisCache — production. Backed by github.com/redis/go-redis/v9.
// A failure to connect at construction time is *non-fatal* — we fall
// back to the in-memory cache. The graph writer must NEVER fail because
// Redis is unhealthy.
//
-// - ``MemoryCache`` — tests + the in-process default. Bounded LRU-ish via
-// a simple ``map`` + janitor goroutine. Good enough for single-pod
+// - MemoryCache — tests + the in-process default. Bounded LRU-ish via
+// a simple map + janitor goroutine. Good enough for single-pod
// deployments and for the unit tests here.
//
// Keys collapse the three coordinates that uniquely identify a config
-// snapshot: ``(connector_id, resource_id, ts_bucket)``. The ts is bucketed
+// snapshot: (connector_id, resource_id, ts_bucket). The ts is bucketed
// to the cache TTL so two events 30 seconds apart against the same resource
// hit the same cache slot — that's the whole point of the cache.
//
@@ -87,9 +87,9 @@ type memEntry struct {
expiry time.Time
}
-// NewMemoryCache builds a process-local TTL cache. ``ttl <= 0`` defaults to
+// NewMemoryCache builds a process-local TTL cache. ttl <= 0 defaults to
// 10 minutes. Spawns a janitor goroutine that evicts expired entries every
-// ``ttl/2`` so a quiet pod doesn't grow unbounded.
+// ttl/2 so a quiet pod doesn't grow unbounded.
func NewMemoryCache(ttl time.Duration) *MemoryCache {
if ttl <= 0 {
ttl = 10 * time.Minute
@@ -168,7 +168,7 @@ type RedisCache struct {
}
// RedisConfig wires the Redis client. Address follows the standard
-// ``host:port`` shape; password is optional.
+// host:port shape; password is optional.
type RedisConfig struct {
Addr string
Password string
diff --git a/services/ingest/internal/config_snapshot/snapshotter.go b/services/ingest/internal/config_snapshot/snapshotter.go
index 539e1682b..b25f06b67 100644
--- a/services/ingest/internal/config_snapshot/snapshotter.go
+++ b/services/ingest/internal/config_snapshot/snapshotter.go
@@ -3,7 +3,7 @@
// T1.2 (v8.0) extends the T1.1 ingest-side graph writer: every event that
// names a resource gets the resource's *configuration at event-time*
// attached as a versioned :Configuration node connected via
-// ``:CONFIGURED_AS {ts}``. The whole point is "what did this S3 bucket /
+// :CONFIGURED_AS {ts}. The whole point is "what did this S3 bucket /
// IAM policy / GitHub repo look like the moment the alert fired", which is
// the difference between "the bucket is public NOW" (boring) and "the bucket
// was made public 90 seconds before the data exfil" (incident-defining).
@@ -24,11 +24,11 @@
//
// Two pluggable seams:
//
-// - ``Provider``: how the snapshotter actually fetches the config.
+// - Provider: how the snapshotter actually fetches the config.
// Production wires an HTTP provider that calls the connectors service.
-// Tests wire ``StaticProvider`` with a fixture map.
+// Tests wire StaticProvider with a fixture map.
//
-// - ``Cache``: how snapshots are remembered between events. See cache.go.
+// - Cache: how snapshots are remembered between events. See cache.go.
//
// Failure isolation: a Provider error is logged + the snapshot is skipped.
// The graph writer still upserts the underlying :Resource node, so the
@@ -58,13 +58,13 @@ import (
// ErrNotImplemented is the sentinel returned by Provider implementations
// that don't (yet) support a given connector. Mirrors the Python
-// ``BaseConnector.get_resource_config`` default. The snapshotter treats
+// BaseConnector.get_resource_config default. The snapshotter treats
// this as a soft skip — no error counter, no log spam.
var ErrNotImplemented = errors.New("snapshot: get_resource_config not implemented")
// Provider fetches a resource's configuration at event time.
//
-// Implementations MUST honor ``ctx`` deadlines aggressively: the
+// Implementations MUST honor ctx deadlines aggressively: the
// snapshotter sits on the graph flush path and a slow provider would push
// back on the writer queue.
type Provider interface {
@@ -77,17 +77,17 @@ type Provider interface {
}
// StaticProvider is the test-friendly Provider. Configs are keyed by
-// ``connectorID + resourceID``; entries can be time-ordered to model
+// connectorID + resourceID; entries can be time-ordered to model
// configuration history (the AWS Config-style fixture).
type StaticProvider struct {
// Configs is the per-connector resource config history. The history
- // MUST be sorted by Recorded ascending; ``GetResourceConfig`` returns
+ // MUST be sorted by Recorded ascending; GetResourceConfig returns
// the most recent entry whose Recorded <= ts.
Configs map[string]map[string][]ConfigSnapshot
}
-// ConfigSnapshot is one point-in-time configuration. ``Recorded`` is when
-// the config took effect; ``Data`` is the connector-specific payload.
+// ConfigSnapshot is one point-in-time configuration. Recorded is when
+// the config took effect; Data is the connector-specific payload.
type ConfigSnapshot struct {
Recorded time.Time
Data map[string]interface{}
@@ -162,7 +162,7 @@ type HTTPProvider struct {
Client *http.Client
}
-// NewHTTPProvider constructs the production provider. ``timeout`` caps each
+// NewHTTPProvider constructs the production provider. timeout caps each
// round-trip — defaults to 1.5s if non-positive (matches
// AISOC_SNAPSHOT_PROVIDER_TIMEOUT_MS).
func NewHTTPProvider(baseURL string, timeout time.Duration) *HTTPProvider {
@@ -228,11 +228,11 @@ type Snapshotter struct {
// metrics — atomic counters surfaced for tests and the Prometheus
// collector.
- hits atomic.Uint64
- misses atomic.Uint64
- errors atomic.Uint64
- skipped atomic.Uint64
- attached atomic.Uint64
+ hits atomic.Uint64
+ misses atomic.Uint64
+ errors atomic.Uint64
+ skipped atomic.Uint64
+ attached atomic.Uint64
}
// Config wires the snapshotter at construction time.
@@ -458,7 +458,7 @@ func resourceRefsFromEvent(ev *graph.Event, connectorID string) []resourceRef {
}
// connectorIDForEvent looks at any :Resource / :Repo / :SaaSApp / :User
-// node and returns the ``provider`` property the extractor stamps. That's
+// node and returns the provider property the extractor stamps. That's
// the connector_id the snapshotter dispatches on.
//
// Falls back to the first :Resource's connector hint, or "" if no node
diff --git a/services/ingest/internal/enrichment/shodan.go b/services/ingest/internal/enrichment/shodan.go
index 47b1d9e8f..cd0a379b8 100644
--- a/services/ingest/internal/enrichment/shodan.go
+++ b/services/ingest/internal/enrichment/shodan.go
@@ -41,8 +41,8 @@ type ShodanHost struct {
}
type cacheEntry struct {
- host *ShodanHost
- expiry time.Time
+ host *ShodanHost
+ expiry time.Time
}
// ShodanEnricher looks up IP addresses using the Shodan Internet DB API
diff --git a/services/ingest/internal/enrichment/vuln.go b/services/ingest/internal/enrichment/vuln.go
index dcf3a6eeb..e85822265 100644
--- a/services/ingest/internal/enrichment/vuln.go
+++ b/services/ingest/internal/enrichment/vuln.go
@@ -25,12 +25,12 @@ const (
// VulnMatch is the payload emitted to Kafka when a CVE correlation fires.
type VulnMatch struct {
- EventID string `json:"event_id"`
- SourceIP string `json:"source_ip"`
- CVE string `json:"cve_id"`
- KEVEntry *KevEntry `json:"kev_entry,omitempty"`
- DetectedAt time.Time `json:"detected_at"`
- TenantID string `json:"tenant_id,omitempty"`
+ EventID string `json:"event_id"`
+ SourceIP string `json:"source_ip"`
+ CVE string `json:"cve_id"`
+ KEVEntry *KevEntry `json:"kev_entry,omitempty"`
+ DetectedAt time.Time `json:"detected_at"`
+ TenantID string `json:"tenant_id,omitempty"`
}
// KevEntry represents a single CISA KEV catalogue entry.
diff --git a/services/ingest/internal/envmode/envmode.go b/services/ingest/internal/envmode/envmode.go
index bfc58eae4..6907fab0a 100644
--- a/services/ingest/internal/envmode/envmode.go
+++ b/services/ingest/internal/envmode/envmode.go
@@ -1,15 +1,15 @@
// Package envmode is the Go-side mirror of
-// ``services/api/app/core/config.is_dev_env`` and friends.
+// services/api/app/core/config.is_dev_env and friends.
//
// The same "dev mode" decision is made at multiple layers of the stack
// (Python API, Go ingest, Go enrichment), and the bugs we shipped pre-
// H-8 came from each layer hand-rolling its own slightly-different
// allow-list. This package is the single Go source of truth so a new
-// dev alias (``staging-shadow``, ``preview``, ...) added in one place
+// dev alias (staging-shadow, preview, ...) added in one place
// is visible to every other.
//
// Keep this in sync with
-// ``services/api/app/core/config.DEV_ENVIRONMENTS``.
+// services/api/app/core/config.DEV_ENVIRONMENTS.
package envmode
import (
@@ -17,7 +17,7 @@ import (
"strings"
)
-// devEnvironments mirrors ``DEV_ENVIRONMENTS`` in the Python API
+// devEnvironments mirrors DEV_ENVIRONMENTS in the Python API
// settings. Update both at once if the canonical set changes.
var devEnvironments = map[string]struct{}{
"development": {},
@@ -35,16 +35,16 @@ func Normalize(value string) string {
}
// IsDev reports whether the supplied env name is a development-class
-// environment. Matches Python ``is_dev_env``.
+// environment. Matches Python is_dev_env.
func IsDev(value string) bool {
_, ok := devEnvironments[Normalize(value)]
return ok
}
-// Current reads the live process environment, preferring ``ENV`` and
-// falling back to ``ENVIRONMENT``. The two names are treated as
+// Current reads the live process environment, preferring ENV and
+// falling back to ENVIRONMENT. The two names are treated as
// aliases of each other — the Python settings model reconciles them
-// at boot, but Go services that only consult ``os.Getenv`` need to
+// at boot, but Go services that only consult os.Getenv need to
// see both forms or they will disagree with the API.
func Current() string {
if v := os.Getenv("ENV"); v != "" {
@@ -54,8 +54,8 @@ func Current() string {
}
// IsDevRuntime is the convenience wrapper most callers want:
-// ``IsDev(Current())``. Use this instead of bespoke
-// ``os.Getenv("ENV") == "development"`` checks scattered around the
+// IsDev(Current()). Use this instead of bespoke
+// os.Getenv("ENV") == "development" checks scattered around the
// codebase.
func IsDevRuntime() bool {
return IsDev(Current())
diff --git a/services/ingest/internal/graph/writer.go b/services/ingest/internal/graph/writer.go
index c5877f3a1..11219192a 100644
--- a/services/ingest/internal/graph/writer.go
+++ b/services/ingest/internal/graph/writer.go
@@ -8,13 +8,13 @@
// per flush — this is the idiomatic pattern from Neo4j's own examples
// and avoids holding a session across goroutine boundaries.
//
-// - The hot path (``WriteEvent``) does NOT touch the network. It enqueues
+// - The hot path (WriteEvent) does NOT touch the network. It enqueues
// onto an in-process channel that is drained by a background flusher.
// This is what lets the Kafka consumer pipeline (handler.go) stay snappy
// even when Neo4j stutters.
//
// - Batched upserts use a single UNWIND query per (node-label, batch) and
-// per (edge-type, batch). MERGE is keyed on ``natural_key`` so the same
+// per (edge-type, batch). MERGE is keyed on natural_key so the same
// entity from two different events collapses to one node — critical for
// the graph-as-state-of-the-world invariant.
//
@@ -39,7 +39,7 @@ import (
"github.com/rs/zerolog/log"
)
-// Driver is the subset of neo4j.DriverWithContext that ``Writer`` actually
+// Driver is the subset of neo4j.DriverWithContext that Writer actually
// uses. Defined as an interface so unit tests can plug in a fake without
// running a real Neo4j instance — that's the contract writer_test.go relies
// on.
@@ -71,7 +71,7 @@ type UpdatePublisher interface {
PublishGraphUpdate(ctx context.Context, update GraphUpdate) error
}
-// GraphUpdate is the envelope emitted on ``security.graph_updates`` for
+// GraphUpdate is the envelope emitted on security.graph_updates for
// every node/edge mutation. Downstream consumers subscribe to this topic to
// drive realtime UI without re-querying Neo4j.
type GraphUpdate struct {
@@ -140,12 +140,12 @@ type Writer struct {
rootDone context.CancelFunc
// metrics — small atomic counters surfaced for the Prometheus collector
- mu sync.Mutex
- eventsAccepted uint64
- eventsDropped uint64
- flushErrors uint64
- lastFlushNodes int
- lastFlushEdges int
+ mu sync.Mutex
+ eventsAccepted uint64
+ eventsDropped uint64
+ flushErrors uint64
+ lastFlushNodes int
+ lastFlushEdges int
}
// Config configures Writer.
@@ -303,7 +303,7 @@ func verifyWithRetry(ctx context.Context, driver neo4j.DriverWithContext, window
// newWriterFromDriver is the test-friendly constructor — takes a Driver
// interface so writer_test.go can inject a fake without touching the
-// network. Production code uses ``New``.
+// network. Production code uses New.
func newWriterFromDriver(driver Driver, cfg Config) *Writer {
rootCtx, rootDone := context.WithCancel(context.Background())
w := &Writer{
@@ -582,7 +582,7 @@ SET r += row.props`,
)
}
-// edgeGroup is an internal grouping key for ``flush``.
+// edgeGroup is an internal grouping key for flush.
type edgeGroup struct {
fromLabel NodeLabel
toLabel NodeLabel
@@ -676,7 +676,7 @@ func (w *Writer) Stats() Stats {
}
// hashProperties produces the short stable digest used in the idempotency
-// key. Tied to the v1.0 contract: ``(entity_type, natural_key, hash(properties))``.
+// key. Tied to the v1.0 contract: (entity_type, natural_key, hash(properties)).
func hashProperties(props map[string]interface{}) string {
keys := make([]string, 0, len(props))
for k := range props {
diff --git a/services/ingest/internal/graph_ws/server.go b/services/ingest/internal/graph_ws/server.go
index 43b09c12c..b9eb08b7b 100644
--- a/services/ingest/internal/graph_ws/server.go
+++ b/services/ingest/internal/graph_ws/server.go
@@ -1,7 +1,7 @@
// HTTP upgrade handler for the graph_ws broadcaster (T1.4 — v8.0).
//
// The handler is intentionally minimal: tenant-scoped channels keyed
-// off the ``?tenant_id=<id>`` query param, no auth (auth is enforced
+// off the ?tenant_id=<id> query param, no auth (auth is enforced
// by the Python API proxy at services/api/app/api/v1/endpoints/
// graph_ws.py — this server is expected to listen on the internal
// service network only). Each connection registers a Subscriber with
diff --git a/services/ingest/internal/handler/k8s_audit.go b/services/ingest/internal/handler/k8s_audit.go
index 99756eef5..635883376 100644
--- a/services/ingest/internal/handler/k8s_audit.go
+++ b/services/ingest/internal/handler/k8s_audit.go
@@ -5,11 +5,11 @@
// audit-webhook backend, POSTs batches of v1 audit events to a remote
// HTTP endpoint as a single JSON document of shape:
//
-// {
-// "kind": "EventList",
-// "apiVersion": "audit.k8s.io/v1",
-// "items": [ { ...one Event... }, ... ]
-// }
+// {
+// "kind": "EventList",
+// "apiVersion": "audit.k8s.io/v1",
+// "items": [ { ...one Event... }, ... ]
+// }
//
// The route is `POST /v1/ingest/k8s-audit/{tenant_id}`. We pull tenant
// from the URL (rather than a header) because audit-webhook config in
diff --git a/services/ingest/internal/inbox/apply_test.go b/services/ingest/internal/inbox/apply_test.go
index ffa65ea4a..df789dc3d 100644
--- a/services/ingest/internal/inbox/apply_test.go
+++ b/services/ingest/internal/inbox/apply_test.go
@@ -55,12 +55,12 @@ func TestApply_BasicMapping(t *testing.T) {
tmpl := newTestTemplate()
payload := map[string]any{
"event": map[string]any{
- "id": "INC-12345",
- "title": "prod-db-1: high CPU",
- "urgency": "high",
- "occurred_at": "2026-05-08T12:30:00Z",
- "service": map[string]any{"summary": "production-db"},
- "html_url": "https://acme.pagerduty.com/incidents/INC-12345",
+ "id": "INC-12345",
+ "title": "prod-db-1: high CPU",
+ "urgency": "high",
+ "occurred_at": "2026-05-08T12:30:00Z",
+ "service": map[string]any{"summary": "production-db"},
+ "html_url": "https://acme.pagerduty.com/incidents/INC-12345",
},
}
diff --git a/services/ingest/internal/inbox/handler.go b/services/ingest/internal/inbox/handler.go
index 6d1181171..8f42faa56 100644
--- a/services/ingest/internal/inbox/handler.go
+++ b/services/ingest/internal/inbox/handler.go
@@ -345,8 +345,8 @@ func (h *Handler) readBody(w http.ResponseWriter, r *http.Request, route, templa
// verifyHMACOrFail enforces the optional HMAC-SHA256 signature header
// when the token has hmac_secret set. We accept either:
//
-// X-Signature: sha256=<hex>
-// X-Hub-Signature-256: sha256=<hex> (GitHub-style)
+// X-Signature: sha256=<hex>
+// X-Hub-Signature-256: sha256=<hex> (GitHub-style)
//
// Constant-time comparison protects against timing oracles.
func (h *Handler) verifyHMACOrFail(w http.ResponseWriter, r *http.Request, route string, tok *Token, body []byte) bool {
diff --git a/services/ingest/internal/inbox/store.go b/services/ingest/internal/inbox/store.go
index 0771e0bfe..f64fa47ea 100644
--- a/services/ingest/internal/inbox/store.go
+++ b/services/ingest/internal/inbox/store.go
@@ -1,7 +1,7 @@
// Package inbox is the universal-capture push path (Workstream 6 of the
// AI Stack & Data Integration plan).
//
-// The Python services/api service mints rows in ``tenant_inbox_tokens``
+// The Python services/api service mints rows in tenant_inbox_tokens
// (see migration 033) when an operator clicks "Push (any vendor)" in the
// onboarding wizard. This package is the Go side: it resolves an inbox
// token presented on /v1/inbox/{token} (or /v1/inbox/cef, /v1/inbox/hec,
@@ -12,13 +12,13 @@
// Why direct Postgres access (and not an internal HTTP call to
// services/api)?
//
-// * Hot path. Every webhook from PagerDuty / Opsgenie / Cloudflare
+// - Hot path. Every webhook from PagerDuty / Opsgenie / Cloudflare
// hits this code; one extra cross-service HTTP hop would double our
// ingest latency budget.
-// * The DB is already shared. services/connectors writes connector
+// - The DB is already shared. services/connectors writes connector
// state, services/api reads it back; this is one more table in the
// same schema with the same RLS posture.
-// * Postgres RLS is a hard backstop. The ingest service connects with
+// - Postgres RLS is a hard backstop. The ingest service connects with
// a service-role DSN (BYPASSRLS), but if a future change ever wires
// it through a tenant-scoped pool the policy in migration 033 keeps
// cross-tenant lookups from leaking.
@@ -56,13 +56,13 @@ var (
// template processes its payloads, and (optionally) the HMAC secret used
// to verify the X-Signature header.
type Token struct {
- Token string
- TenantID uuid.UUID
- TemplateID string
- Label string
- HMACSecret string
- CreatedAt time.Time
- LastUsedAt *time.Time
+ Token string
+ TenantID uuid.UUID
+ TemplateID string
+ Label string
+ HMACSecret string
+ CreatedAt time.Time
+ LastUsedAt *time.Time
}
// Store resolves inbox tokens against Postgres with a tiny in-process
@@ -82,9 +82,9 @@ type Store struct {
}
type cachedEntry struct {
- token *Token
- revoked bool // remembered separately so we can fail fast
- expires time.Time
+ token *Token
+ revoked bool // remembered separately so we can fail fast
+ expires time.Time
}
// NewStore wraps a pgx pool with the resolver + cache.
@@ -154,9 +154,9 @@ func (s *Store) Resolve(ctx context.Context, token string) (*Token, error) {
`, token)
var (
- t Token
- revokedAt *time.Time
- lastUsed *time.Time
+ t Token
+ revokedAt *time.Time
+ lastUsed *time.Time
)
err := row.Scan(
&t.Token,
diff --git a/services/ingest/internal/normalizer/normalizer.go b/services/ingest/internal/normalizer/normalizer.go
index c550be40f..44d2759e1 100644
--- a/services/ingest/internal/normalizer/normalizer.go
+++ b/services/ingest/internal/normalizer/normalizer.go
@@ -37,11 +37,11 @@ type OcsfBaseEvent struct {
// OcsfMetadata contains event metadata
type OcsfMetadata struct {
- Version string `json:"version"`
- Product OcsfProduct `json:"product"`
- TenantUID string `json:"tenant_uid,omitempty"`
- IngestedAt string `json:"ingested_time"`
- OriginalAt string `json:"original_time,omitempty"`
+ Version string `json:"version"`
+ Product OcsfProduct `json:"product"`
+ TenantUID string `json:"tenant_uid,omitempty"`
+ IngestedAt string `json:"ingested_time"`
+ OriginalAt string `json:"original_time,omitempty"`
}
// OcsfProduct identifies the source product
@@ -85,10 +85,10 @@ type Normalizer struct {
// connectorProfile defines normalization rules for a connector type
type connectorProfile struct {
- product OcsfProduct
- classUID int
- className string
- fieldMap map[string]string
+ product OcsfProduct
+ classUID int
+ className string
+ fieldMap map[string]string
severityMap map[string]int
}
@@ -113,10 +113,10 @@ var connectorProfiles = map[string]connectorProfile{
classUID: 2002,
className: "Security Finding",
fieldMap: map[string]string{
- "TimeGenerated": "time",
- "AlertName": "message",
+ "TimeGenerated": "time",
+ "AlertName": "message",
"CompromisedEntity": "device.name",
- "Severity": "severity",
+ "Severity": "severity",
},
severityMap: map[string]int{
"High": 4, "Medium": 3, "Low": 2, "Informational": 1,
@@ -160,11 +160,11 @@ var connectorProfiles = map[string]connectorProfile{
classUID: 3002,
className: "Authentication",
fieldMap: map[string]string{
- "published": "time",
- "actor.alternateId": "actor.user.email_addr",
- "actor.displayName": "actor.user.name",
- "client.ipAddress": "src_endpoint.ip",
- "outcome.result": "status",
+ "published": "time",
+ "actor.alternateId": "actor.user.email_addr",
+ "actor.displayName": "actor.user.name",
+ "client.ipAddress": "src_endpoint.ip",
+ "outcome.result": "status",
},
severityMap: map[string]int{
"ERROR": 4, "WARN": 3, "INFO": 1, "DEBUG": 1,
@@ -175,9 +175,9 @@ var connectorProfiles = map[string]connectorProfile{
classUID: 2001,
className: "Security Finding",
fieldMap: map[string]string{
- "UpdatedAt": "time",
- "Title": "message",
- "Description": "raw_data",
+ "UpdatedAt": "time",
+ "Title": "message",
+ "Description": "raw_data",
"Severity.Label": "severity",
},
severityMap: map[string]int{
@@ -286,17 +286,17 @@ var connectorProfiles = map[string]connectorProfile{
classUID: 6003,
className: "API Activity",
fieldMap: map[string]string{
- "auditID": "finding.uid",
- "verb": "activity_name",
- "user.username": "actor.user.name",
- "objectRef.resource": "finding.title",
- "objectRef.namespace": "cloud.account.uid",
- "objectRef.name": "resource.name",
- "sourceIPs.0": "src_endpoint.ip",
- "userAgent": "http_request.user_agent",
- "responseStatus.code": "status_code",
- "stage": "status_detail",
- "stageTimestamp": "time",
+ "auditID": "finding.uid",
+ "verb": "activity_name",
+ "user.username": "actor.user.name",
+ "objectRef.resource": "finding.title",
+ "objectRef.namespace": "cloud.account.uid",
+ "objectRef.name": "resource.name",
+ "sourceIPs.0": "src_endpoint.ip",
+ "userAgent": "http_request.user_agent",
+ "responseStatus.code": "status_code",
+ "stage": "status_detail",
+ "stageTimestamp": "time",
},
severityMap: map[string]int{
"critical": 5, "high": 4, "medium": 3, "low": 2, "info": 1, "informational": 1,
@@ -678,9 +678,9 @@ func (n *Normalizer) Normalize(raw *RawEvent) (*NormalizedEvent, error) {
// Set metadata
ocsf["metadata"] = map[string]interface{}{
- "version": n.version,
- "product": profile.product,
- "tenant_uid": raw.TenantID,
+ "version": n.version,
+ "product": profile.product,
+ "tenant_uid": raw.TenantID,
"ingested_time": time.Now().UTC().Format(time.RFC3339),
}
diff --git a/services/ingest/main.go b/services/ingest/main.go
index 61a0d33ac..e6e24618a 100644
--- a/services/ingest/main.go
+++ b/services/ingest/main.go
@@ -31,8 +31,8 @@ import (
func main() {
// Configure structured logging. Use the human-friendly console writer
// in any dev-class environment (development, dev, local, demo, test) —
- // previously this exact-matched ``ENV == "development"`` only, so
- // ``ENVIRONMENT=development`` (the alias the Python API treats as
+ // previously this exact-matched ENV == "development" only, so
+ // ENVIRONMENT=development (the alias the Python API treats as
// equivalent) silently flipped this service to JSON logs and made
// local debugging confusing. envmode.IsDevRuntime keeps both layers
// in lock-step.
diff --git a/services/osquery-extensions/internal/aisocapi/client.go b/services/osquery-extensions/internal/aisocapi/client.go
index 847c0e3ac..564b804b5 100644
--- a/services/osquery-extensions/internal/aisocapi/client.go
+++ b/services/osquery-extensions/internal/aisocapi/client.go
@@ -15,8 +15,8 @@ import (
// Client talks to the AiSOC API on behalf of the extension.
type Client struct {
- cfg *config.Config
- http *http.Client
+ cfg *config.Config
+ http *http.Client
}
// New returns a Client backed by cfg.
diff --git a/services/osquery-extensions/tables/pending_actions.go b/services/osquery-extensions/tables/pending_actions.go
index 9348d9ade..842813fad 100644
--- a/services/osquery-extensions/tables/pending_actions.go
+++ b/services/osquery-extensions/tables/pending_actions.go
@@ -37,13 +37,13 @@ func PendingActionsGenerate(client *aisocapi.Client) table.GenerateFunc {
for _, a := range actions {
rows = append(rows, map[string]string{
"action_id": a.ActionID,
- "case_id": a.CaseID,
- "action_type": a.ActionType,
- "target": a.Target,
+ "case_id": a.CaseID,
+ "action_type": a.ActionType,
+ "target": a.Target,
"requested_by": a.RequestedBy,
"requested_at": a.RequestedAt,
- "expires_at": a.ExpiresAt,
- "description": a.Description,
+ "expires_at": a.ExpiresAt,
+ "description": a.Description,
})
}
return rows, nil