Documentation
¶
Index ¶
- Constants
- func CreateAndPersistToolRecord(utils piperutils.FileUtils, appInfo *ApplicationInfo, modulePath string, ...) (string, error)
- func SaveReportFile(utils piperutils.FileUtils, fileName, displayName string, data []byte) ([]piperutils.Path, error)
- type ApplicationInfo
- type ApplicationResponse
- type AsyncReportConfig
- type Client
- func (c *Client) DownloadReport(downloadUrl, reportType string) ([]byte, error)
- func (c *Client) GeneratePdfReport(appUuid string) ([]byte, error)
- func (c *Client) GenerateSarifReport(appUuid string) ([]byte, error)
- func (c *Client) GetAppInfo(appUIUrl, server string) (*ApplicationInfo, error)
- func (c *Client) GetRouteCoverage(appID string) (*RouteCoverageResponse, error)
- func (c *Client) GetServers(appID string) ([]ServerResource, error)
- func (c *Client) GetVulnerabilities() ([]ContrastFindings, error)
- func (c *Client) PollReportStatus(reportUuid, reportType string) (*ReportStatusResponse, error)
- func (c *Client) StartAsyncPdfGeneration(appUuid string) (string, error)
- func (c *Client) StartAsyncSarifGeneration(appUuid string) (string, error)
- type Contrast
- type ContrastAudit
- type ContrastFindings
- type ContrastHttpClient
- type ContrastHttpClientInstance
- type ReportStatusResponse
- type RouteCoverageResponse
- type ServerResource
- type ServersResponse
- type VulnerabilitiesResponse
- type Vulnerability
Constants ¶
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, exercisedRoutePercentage *float64) (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 ApplicationResponse ¶
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]any
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 (*Client) DownloadReport ¶ added in v1.490.0
DownloadReport downloads a report from the given URL
func (*Client) GeneratePdfReport ¶ added in v1.490.0
GeneratePdfReport generates a PDF attestation report for the given application (start, poll, download)
func (*Client) GenerateSarifReport ¶ added in v1.490.0
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) GetRouteCoverage ¶ added in v1.524.0
func (c *Client) GetRouteCoverage(appID string) (*RouteCoverageResponse, error)
GetRouteCoverage returns route coverage stats for the application. Endpoint: GET /ng/{orgUuid}/applications/{appId}/route
func (*Client) GetServers ¶ added in v1.524.0
func (c *Client) GetServers(appID string) ([]ServerResource, error)
GetServers returns all servers associated with the application. Endpoint: GET /ng/{orgUuid}/applications/{appId}/servers
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
StartAsyncPdfGeneration initiates async PDF report generation (wrapper for testing compatibility)
type ContrastAudit ¶
type ContrastAudit struct {
ToolName string `json:"toolName"`
ApplicationUrl string `json:"applicationUrl"`
ScanResults []ContrastFindings `json:"findings"`
RouteDiscoveredCount *int `json:"routeDiscoveredCount,omitempty"`
RouteExercisedCount *int `json:"routeExercisedCount,omitempty"`
}
type ContrastFindings ¶
type ContrastHttpClient ¶
type ContrastHttpClientInstance ¶
type ContrastHttpClientInstance struct {
// contains filtered or unexported fields
}
func NewContrastHttpClient ¶
func NewContrastHttpClient(apiKey, auth string) *ContrastHttpClientInstance
func (*ContrastHttpClientInstance) ExecuteRequest ¶
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 RouteCoverageResponse ¶ added in v1.524.0
type RouteCoverageResponse struct {
Success bool `json:"success"`
DiscoveredCount int `json:"discovered_count"`
ExercisedCount int `json:"exercised_count"`
}
RouteCoverageResponse is returned by GET /ng/{orgUuid}/applications/{appId}/route
type ServerResource ¶ added in v1.524.0
type ServerResource struct {
ServerID int64 `json:"server_id"`
Name string `json:"name"`
Hostname string `json:"hostname"`
LastActivity int64 `json:"last_activity"`
Status string `json:"status"`
}
ServerResource contains per-server detail; LastActivity is a Unix millisecond timestamp
type ServersResponse ¶ added in v1.524.0
type ServersResponse struct {
Count int64 `json:"count"`
Messages []string `json:"messages"`
Servers []ServerResource `json:"servers"`
Success bool `json:"success"`
}
ServersResponse is returned by GET /ng/{orgUuid}/applications/{appId}/servers