export

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidFormats = []string{"sarif", "json", "md", "markdown", "html", "csv"}

ValidFormats contains all supported export formats

Functions

func ExportFindings

func ExportFindings(findings []finding.Finding, format string, projectName string) ([]byte, error)

ExportFindings exports findings to the specified format

Types

type CSVExporter

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

CSVExporter exports findings to CSV format

func NewCSVExporter

func NewCSVExporter() *CSVExporter

NewCSVExporter creates a new CSV exporter

func (*CSVExporter) ContentType

func (e *CSVExporter) ContentType() string

ContentType returns the MIME type for CSV

func (*CSVExporter) Export

func (e *CSVExporter) Export(findings []finding.Finding) ([]byte, error)

Export exports findings to CSV format

func (*CSVExporter) FileExtension

func (e *CSVExporter) FileExtension() string

FileExtension returns the file extension for CSV

func (*CSVExporter) FormatName

func (e *CSVExporter) FormatName() string

FormatName returns the format name

func (*CSVExporter) SetProjectName

func (e *CSVExporter) SetProjectName(name string)

SetProjectName sets the project name for the report

type Exporter

type Exporter interface {
	Export(findings []finding.Finding) ([]byte, error)
	ContentType() string
	FileExtension() string
	FormatName() string
}

Exporter is the interface for all export formats

func GetExporter

func GetExporter(format string) (Exporter, error)

GetExporter returns an exporter for the given format

type ExporterWithProject

type ExporterWithProject interface {
	Exporter
	SetProjectName(name string)
}

ExporterWithProject is an exporter that can have a project name set

type HTMLExporter

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

HTMLExporter exports findings to HTML format

func NewHTMLExporter

func NewHTMLExporter() *HTMLExporter

NewHTMLExporter creates a new HTML exporter

func (*HTMLExporter) ContentType

func (e *HTMLExporter) ContentType() string

ContentType returns the MIME type for HTML

func (*HTMLExporter) Export

func (e *HTMLExporter) Export(findings []finding.Finding) ([]byte, error)

Export exports findings to HTML format

func (*HTMLExporter) FileExtension

func (e *HTMLExporter) FileExtension() string

FileExtension returns the file extension for HTML

func (*HTMLExporter) FormatName

func (e *HTMLExporter) FormatName() string

FormatName returns the format name

func (*HTMLExporter) SetProjectName

func (e *HTMLExporter) SetProjectName(name string)

SetProjectName sets the project name for the report

type JSONExporter

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

JSONExporter exports findings to JSON format

func NewJSONExporter

func NewJSONExporter() *JSONExporter

NewJSONExporter creates a new JSON exporter

func (*JSONExporter) ContentType

func (e *JSONExporter) ContentType() string

ContentType returns the MIME type for JSON

func (*JSONExporter) Export

func (e *JSONExporter) Export(findings []finding.Finding) ([]byte, error)

Export exports findings to JSON format

func (*JSONExporter) FileExtension

func (e *JSONExporter) FileExtension() string

FileExtension returns the file extension for JSON

func (*JSONExporter) FormatName

func (e *JSONExporter) FormatName() string

FormatName returns the format name

func (*JSONExporter) SetProjectName

func (e *JSONExporter) SetProjectName(name string)

SetProjectName sets the project name for the report

type JSONMetadata

type JSONMetadata struct {
	Tool        string    `json:"tool"`
	Version     string    `json:"version"`
	GeneratedAt time.Time `json:"generated_at"`
	ProjectName string    `json:"project_name,omitempty"`
}

JSONMetadata contains report metadata

type JSONReport

type JSONReport struct {
	Metadata JSONMetadata      `json:"metadata"`
	Summary  JSONSummary       `json:"summary"`
	Findings []finding.Finding `json:"findings"`
}

JSONReport represents a JSON export report

type JSONSummary

type JSONSummary struct {
	Total      int            `json:"total"`
	BySeverity map[string]int `json:"by_severity"`
	ByStatus   map[string]int `json:"by_status"`
}

JSONSummary contains summary statistics

type MarkdownExporter

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

MarkdownExporter exports findings to Markdown format

func NewMarkdownExporter

func NewMarkdownExporter() *MarkdownExporter

NewMarkdownExporter creates a new Markdown exporter

func (*MarkdownExporter) ContentType

func (e *MarkdownExporter) ContentType() string

ContentType returns the MIME type for Markdown

func (*MarkdownExporter) Export

func (e *MarkdownExporter) Export(findings []finding.Finding) ([]byte, error)

Export exports findings to Markdown format

func (*MarkdownExporter) FileExtension

func (e *MarkdownExporter) FileExtension() string

FileExtension returns the file extension for Markdown

func (*MarkdownExporter) FormatName

func (e *MarkdownExporter) FormatName() string

FormatName returns the format name

