Documentation
¶
Index ¶
- Constants
- Variables
- func BaseScore(vector string) (float64, error)
- func NewCPECVEsFunction() vgi.TableFunction
- func NewCVEFunction() vgi.TableFunction
- func NewCVESearchFunction() vgi.TableFunction
- func NewCVSSBaseScoreFunction() vgi.ScalarFunction
- func NewCVSSSeverityFunction() vgi.ScalarFunction
- func NewSeverityBandsFunction() vgi.TableFunction
- func Register(w *vgi.Worker)
- func Severity(score float64) string
- type CPECVEsFunction
- func (f *CPECVEsFunction) ArgumentSpecs() []vgi.ArgSpec
- func (f *CPECVEsFunction) Metadata() vgi.FunctionMetadata
- func (f *CPECVEsFunction) Name() string
- func (f *CPECVEsFunction) NewState(params *vgi.ProcessParams) (*cpeCVEsState, error)
- func (f *CPECVEsFunction) OnBind(_ *vgi.BindParams) (*vgi.BindResponse, error)
- func (f *CPECVEsFunction) Process(_ context.Context, _ *vgi.ProcessParams, state *cpeCVEsState, ...) error
- type CVEFunction
- func (f *CVEFunction) ArgumentSpecs() []vgi.ArgSpec
- func (f *CVEFunction) Metadata() vgi.FunctionMetadata
- func (f *CVEFunction) Name() string
- func (f *CVEFunction) NewState(params *vgi.ProcessParams) (*cveState, error)
- func (f *CVEFunction) OnBind(_ *vgi.BindParams) (*vgi.BindResponse, error)
- func (f *CVEFunction) Process(_ context.Context, _ *vgi.ProcessParams, state *cveState, ...) error
- type CVERow
- type CVESearchFunction
- func (f *CVESearchFunction) ArgumentSpecs() []vgi.ArgSpec
- func (f *CVESearchFunction) Metadata() vgi.FunctionMetadata
- func (f *CVESearchFunction) Name() string
- func (f *CVESearchFunction) NewState(params *vgi.ProcessParams) (*cveSearchState, error)
- func (f *CVESearchFunction) OnBind(_ *vgi.BindParams) (*vgi.BindResponse, error)
- func (f *CVESearchFunction) Process(_ context.Context, _ *vgi.ProcessParams, state *cveSearchState, ...) error
- type CVSSBaseScoreFunction
- func (f *CVSSBaseScoreFunction) ArgumentSpecs() []vgi.ArgSpec
- func (f *CVSSBaseScoreFunction) Metadata() vgi.FunctionMetadata
- func (f *CVSSBaseScoreFunction) Name() string
- func (f *CVSSBaseScoreFunction) OnBind(_ *vgi.BindParams) (*vgi.BindResponse, error)
- func (f *CVSSBaseScoreFunction) Process(_ context.Context, params *vgi.ProcessParams, batch arrow.RecordBatch) (arrow.RecordBatch, error)
- type CVSSSeverityFunction
- func (f *CVSSSeverityFunction) ArgumentSpecs() []vgi.ArgSpec
- func (f *CVSSSeverityFunction) Metadata() vgi.FunctionMetadata
- func (f *CVSSSeverityFunction) Name() string
- func (f *CVSSSeverityFunction) OnBind(_ *vgi.BindParams) (*vgi.BindResponse, error)
- func (f *CVSSSeverityFunction) Process(_ context.Context, params *vgi.ProcessParams, batch arrow.RecordBatch) (arrow.RecordBatch, error)
- type Client
- type CursorState
- type SeverityBand
- type SeverityBandsFunction
- func (f *SeverityBandsFunction) ArgumentSpecs() []vgi.ArgSpec
- func (f *SeverityBandsFunction) Metadata() vgi.FunctionMetadata
- func (f *SeverityBandsFunction) Name() string
- func (f *SeverityBandsFunction) NewState(_ *vgi.ProcessParams) (*bandsState, error)
- func (f *SeverityBandsFunction) OnBind(_ *vgi.BindParams) (*vgi.BindResponse, error)
- func (f *SeverityBandsFunction) Process(_ context.Context, _ *vgi.ProcessParams, state *bandsState, ...) error
Constants ¶
const CatalogName = "cve"
CatalogName is the VGI catalog name advertised by this worker.
const DefaultBaseURL = "https://services.nvd.nist.gov/rest/json/cves/2.0"
DefaultBaseURL is the real NVD 2.0 CVE API endpoint. Every table function accepts a base_url named option so the E2E suite can redirect requests at the local mock server.
const MaxResults = 100
MaxResults bounds the total number of rows the search/CPE functions will fetch across pages, so an over-broad query cannot run forever.
Variables ¶
var SeverityBandsColumns = []resultColumn{
{"severity", "VARCHAR", "Qualitative CVSS v3.1 band: NONE, LOW, MEDIUM, HIGH, or CRITICAL."},
{"min_score", "DOUBLE", "Inclusive lower bound, on the 0.0-10.0 CVSS base-score scale, of the range mapped to this band."},
{"max_score", "DOUBLE", "Inclusive upper bound, on the 0.0-10.0 CVSS base-score scale, of the range mapped to this band."},
}
SeverityBandsColumns is the structured column documentation for the cvss_severity_bands table, surfaced as vgi.result_columns_schema on both the backing function and the registered CatalogTable.
var SeverityBandsSchema = arrow.NewSchema([]arrow.Field{ {Name: "severity", Type: arrow.BinaryTypes.String}, {Name: "min_score", Type: arrow.PrimitiveTypes.Float64}, {Name: "max_score", Type: arrow.PrimitiveTypes.Float64}, }, nil)
SeverityBandsSchema is the static result schema of the cvss_severity_bands discovery table: one row per CVSS v3.1 qualitative band.
Functions ¶
func BaseScore ¶
BaseScore computes the CVSS v3.1 Base Score from a vector string such as
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (-> 9.8)
Only the Base metric group is required; any Temporal/Environmental metrics present in the vector are ignored. The "CVSS:3.0"/"CVSS:3.1" prefix is optional and accepted. Returns an error if a required metric is missing or a metric value is not recognized.
func NewCPECVEsFunction ¶
func NewCPECVEsFunction() vgi.TableFunction
NewCPECVEsFunction builds the registerable table function.
func NewCVEFunction ¶
func NewCVEFunction() vgi.TableFunction
NewCVEFunction builds the registerable table function.
func NewCVESearchFunction ¶
func NewCVESearchFunction() vgi.TableFunction
NewCVESearchFunction builds the registerable table function.
func NewCVSSBaseScoreFunction ¶
func NewCVSSBaseScoreFunction() vgi.ScalarFunction
NewCVSSBaseScoreFunction builds the registerable scalar function.
func NewCVSSSeverityFunction ¶
func NewCVSSSeverityFunction() vgi.ScalarFunction
NewCVSSSeverityFunction builds the registerable scalar function.
func NewSeverityBandsFunction ¶ added in v0.1.1
func NewSeverityBandsFunction() vgi.TableFunction
NewSeverityBandsFunction builds the table function that backs the browsable cvss_severity_bands catalog table.
Types ¶
type CPECVEsFunction ¶
type CPECVEsFunction struct{}
CPECVEsFunction lists CVEs for a CPE name.
func (*CPECVEsFunction) ArgumentSpecs ¶
func (f *CPECVEsFunction) ArgumentSpecs() []vgi.ArgSpec
func (*CPECVEsFunction) Metadata ¶
func (f *CPECVEsFunction) Metadata() vgi.FunctionMetadata
func (*CPECVEsFunction) Name ¶
func (f *CPECVEsFunction) Name() string
func (*CPECVEsFunction) NewState ¶
func (f *CPECVEsFunction) NewState(params *vgi.ProcessParams) (*cpeCVEsState, error)
func (*CPECVEsFunction) OnBind ¶
func (f *CPECVEsFunction) OnBind(_ *vgi.BindParams) (*vgi.BindResponse, error)
func (*CPECVEsFunction) Process ¶
func (f *CPECVEsFunction) Process(_ context.Context, _ *vgi.ProcessParams, state *cpeCVEsState, out *vgirpc.OutputCollector) error
type CVEFunction ¶
type CVEFunction struct{}
CVEFunction fetches one CVE by ID.
func (*CVEFunction) ArgumentSpecs ¶
func (f *CVEFunction) ArgumentSpecs() []vgi.ArgSpec
func (*CVEFunction) Metadata ¶
func (f *CVEFunction) Metadata() vgi.FunctionMetadata
func (*CVEFunction) Name ¶
func (f *CVEFunction) Name() string
func (*CVEFunction) NewState ¶
func (f *CVEFunction) NewState(params *vgi.ProcessParams) (*cveState, error)
func (*CVEFunction) OnBind ¶
func (f *CVEFunction) OnBind(_ *vgi.BindParams) (*vgi.BindResponse, error)
func (*CVEFunction) Process ¶
func (f *CVEFunction) Process(_ context.Context, _ *vgi.ProcessParams, state *cveState, out *vgirpc.OutputCollector) error
type CVERow ¶
type CVERow struct {
ID string
Description string
Score *float64
SeverityStr string
Vector string
Published string
LastModified string
CWE string
}
CVERow is the flattened, SQL-friendly projection of a single NVD CVE record. A nil pointer field means the source record had no value (e.g. a CVE with no CVSS metrics yields a nil Score, surfaced as SQL NULL).
type CVESearchFunction ¶
type CVESearchFunction struct{}
CVESearchFunction runs a paginated keyword search.
func (*CVESearchFunction) ArgumentSpecs ¶
func (f *CVESearchFunction) ArgumentSpecs() []vgi.ArgSpec
func (*CVESearchFunction) Metadata ¶
func (f *CVESearchFunction) Metadata() vgi.FunctionMetadata
func (*CVESearchFunction) Name ¶
func (f *CVESearchFunction) Name() string
func (*CVESearchFunction) NewState ¶
func (f *CVESearchFunction) NewState(params *vgi.ProcessParams) (*cveSearchState, error)
func (*CVESearchFunction) OnBind ¶
func (f *CVESearchFunction) OnBind(_ *vgi.BindParams) (*vgi.BindResponse, error)
func (*CVESearchFunction) Process ¶
func (f *CVESearchFunction) Process(_ context.Context, _ *vgi.ProcessParams, state *cveSearchState, out *vgirpc.OutputCollector) error
type CVSSBaseScoreFunction ¶
type CVSSBaseScoreFunction struct{}
CVSSBaseScoreFunction computes a CVSS v3.1 base score from a vector string.
func (*CVSSBaseScoreFunction) ArgumentSpecs ¶
func (f *CVSSBaseScoreFunction) ArgumentSpecs() []vgi.ArgSpec
func (*CVSSBaseScoreFunction) Metadata ¶
func (f *CVSSBaseScoreFunction) Metadata() vgi.FunctionMetadata
func (*CVSSBaseScoreFunction) Name ¶
func (f *CVSSBaseScoreFunction) Name() string
func (*CVSSBaseScoreFunction) OnBind ¶
func (f *CVSSBaseScoreFunction) OnBind(_ *vgi.BindParams) (*vgi.BindResponse, error)
func (*CVSSBaseScoreFunction) Process ¶
func (f *CVSSBaseScoreFunction) Process(_ context.Context, params *vgi.ProcessParams, batch arrow.RecordBatch) (arrow.RecordBatch, error)
type CVSSSeverityFunction ¶
type CVSSSeverityFunction struct{}
CVSSSeverityFunction maps a numeric CVSS base score to its qualitative band.
func (*CVSSSeverityFunction) ArgumentSpecs ¶
func (f *CVSSSeverityFunction) ArgumentSpecs() []vgi.ArgSpec
func (*CVSSSeverityFunction) Metadata ¶
func (f *CVSSSeverityFunction) Metadata() vgi.FunctionMetadata
func (*CVSSSeverityFunction) Name ¶
func (f *CVSSSeverityFunction) Name() string
func (*CVSSSeverityFunction) OnBind ¶
func (f *CVSSSeverityFunction) OnBind(_ *vgi.BindParams) (*vgi.BindResponse, error)
func (*CVSSSeverityFunction) Process ¶
func (f *CVSSSeverityFunction) Process(_ context.Context, params *vgi.ProcessParams, batch arrow.RecordBatch) (arrow.RecordBatch, error)
type Client ¶
Client talks to an NVD 2.0-compatible CVE API.
func NewClient ¶
NewClient builds a Client. An empty baseURL falls back to the real NVD endpoint; an empty apiKey means unauthenticated (subject to NVD's stricter public rate limit).
func (*Client) CVEsForCPE ¶
CVEsForCPE returns CVEs associated with a CPE name, paginated and bounded by MaxResults.
type CursorState ¶
CursorState is the shared streaming cursor embedded by every table-function state: the eagerly fetched rows plus the offset of the next unemitted row. Both fields are exported so gob round-trips them through the HTTP continuation token. The TYPE is exported too (CursorState, not cursorState) because the SDK counts a state struct's exported FIELDS at registration to verify it is gob-encodable — an embedded field named after an unexported type would not be counted and the worker would panic at startup.
type SeverityBand ¶ added in v0.1.1
type SeverityBand struct {
// Severity is the qualitative band name (NONE/LOW/MEDIUM/HIGH/CRITICAL).
Severity string
// MinScore and MaxScore bound the inclusive base-score range for the band.
MinScore float64
MaxScore float64
}
SeverityBand is one CVSS v3.1 qualitative severity band and the inclusive base-score range that Severity() maps into it.
func SeverityBands ¶ added in v0.1.1
func SeverityBands() []SeverityBand
SeverityBands returns the five CVSS v3.1 qualitative severity bands in ascending order, with the inclusive base-score range each covers. It is the single source the cvss_severity_bands discovery table reads, so that table and Severity()'s thresholds (above) cannot drift apart.
type SeverityBandsFunction ¶ added in v0.1.1
type SeverityBandsFunction struct{}
SeverityBandsFunction is the no-argument producer backing the browsable cvss_severity_bands discovery table. It emits the five CVSS v3.1 severity bands (offline, deterministic) so an agent can browse the banding that cvss_severity applies without having to call any function with arguments.
func (*SeverityBandsFunction) ArgumentSpecs ¶ added in v0.1.1
func (f *SeverityBandsFunction) ArgumentSpecs() []vgi.ArgSpec
func (*SeverityBandsFunction) Metadata ¶ added in v0.1.1
func (f *SeverityBandsFunction) Metadata() vgi.FunctionMetadata
func (*SeverityBandsFunction) Name ¶ added in v0.1.1
func (f *SeverityBandsFunction) Name() string
func (*SeverityBandsFunction) NewState ¶ added in v0.1.1
func (f *SeverityBandsFunction) NewState(_ *vgi.ProcessParams) (*bandsState, error)
func (*SeverityBandsFunction) OnBind ¶ added in v0.1.1
func (f *SeverityBandsFunction) OnBind(_ *vgi.BindParams) (*vgi.BindResponse, error)
func (*SeverityBandsFunction) Process ¶ added in v0.1.1
func (f *SeverityBandsFunction) Process(_ context.Context, _ *vgi.ProcessParams, state *bandsState, out *vgirpc.OutputCollector) error