finding.go 828 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package report
  2. import "strings"
  3. // Finding contains information about strings that
  4. // have been captured by a tree-sitter query.
  5. type Finding struct {
  6. Description string
  7. StartLine int
  8. EndLine int
  9. StartColumn int
  10. EndColumn int
  11. Match string
  12. // Secret contains the full content of what is matched in
  13. // the tree-sitter query.
  14. Secret string
  15. // File is the name of the file containing the finding
  16. File string
  17. Commit string
  18. // Entropy is the shannon entropy of Value
  19. Entropy float32
  20. Author string
  21. Email string
  22. Date string
  23. Message string
  24. Tags []string
  25. // Rule is the name of the rule that was matched
  26. RuleID string
  27. }
  28. // Redact removes sensitive information from a finding.
  29. func (f *Finding) Redact() {
  30. f.Match = strings.Replace(f.Match, f.Secret, "REDACTED", -1)
  31. f.Secret = "REDACT"
  32. }