contrast

package
v1.492.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusReported = "REPORTED"
	Critical       = "CRITICAL"
	High           = "HIGH"
	Medium         = "MEDIUM"
	AuditAll       = "Audit All"
	Optional       = "Optional"

	ContentType     = "Content-Type"
	JSONContentType = "application/json"
)

Variables

This section is empty.

Functions

func CreateAndPersistToolRecord

func CreateAndPersistToolRecord(utils piperutils.FileUtils, appInfo *ApplicationInfo, modulePath string) (string, error)

func SaveReportFile added in v1.490.0

func SaveReportFile(utils piperutils.FileUtils, fileName, displayName string, data []byte) ([]piperutils.Path, error)

SaveReportFile saves report data to the contrast reports directory

Types

type ApplicationInfo

type ApplicationInfo struct {
	Url    string
	Id     string
	Name   string
	Server string
}

type ApplicationResponse

type ApplicationResponse struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
	Path        string `json:"path"`
	Language    string `json:"language"`
	Importance  string `json:"importance"`
}

type AsyncReportConfig added in v1.490.0

type AsyncReportConfig struct {
	ReportType         string // "SARIF" or "PDF"
	URLPattern         string // URL pattern for starting async generation
	Payload            map[string]interface{}
	DownloadURLPattern string // Pattern for building download URL
}

AsyncReportConfig contains configuration for async report generation

type Client added in v1.490.0

type Client struct {
	ApiKey     string
	ServiceKey string
	Username   string
	OrgID      string
	BaseURL    string
	AppURL     string
	Auth       string
	HttpClient *http.Client
}

Client is the unified Contrast API client for both sync and async operations

func NewClient added in v1.490.0

func NewClient(apiKey, serviceKey, username, orgID, baseURL, appURL string) *Client

func (*Client) DownloadReport added in v1.490.0

func (c *Client) DownloadReport(downloadUrl, reportType string) ([]byte, error)

DownloadReport downloads a report from the given URL

func (*Client) GeneratePdfReport added in v1.490.0

func (c *Client) GeneratePdfReport(appUuid string) ([]byte, error)

GeneratePdfReport generates a PDF attestation report for the given application (start, poll, download)

func (*Client) GenerateSarifReport added in v1.490.0

func (c *Client) GenerateSarifReport(appUuid string) ([]byte, error)

GenerateSarifReport generates a SARIF report for the given application (start, poll, download)

func (*Client) GetAppInfo added in v1.490.0

func (c *Client) GetAppInfo(appUIUrl, server string) (*ApplicationInfo, error)

GetAppInfo gets application information (synchronous)

func (*Client) GetVulnerabilities added in v1.490.0

func (c *Client) GetVulnerabilities() ([]ContrastFindings, error)

GetVulnerabilities gets vulnerabilities for the application (synchronous)

func (*Client) PollReportStatus added in v1.490.0

func (c *Client) PollReportStatus(reportUuid, reportType string) (*ReportStatusResponse, error)

PollReportStatus polls for report generation completion and returns the status response

func (*Client) StartAsyncPdfGeneration added in v1.490.0

func (c *Client) StartAsyncPdfGeneration(appUuid string) (string, error)

StartAsyncPdfGeneration initiates async PDF report generation (wrapper for testing compatibility)

func (*Client) StartAsyncSarifGeneration added in v1.490.0

func (c *Client) StartAsyncSarifGeneration(appUuid string) (string, error)

StartAsyncSarifGeneration initiates async SARIF report generation (wrapper for testing compatibility)

type Contrast

type Contrast interface {
	GetVulnerabilities() error
	GetAppInfo(appUIUrl, server string)
}

type ContrastAudit

type ContrastAudit struct {
	ToolName       string             `json:"toolName"`
	ApplicationUrl string             `json:"applicationUrl"`
	ScanResults    []ContrastFindings `json:"findings"`
}

type ContrastFindings

type ContrastFindings struct {
	ClassificationName string `json:"classificationName"`
	Total              int    `json:"total"`
	Audited            int    `json:"audited"`
}

type ContrastHttpClient

type ContrastHttpClient interface {
	ExecuteRequest(url string, params map[string]string, dest interface{}) error
}

type ContrastHttpClientInstance

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

func NewContrastHttpClient

func NewContrastHttpClient(apiKey, auth string) *ContrastHttpClientInstance

func (*ContrastHttpClientInstance) ExecuteRequest

func (c *ContrastHttpClientInstance) ExecuteRequest(url string, params map[string]string, dest interface{}) error

type ReportStatusResponse added in v1.490.0

type ReportStatusResponse struct {
	Messages    []string `json:"messages"`
	Success     bool     `json:"success"`
	Status      string   `json:"status"`
	DownloadUrl string   `json:"downloadUrl,omitempty"`
}

ReportStatusResponse represents the response from the report status endpoint

type VulnerabilitiesResponse

type VulnerabilitiesResponse struct {
	Size            int             `json:"size"`
	TotalElements   int             `json:"totalElements"`
	TotalPages      int             `json:"totalPages"`
	Empty           bool            `json:"empty"`
	First           bool            `json:"first"`
	Last            bool            `json:"last"`
	Vulnerabilities []Vulnerability `json:"content"`
}

type Vulnerability

type Vulnerability struct {
	Severity string `json:"severity"`
	Status   string `json:"status"`
}

Jump to

Keyboard shortcuts

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