Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ type SecretsRealtimeResult struct {

type IgnoredSecret struct {
Title string `json:"Title"`
FilePath string `json:"FilePath"`
SecretValue string `json:"SecretValue"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func NewSecretsRealtimeService(
func filterIgnoredSecrets(results []SecretsRealtimeResult, ignoreMap map[string]bool) []SecretsRealtimeResult {
filtered := make([]SecretsRealtimeResult, 0, len(results))
for _, r := range results {
key := fmt.Sprintf("%s_%s_%s", r.Title, r.FilePath, r.SecretValue)
key := fmt.Sprintf("%s_%s", r.Title, r.SecretValue)
if !ignoreMap[key] {
filtered = append(filtered, r)
}
Expand All @@ -56,7 +56,7 @@ func filterIgnoredSecrets(results []SecretsRealtimeResult, ignoreMap map[string]
func buildIgnoreMap(ignored []IgnoredSecret) map[string]bool {
m := make(map[string]bool)
for _, s := range ignored {
key := fmt.Sprintf("%s_%s_%s", s.Title, s.FilePath, s.SecretValue)
key := fmt.Sprintf("%s_%s", s.Title, s.SecretValue)
m[key] = true
}
return m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestRunSecretsRealtimeScan_WithIgnoreFile_FiltersResult(t *testing.T) {

ignoreFile := filepath.Join(tempDir, "ignored.json")
ignored := []IgnoredSecret{
{Title: "github-pat", FilePath: testFile, SecretValue: "ghp_1234567890abcdef123"},
{Title: "github-pat", SecretValue: "ghp_1234567890abcdef123"},
}
data, _ := json.Marshal(ignored)
assert.NoError(t, os.WriteFile(ignoreFile, data, 0644))
Expand Down
Loading