Documentation ¶
Overview ¶
Package producers provides helper functions for writing Dracon compatible producers that parse tool outputs. Subdirectories in this package have more complete example usages of this package.
Index ¶
- Variables
- func EnsureValidPURLTarget(purlTarget string) (string, error)
- func GetPURLTarget(purlType string, namespace string, name string, version string, ...) string
- func ParseFlags() error
- func ParseMultiJSONMessages(in []byte) ([]interface{}, error)
- func ReadInFile() ([]byte, error)
- func ReadLines() (result [][]byte, err error)
- func TestEndToEnd(t *testing.T, inPath string, expectedPbPath string) error
- func WriteDraconOut(toolName string, issues []*draconapiv1.Issue) error
Constants ¶
This section is empty.
Variables ¶
var ( // InResults represents incoming tool output. InResults string // OutFile points to the protobuf file where dracon results will be written. OutFile string // Append flag will append to the outfile instead of overwriting, useful when there's multiple inresults. Append bool )
Functions ¶
func EnsureValidPURLTarget ¶ added in v0.20.0
EnsureValidPURLTarget takes a purl target string from an untrusted source, e.g. a tool output, and ensures it is a valid purl target according to the packageurl-go library.
func GetPURLTarget ¶ added in v0.20.0
func GetPURLTarget(purlType string, namespace string, name string, version string, qualifiers packageurl.Qualifiers, subpath string) string
GetPURLTarget returns a purl target string for a given package. This should be used as the `Issue.Target` field of SCA producers.
Example: GetPURLTarget("deb", "debian", "curl", "7.68.0", nil, "")
func ParseFlags ¶
func ParseFlags() error
ParseFlags will parse the input flags for the producer and perform simple validation.
func ParseMultiJSONMessages ¶
ParseMultiJSONMessages provides method to parse tool results in JSON format. It allows for parsing single JSON files with multiple JSON messages in them.
func ReadInFile ¶
ReadInFile returns the contents of the file given by InResults. TODO: replace with os.ReadFile
func TestEndToEnd ¶ added in v0.20.0
TestEndToEnd is a helper function to test the end-to-end functionality of a producer.
func WriteDraconOut ¶
func WriteDraconOut( toolName string, issues []*draconapiv1.Issue, ) error
WriteDraconOut provides a generic method to write the resulting protobuf to the output file.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package main of the cdxgen producer parses the CycloneDX output of cdxgen and create a singular Dracon issue from it
|
Package main of the cdxgen producer parses the CycloneDX output of cdxgen and create a singular Dracon issue from it |
Package main of the dependency track producer reads a dependency track export and translates it to dracon format
|
Package main of the dependency track producer reads a dependency track export and translates it to dracon format |
Package main implements the binary for parsing trufflehog results into the dracon format
|
Package main implements the binary for parsing trufflehog results into the dracon format |
types
Package types provides common types for audit report formats.
|
Package types provides common types for audit report formats. |
types/npmfullaudit
Package npmfullaudit provides types and functions for working with audit reports from npm's "Full Audit" endpoint (/-/npm/v1/security/audits) and transforming them into data structures understood by the Dracon enricher.
|
Package npmfullaudit provides types and functions for working with audit reports from npm's "Full Audit" endpoint (/-/npm/v1/security/audits) and transforming them into data structures understood by the Dracon enricher. |
types/npmquickaudit
Package npmquickaudit provides types and functions for working with audit reports from npm's "Quick Audit" endpoint (/-/npm/v1/security/audits/quick) and transforming them into data structures understood by the Dracon enricher.
|
Package npmquickaudit provides types and functions for working with audit reports from npm's "Quick Audit" endpoint (/-/npm/v1/security/audits/quick) and transforming them into data structures understood by the Dracon enricher. |