api

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FeaturedProjectsOrganization = "organizations/1"

Functions

func ValidateAndNormalizeServerURL added in v0.26.0

func ValidateAndNormalizeServerURL(server string) (string, error)

func WrapConnectionError added in v0.24.0

func WrapConnectionError(err error) error

WrapConnectionError wraps an error returned by the API client in a ConnectionError to avoid having the error message printed when the error is handled.

Types

type API added in v0.16.0

type API struct {
	RelativePath string `json:"relative_path"`
}

type APIClient

type APIClient struct {
	Server    string
	UserAgent string
}

func NewClient added in v0.26.0

func NewClient(server string, version string) *APIClient

func (*APIClient) CreateCampaignRun added in v0.16.0

func (client *APIClient) CreateCampaignRun(project string, token string, fuzzTarget string, firstMetrics *report.FuzzingMetric, lastMetrics *report.FuzzingMetric, numBuildJobs uint) (string, string, error)

CreateCampaignRun creates a new campaign run for the given project and returns the name of the campaign and fuzzing run. The campaign and fuzzing run name is used to identify the campaign run in the API for consecutive calls.

func (*APIClient) CreateProject added in v0.16.0

func (client *APIClient) CreateProject(name string, token string) (*Project, error)

func (*APIClient) GetErrorDetails added in v0.20.0

func (client *APIClient) GetErrorDetails(token string) ([]finding.ErrorDetails, error)

GetErrorDetails gets the error details from the API

func (*APIClient) IsTokenValid

func (client *APIClient) IsTokenValid(token string) (bool, error)

func (*APIClient) ListProjects

func (client *APIClient) ListProjects(token string) ([]*Project, error)

func (*APIClient) StartRemoteFuzzingRun

func (client *APIClient) StartRemoteFuzzingRun(artifact *Artifact, token string) (string, error)

func (*APIClient) UploadBundle

func (client *APIClient) UploadBundle(path string, projectName string, token string) (*Artifact, error)

func (*APIClient) UploadFinding added in v0.16.0

func (client *APIClient) UploadFinding(project string, fuzzTarget string, campaignRunName string, fuzzingRunName string, finding *finding.Finding, token string) error

type APIError

type APIError struct {
	StatusCode int
	// contains filtered or unexported fields
}

APIError is returned when a REST request returns a status code other than 200 OK

func (APIError) Error

func (e APIError) Error() string

func (APIError) Format

func (e APIError) Format(s fmt.State, verb rune)

func (APIError) Unwrap

func (e APIError) Unwrap() error

type Artifact

type Artifact struct {
	DisplayName  string `json:"display-name"`
	ResourceName string `json:"resource-name"`
}

type BreakPoint added in v0.16.0

type BreakPoint struct {
	SourceFilePath string           `json:"source_file_path,omitempty"`
	Location       *FindingLocation `json:"location,omitempty"`
	Function       string           `json:"function,omitempty"`
}

type CAPI added in v0.16.0

type CAPI struct {
	API API `json:"api"`
}

type Campaign added in v0.16.0

type Campaign struct {
	MaxRunTime string `json:"max_run_time"`
}

type CampaignRun added in v0.16.0

type CampaignRun struct {
	Name        string       `json:"name"`
	DisplayName string       `json:"display_name"`
	Campaign    Campaign     `json:"campaign"`
	Runs        []FuzzingRun `json:"runs"`
	Status      string       `json:"status"`
	Timestamp   string       `json:"timestamp"`
}

type CampaignRunBody added in v0.16.0

type CampaignRunBody struct {
	CampaignRun CampaignRun `json:"campaign_run"`
}

type ConnectionError added in v0.24.0

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

ConnectionError is returned when a REST request fails to connect to the API

func (ConnectionError) Error added in v0.24.0

func (e ConnectionError) Error() string

func (ConnectionError) Unwrap added in v0.24.0

func (e ConnectionError) Unwrap() error

type DebuggingInfo added in v0.16.0