func (*MarkdownExporter) SetProjectName

func (e *MarkdownExporter) SetProjectName(name string)

SetProjectName sets the project name for the report

type SARIFExporter

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

SARIFExporter exports findings to SARIF format

func NewSARIFExporter

func NewSARIFExporter() *SARIFExporter

NewSARIFExporter creates a new SARIF exporter

func (*SARIFExporter) ContentType

func (e *SARIFExporter) ContentType() string

ContentType returns the MIME type for SARIF

func (*SARIFExporter) Export

func (e *SARIFExporter) Export(findings []finding.Finding) ([]byte, error)

Export exports findings to SARIF format

func (*SARIFExporter) FileExtension

func (e *SARIFExporter) FileExtension() string

FileExtension returns the file extension for SARIF

func (*SARIFExporter) FormatName

func (e *SARIFExporter) FormatName() string

FormatName returns the format name

type SarifArtifactLocation

type SarifArtifactLocation struct {
	URI       string `json:"uri"`
	URIBaseID string `json:"uriBaseId,omitempty"`
}

type SarifCodeFlow

type SarifCodeFlow struct {
	ThreadFlows []SarifThreadFlow `json:"threadFlows"`
}

type SarifDriver

type SarifDriver struct {
	Name           string      `json:"name"`
	Version        string      `json:"version"`
	InformationUri string      `json:"informationUri,omitempty"`
	Rules          []SarifRule `json:"rules,omitempty"`
}

type SarifFix

type SarifFix struct {
	Description SarifMessage `json:"description"`
}

type SarifInvocation

type SarifInvocation struct {
	ExecutionSuccessful bool   `json:"executionSuccessful"`
	EndTimeUtc          string `json:"endTimeUtc,omitempty"`
}

type SarifLocation

type SarifLocation struct {
	PhysicalLocation SarifPhysicalLocation `json:"physicalLocation"`
}

type SarifLog

type SarifLog struct {
	Schema  string     `json:"$schema"`
	Version string     `json:"version"`
	Runs    []SarifRun `json:"runs"`
}

type SarifMessage

type SarifMessage struct {
	Text     string `json:"text,omitempty"`
	Markdown string `json:"markdown,omitempty"`
}

type SarifPhysicalLocation

type SarifPhysicalLocation struct {
	ArtifactLocation SarifArtifactLocation `json:"artifactLocation"`
	Region           *SarifRegion          `json:"region,omitempty"`
}

type SarifRegion

type SarifRegion struct {
	StartLine   int           `json:"startLine,omitempty"`
	EndLine     int           `json:"endLine,omitempty"`
	StartColumn int           `json:"startColumn,omitempty"`
	EndColumn   int           `json:"endColumn,omitempty"`
	Snippet     *SarifSnippet `json:"snippet,omitempty"`
}

type SarifReportingConfiguration

type SarifReportingConfiguration struct {
	Level string `json:"level"`
}

type SarifResult

type SarifResult struct {
	RuleID     string                 `json:"ruleId"`
	RuleIndex  int                    `json:"ruleIndex,omitempty"`
	Level      string                 `json:"level"`
	Message    SarifMessage           `json:"message"`
	Locations  []SarifLocation        `json:"locations,omitempty"`
	CodeFlows  []SarifCodeFlow        `json:"codeFlows,omitempty"`
	Fixes      []SarifFix             `json:"fixes,omitempty"`
	Properties map[string]interface{} `json:"properties,omitempty"`
}

type SarifRule

type SarifRule struct {
	ID                   string                       `json:"id"`
	Name                 string                       `json:"name,omitempty"`
	ShortDescription     SarifMessage                 `json:"shortDescription,omitempty"`
	FullDescription      SarifMessage                 `json:"fullDescription,omitempty"`
	HelpUri              string                       `json:"helpUri,omitempty"`
	Help                 *SarifMessage                `json:"help,omitempty"`
	DefaultConfiguration *SarifReportingConfiguration `json:"defaultConfiguration,omitempty"`
	Properties           map[string]interface{}       `json:"properties,omitempty"`
}

type SarifRun

type SarifRun struct {
	Tool        SarifTool         `json:"tool"`
	Results     []SarifResult     `json:"results"`
	Invocations []SarifInvocation `json:"invocations,omitempty"`
}

type SarifSnippet

type SarifSnippet struct {
	Text string `json:"text"`
}

type SarifThreadFlow

type SarifThreadFlow struct {
	Locations []SarifThreadFlowLocation `json:"locations"`
}

type SarifThreadFlowLocation

type SarifThreadFlowLocation struct {
	Location SarifLocation `json:"location"`
	Message  *SarifMessage `json:"message,omitempty"`
}

type SarifTool

type SarifTool struct {
	Driver SarifDriver `json:"driver"`
}

Jump to

Keyboard shortcuts

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