feat(report): allow user-defined templates (#1650)

This commit is contained in:
Richard Gomez authored and GitHub committed 2024-12-10 18:56:11 -06:00
1 parent e393d299bc
commit 83e99bacf1
72 files changed
+586 -549

No files matched your search

+5 -22
View File
@@ -2,32 +2,15 @@ package report
import (
"io"
"strings"
"github.com/zricethezav/gitleaks/v8/config"
)
const (
// https://cwe.mitre.org/data/definitions/798.html
CWE = "CWE-798"
CWE_DESCRIPTION = "Use of Hard-coded Credentials"
CWE = "CWE-798"
CWE_DESCRIPTION = "Use of Hard-coded Credentials"
StdoutReportPath = "-"
)
func Write(findings []Finding, cfg config.Config, ext string, report io.WriteCloser) error {
var err error
ext = strings.ToLower(ext)
switch ext {
case ".json", "json":
err = writeJson(findings, report)
case ".jsonextra", "jsonextra":
err = writeJsonExtra(findings, report)
case ".csv", "csv":
err = writeCsv(findings, report)
case ".xml", "junit":
err = writeJunit(findings, report)
case ".sarif", "sarif":
err = writeSarif(cfg, findings, report)
}
return err
type Reporter interface {
Write(w io.WriteCloser, findings []Finding) error
}