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 ¶
- Variables
- func IsNotFound(err error) bool
- type CTEMID
- func (c *CTEMID) CTEMID() string
- func (c *CTEMID) Category() Category
- func (c *CTEMID) CreatedAt() time.Time
- func (c *CTEMID) Description() string
- func (c *CTEMID) ID() shared.ID
- func (c *CTEMID) PublishedAt() *time.Time
- func (c *CTEMID) Raw() []byte
- func (c *CTEMID) Severity() string
- func (c *CTEMID) SourceURL() string
- func (c *CTEMID) Title() string
- func (c *CTEMID) UpdatedAt() time.Time
- type Category
- type Repository
Constants ¶
This section is empty.
Variables ¶
var ErrCTEMIDNotFound = fmt.Errorf("%w: ctem-id not found", shared.ErrNotFound)
ErrCTEMIDNotFound is returned when a catalog entry does not exist.
Functions ¶
func IsNotFound ¶
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) Description ¶
Description returns the description.
func (*CTEMID) PublishedAt ¶
PublishedAt returns the feed-provided publish time (may be nil).
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 ¶
ParseCategory normalizes a feed-provided category string to a canonical Category. Empty or unrecognized input maps to CategoryOther.
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.