Skip to content

Commit

Permalink
feat: exclude symlinks
Browse files Browse the repository at this point in the history
Signed-off-by: r3drun3 <simone.ragonesi@protonmail.com>
  • Loading branch information
R3DRUN3 committed Jan 7, 2025
1 parent 0fa4ffc commit aaea479
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func ScanSensitiveFiles(outputDir string) ([]string, error) {
return files, nil
}

// expandPath expands directories into a list of files.
// expandPath expands directories into a list of files, excluding symlinks.
func expandPath(path string) []string {
var fileList []string

Expand All @@ -156,9 +156,18 @@ func expandPath(path string) []string {
//fmt.Printf("Error accessing %s: %v\n", p, err)
return nil
}

// Skip symlinks
if info.Mode()&os.ModeSymlink != 0 {
//fmt.Printf("Skipping symlink: %s\n", p) // Debug log
return nil
}

// Add files that are not directories and are accessible
if !info.IsDir() && canAccessFile(p) {
fileList = append(fileList, p)
}

return nil
})

Expand Down

0 comments on commit aaea479

Please sign in to comment.