finding.go 875 B

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