mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 20:54:22 +01:00
feat(report): allow user-defined templates (#1650)
This commit is contained in:
1 parent
e393d299bc
commit
83e99bacf1
72 files changed
+586
-549
No files matched your search
+5
-22
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user