Documentation ¶
Overview ¶
Package cveclient implements a client for interacting with MITRE CVE Services API as described at https://cveawg.mitre.org/api-docs/openapi.json.
Index ¶
- Constants
- type AssignedCVE
- type AssignedCVEList
- type Client
- func (c *Client) CreateRecord(id string, record *cveschema5.Containers) (*cveschema5.CVERecord, error)
- func (c *Client) ListOrgCVEs(opts *ListOptions) (AssignedCVEList, error)
- func (c *Client) ReserveIDs(opts ReserveOptions) (AssignedCVEList, error)
- func (c *Client) RetrieveID(id string) (cve *AssignedCVE, err error)
- func (c *Client) RetrieveOrg() (org *Org, err error)
- func (c *Client) RetrieveQuota() (q *Quota, err error)
- func (c *Client) RetrieveRecord(id string) (cve *cveschema5.CVERecord, err error)
- func (c *Client) UpdateRecord(id string, record *cveschema5.Containers) (*cveschema5.CVERecord, error)
- func (c *Client) WebURL(cveID string) string
- type Config
- type ListOptions
- type Org
- type Quota
- type RequestType
- type RequestedBy
- type ReserveOptions
Constants ¶
const ( // ProdEndpoint is the production endpoint ProdEndpoint = "https://cveawg.mitre.org" // TestEndpoint is the test endpoint TestEndpoint = "https://cveawg-test.mitre.org" // DevEndpoint is the dev endpoint DevEndpoint = "https://cveawg-dev.mitre.org" // WebURL is the URL to view production CVE records on the web. WebURL = "https://www.cve.org" // TestWebURL is the URL to view test CVE records on the web. TestWebURL = "https://test.cve.org" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssignedCVE ¶
type AssignedCVE struct { ID string `json:"cve_id"` Year string `json:"cve_year"` State cveschema5.State `json:"state"` CNA string `json:"owning_cna"` Reserved time.Time `json:"reserved"` RequestedBy RequestedBy `json:"requested_by"` }
AssignedCVE contains information about an assigned CVE.
func (AssignedCVE) String ¶
func (c AssignedCVE) String() string
type AssignedCVEList ¶
type AssignedCVEList []AssignedCVE
AssignedCVEList is a list of AssignedCVEs.
func (AssignedCVEList) ShortString ¶
func (cs AssignedCVEList) ShortString() string
ShortString outputs a formatted string of newline-separated CVE IDs.
func (AssignedCVEList) String ¶
func (cs AssignedCVEList) String() string
String outputs a formatted string of newline-separated CVE data.
type Client ¶
type Client struct { Config // contains filtered or unexported fields }
Client is a MITRE CVE Services API client.
func (*Client) CreateRecord ¶
func (c *Client) CreateRecord(id string, record *cveschema5.Containers) (*cveschema5.CVERecord, error)
func (*Client) ListOrgCVEs ¶
func (c *Client) ListOrgCVEs(opts *ListOptions) (AssignedCVEList, error)
ListOrgCVEs requests information about the CVEs the organization has been assigned. This list can be filtered by setting the fields in opts.
func (*Client) ReserveIDs ¶
func (c *Client) ReserveIDs(opts ReserveOptions) (AssignedCVEList, error)
ReserveIDs sends a request to the CVE API to reserve a block of CVE IDs. Returns a list of the reserved CVE IDs and their associated data. There may be fewer IDs than requested if, for example, the organization's quota is reached.
func (*Client) RetrieveID ¶
func (c *Client) RetrieveID(id string) (cve *AssignedCVE, err error)
RetrieveID requests information about an assigned CVE ID.
func (*Client) RetrieveOrg ¶
RetrieveOrg requests information about an organization.
func (*Client) RetrieveQuota ¶
RetrieveQuota queries the API for the organizations reservation quota.
func (*Client) RetrieveRecord ¶
func (c *Client) RetrieveRecord(id string) (cve *cveschema5.CVERecord, err error)
RetrieveRecord requests a CVE record.
func (*Client) UpdateRecord ¶
func (c *Client) UpdateRecord(id string, record *cveschema5.Containers) (*cveschema5.CVERecord, error)
type Config ¶
type Config struct { // Endpoint is the endpoint to access when making API calls. Required. Endpoint string // Org is the shortname for the organization that is authenticated when // making API calls. Required. Org string // Key is the user's API key. Required. Key string // User is the username for the account that is making API calls. Required. User string }
Config contains client configuration data.
type ListOptions ¶
type ListOptions struct { State string Year int ReservedBefore *time.Time ReservedAfter *time.Time ModifiedBefore *time.Time ModifiedAfter *time.Time }
ListOptions contains filters to be used when requesting a list of assigned CVEs.
func (ListOptions) String ¶
func (o ListOptions) String() string
type Quota ¶
type Quota struct { Quota int `json:"id_quota"` Reserved int `json:"total_reserved"` Available int `json:"available"` }
Quota contains information about an organizations reservation quota.
type RequestType ¶
type RequestType string
RequestType is the type of CVE ID reserve request.
const ( // SequentialRequest requests CVE IDs be reserved in a sequential fashion. SequentialRequest RequestType = "sequential" // NonsequentialRequest requests CVE IDs be reserved in a nonsequential fashion. NonsequentialRequest RequestType = "nonsequential" )
type RequestedBy ¶
RequestedBy indicates the requesting user and organization for a CVE.
type ReserveOptions ¶
type ReserveOptions struct { // NumIDs is the number of CVE IDs to reserve. Required. NumIDs int // Year is the CVE ID year for new IDs, indicating the year the // vulnerability was discovered. Required. Year int // Mode indicates whether the block of CVEs should be in sequence. // Relevant only if NumIDs > 1. Mode RequestType }
ReserveOptions contains the configuration options for reserving new CVE IDs.