type DebuggingInfo struct {
	ExecutablePath string        `json:"executable_path,omitempty"`
	RunArguments   []string      `json:"run_arguments,omitempty"`
	BreakPoints    []BreakPoint  `json:"break_points,omitempty"`
	Environment    []Environment `json:"environment,omitempty"`
}

type Environment added in v0.16.0

type Environment struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

type ErrorReport added in v0.16.0

type ErrorReport struct {
	Logs      []string `json:"logs"`
	Details   string   `json:"details"`
	Type      string   `json:"type,omitempty"`
	InputData []byte   `json:"input_data,omitempty"`

	DebuggingInfo      *DebuggingInfo        `json:"debugging_info,omitempty"`
	HumanReadableInput string                `json:"human_readable_input,omitempty"`
	MoreDetails        *finding.ErrorDetails `json:"more_details,omitempty"`
	Tag                string                `json:"tag,omitempty"`
	ShortDescription   string                `json:"short_description,omitempty"`
}

type Finding added in v0.16.0

type Finding struct {
	Name        string      `json:"name"`
	DisplayName string      `json:"display_name"`
	FuzzTarget  string      `json:"fuzz_target"`
	FuzzingRun  string      `json:"fuzzing_run"`
	CampaignRun string      `json:"campaign_run"`
	ErrorReport ErrorReport `json:"error_report"`
	Timestamp   string      `json:"timestamp"`
}

type FindingLocation added in v0.16.0

type FindingLocation struct {
	Line   uint32 `json:"line,omitempty"`
	Column uint32 `json:"column,omitempty"`
}

type Findings added in v0.16.0

type Findings struct {
	Findings []Finding `json:"findings"`
}

type FuzzTargetConfig added in v0.16.0

type FuzzTargetConfig struct {
	Name string `json:"name"`
	CAPI CAPI   `json:"c_api"`
}

type FuzzerRunConfigurations added in v0.16.0

type FuzzerRunConfigurations struct {
	Engine       string `json:"engine"`
	NumberOfJobs int64  `json:"number_of_jobs"`
}

type FuzzingRun added in v0.16.0

type FuzzingRun struct {
	Name                    string                  `json:"name"`
	DisplayName             string                  `json:"display_name"`
	Status                  string                  `json:"status"`
	Metrics                 []*Metrics              `json:"metrics,omitempty"`
	FuzzerRunConfigurations FuzzerRunConfigurations `json:"fuzzer_run_configurations"`
	FuzzTargetConfig        FuzzTargetConfig        `json:"fuzz_target_config"`
}

type GitPath added in v0.16.0

type GitPath struct{}

type Location added in v0.16.0

type Location struct {
	GitPath GitPath `json:"git_path"`
}

type Metrics added in v0.21.0

type Metrics struct {
	Timestamp                string `json:"timestamp"`
	ExecutionsPerSecond      int32  `json:"executions_per_second"`
	Features                 int32  `json:"features"`
	CorpusSize               int32  `json:"corpus_size"`
	SecondsSinceLastCoverage string `json:"seconds_since_last_coverage"`
	TotalExecutions          string `json:"total_executions"`
	Edges                    int32  `json:"edges"`
	SecondsSinceLastEdge     string `json:"seconds_since_last_edge"`
}

type Project

type Project struct {
	Name                  string `json:"name"`
	DisplayName           string `json:"display_name"`
	OwnerOrganizationName string `json:"owner_organization_name,omitempty"`
}

type ProjectBody added in v0.16.0

type ProjectBody struct {
	Project Project `json:"project"`
}

type ProjectResponse added in v0.16.0

type ProjectResponse struct {
	Name     string   `json:"name"`
	Done     bool     `json:"done"`
	Response Response `json:"response"`
}

type Response added in v0.16.0

type Response struct {
	Type          string   `json:"@type"`
	Name          string   `json:"name"`
	DisplayName   string   `json:"display_name"`
	Location      Location `json:"location"`
	OwnerUsername string   `json:"owner_username"`
}

type Severity added in v0.16.0

type Severity struct {
	Description string  `json:"description,omitempty"`
	Score       float32 `json:"score,omitempty"`
}

Jump to

Keyboard shortcuts

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