Skip to content

Commit 2eec2d0

Browse files
feat: consider zip as source
1 parent 37015c1 commit 2eec2d0

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

internal/commands/scan.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3826,15 +3826,15 @@ func validateGitCommitHistoryContext(cmd *cobra.Command) bool {
38263826
return true
38273827
}
38283828

3829-
// hasGitRepository checks if the source directory contains a Git repository or is a Git URL
3829+
// hasGitRepository checks if the source directory contains a Git repository (skipping validation for git URLs or zip files)
38303830
func hasGitRepository(source string) bool {
38313831
if source == "" {
38323832
return false
38333833
}
38343834

38353835
sourceTrimmed := strings.TrimSpace(source)
38363836

3837-
if util.IsGitURL(sourceTrimmed) {
3837+
if util.IsGitURL(sourceTrimmed) || filepath.Ext(sourceTrimmed) == constants.ZipExtension {
38383838
return true
38393839
}
38403840

internal/commands/scan_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4843,6 +4843,26 @@ func TestGetGitCommitHistoryValue(t *testing.T) {
48434843
expectedValue: "false",
48444844
expectWarnings: "",
48454845
},
4846+
{
4847+
name: "Flag true with zip file - returns true",
4848+
flagValue: "true",
4849+
scanTypes: "scs",
4850+
scsEngines: "secret-detection",
4851+
source: "/path/to/source.zip",
4852+
ffEnabled: true,
4853+
expectedValue: "true",
4854+
expectWarnings: "",
4855+
},
4856+
{
4857+
name: "Flag false with zip file - returns false",
4858+
flagValue: "false",
4859+
scanTypes: "scs",
4860+
scsEngines: "secret-detection",
4861+
source: "/path/to/source.zip",
4862+
ffEnabled: true,
4863+
expectedValue: "false",
4864+
expectWarnings: "",
4865+
},
48464866
}
48474867

48484868
for _, tt := range tests {

0 commit comments

Comments
 (0)