Documentation
¶
Overview ¶
Package exposurebridge promotes internal findings that represent an EXPOSURE rather than a code vulnerability into the Exposure Register (the exposure event store), so they show up in the Exposures view continuously — realizing the CTEM Discovery "exposure ≠ vulnerability" principle. Two projections:
- secret-scan findings (gitleaks, trufflehog, ...) → credential_leaked events, so a hardcoded secret is tracked continuously, not only when a breach dump is manually imported;
- misconfiguration findings (IaC/CSPM: Checkov, Tfsec, cloud posture) → misconfiguration events.
Both are typed projections over existing findings that reuse the exposure domain + repository and mirror the dedupe/reactivate behavior of the credential-import service — NOT a separate event table.
The provenance is labeled distinctly: these events carry discovery_source="secret_scan" and source="secret_scan", which is NOT the same as an externally-leaked credential imported from a breach feed (those keep their import source string). An in-repo hardcoded secret and an externally-leaked credential are both credential_leaked events, but the discovery channel is preserved so the UI/reporting can tell them apart.
It reuses the exposure domain + repository and mirrors the dedupe/reactivate behavior of the credential-import service (see internal/app/integration/credential_import.go): a re-scan finding the same secret updates the existing event's last_seen (reactivating it if it was resolved) instead of creating a duplicate. The raw secret value is never persisted — only the finding's already-masked value is carried.
Index ¶
Constants ¶
const SourceMisconfigScan = "misconfig_scan"
SourceMisconfigScan is the provenance label for exposures projected from misconfiguration findings (IaC/CSPM: Checkov, Tfsec, Trivy config, cloud posture). A misconfiguration is an exposure that is NOT a CVE — the CTEM Discovery "exposure ≠ vulnerability" principle — so it belongs in the Exposure Register alongside leaked credentials.
const SourceReconScan = "recon_scan"
SourceReconScan is the provenance label carried on both the exposure event source column and the discovery_source detail for exposures projected from recon-discovered assets (open ports, exposed services, TLS certificates). It marks the event as an INTERNAL attack-surface discovery, distinct from a manual bulk-ingest of exposures or an external breach import.
const SourceSecretScan = "secret_scan"
SourceSecretScan is the provenance label carried on both the exposure event source column and the discovery_source detail. It marks the event as an INTERNAL secret-scan discovery, distinct from an external breach import.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetBridge ¶ added in v0.7.0
type AssetBridge struct {
// contains filtered or unexported fields
}
AssetBridge projects recon-discovered ASSETS (open ports, exposed services, TLS certificates) into the Exposure Register as first-class exposure events, realizing the CTEM Discovery "exposure ≠ vulnerability" principle for the attack-surface facts that today land only as assets. It mirrors the finding-side Bridge: typed projections over existing signals, reusing the exposure domain + repository and the shared dedupe/reactivate helper — NOT a separate event table.
The event types it emits (port_open, service_detected, certificate_expiring, certificate_expired, ssl_issue) were defined in the exposure vocabulary but had no producer until now. It is best-effort: a failure here must never fail asset ingest.
func NewAssetBridge ¶ added in v0.7.0
func NewAssetBridge( exposureRepo exposure.Repository, historyRepo exposure.StateHistoryRepository, log *logger.Logger, ) *AssetBridge
NewAssetBridge creates an AssetBridge. historyRepo may be nil (state-change history is then simply not recorded).
func (*AssetBridge) ProjectAssets ¶ added in v0.7.0
func (b *AssetBridge) ProjectAssets(ctx context.Context, tenantID shared.ID, assets []*asset.Asset) error
ProjectAssets bridges every open-port / service / certificate asset in the batch into the exposure store. Assets of other types are ignored. Per-asset failures are logged and skipped; the method never returns an error so it cannot abort ingest. Tenant is taken from each asset (asset.TenantID()), never from a caller-supplied report.
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge promotes secret-scan findings into exposure events. It is best-effort: a failure here must never fail finding ingest.
func NewBridge ¶
func NewBridge( exposureRepo exposure.Repository, historyRepo exposure.StateHistoryRepository, log *logger.Logger, ) *Bridge
NewBridge creates a Bridge. historyRepo may be nil (state-change history is then simply not recorded).
func (*Bridge) ApplyBatch ¶
func (b *Bridge) ApplyBatch(ctx context.Context, tenantID shared.ID, findings []*vulnerability.Finding) error
ApplyBatch bridges every secret-scan and misconfiguration finding in the batch into the exposure store as first-class Exposure Register rows. Findings that are neither are ignored. Per-finding failures are logged and skipped; the method never returns an error so it cannot abort ingest.