ctemid

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: GPL-3.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ctemid models the CTEM-ID catalog: a standardized, CVE-like set of exposure-class identifiers published as an external JSON feed. Unlike a CVE (a specific software flaw), a CTEM-ID names a class of exposure — brand impersonation, credential dumps, lookalike domains, ransomware activity, source-code exposure, system exposure, and so on. It is tenant-agnostic reference data that findings and exposures can be tagged with.

Index

Constants

This section is empty.

Variables

View Source
var ErrCTEMIDNotFound = fmt.Errorf("%w: ctem-id not found", shared.ErrNotFound)

ErrCTEMIDNotFound is returned when a catalog entry does not exist.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reports whether err is a not-found error.

Types

type CTEMID

type CTEMID struct {
	// contains filtered or unexported fields
}

CTEMID is one entry in the CTEM-ID catalog.

func NewCTEMID

func NewCTEMID(ctemID string, category Category, title, description, severity, sourceURL string, publishedAt *time.Time, raw []byte) *CTEMID

NewCTEMID creates a catalog entry. ctemID, category and title are required by the caller (the parser drops entries missing them); this constructor does not re-validate because the catalog is fail-open reference data.

func Reconstitute

func Reconstitute(id shared.ID, ctemID string, category Category, title, description, severity, sourceURL string, publishedAt *time.Time, raw []byte, createdAt, updatedAt time.Time) *CTEMID

Reconstitute rebuilds a CTEMID from persistence.

func (*CTEMID) CTEMID

func (c *CTEMID) CTEMID() string

CTEMID returns the external catalog identifier.

func (*CTEMID) Category

func (c *CTEMID) Category() Category

Category returns the exposure class.

func (*CTEMID) CreatedAt

func (c *CTEMID) CreatedAt() time.Time

CreatedAt returns the creation timestamp.

func (*CTEMID) Description

func (c *CTEMID) Description() string

Description returns the description.

func (*CTEMID) ID

func (c *CTEMID) ID() shared.ID

ID returns the internal id.

func (*CTEMID) PublishedAt

func (c *CTEMID) PublishedAt() *time.Time

PublishedAt returns the feed-provided publish time (may be nil).

func (*CTEMID) Raw

func (c *CTEMID) Raw() []byte

Raw returns the raw JSON of the feed entry.

func (*CTEMID) Severity

func (c *CTEMID) Severity() string

Severity returns the feed-provided severity (may be empty).

func (*CTEMID) SourceURL

func (c *CTEMID) SourceURL() string

SourceURL returns the feed-provided source URL (may be empty).

func (*CTEMID) Title

func (c *CTEMID) Title() string

Title returns the title.

func (*CTEMID) UpdatedAt

func (c *CTEMID) UpdatedAt() time.Time

UpdatedAt returns the last update timestamp.

type Category

type Category string

Category is the exposure class a CTEM-ID belongs to.

const (
	CategoryBrandImpersonation Category = "brand_impersonation"
	CategoryCredentialDumps    Category = "credential_dumps"
	CategoryInfectedDevices    Category = "infected_devices"
	CategoryLookalikeDomains   Category = "lookalike_domains"
	CategoryRansomware         Category = "ransomware"
	CategorySourceCodeExposure Category = "source_code_exposure"
	CategorySystemExposure     Category = "system_exposure"
	CategoryOther              Category = "other"
)

func ParseCategory

func ParseCategory(s string) Category

ParseCategory normalizes a feed-provided category string to a canonical Category. Empty or unrecognized input maps to CategoryOther.

func (Category) String

func (c Category) String() string

String returns the string representation.

type Repository

type Repository interface {
	// UpsertBatch inserts or updates catalog entries keyed by ctem_id. It is
	// idempotent: re-ingesting the same feed updates mutable fields and leaves
	// the row count unchanged.
	UpsertBatch(ctx context.Context, entries []*CTEMID) error

	// List returns catalog entries, optionally filtered by category, with
	// limit/offset pagination. The second return is the total matching count.
	List(ctx context.Context, category *string, limit, offset int) ([]*CTEMID, int, error)

	// GetByCTEMID returns a single catalog entry by its external id.
	GetByCTEMID(ctx context.Context, ctemID string) (*CTEMID, error)

	// Count returns the total number of catalog entries.
	Count(ctx context.Context) (int, error)
}

Repository persists the CTEM-ID catalog. It is tenant-agnostic reference data.

Jump to

Keyboard shortcuts

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