From 2583a6a742cb6b97952b3d970fe54e2660e3382f Mon Sep 17 00:00:00 2001 From: Abhishek Dawer Date: Wed, 7 Jan 2026 17:07:23 +0530 Subject: [PATCH 1/4] Updated regex and method to get repository name --- output/output.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/output/output.go b/output/output.go index 74b1f89..c2441c8 100644 --- a/output/output.go +++ b/output/output.go @@ -6,7 +6,7 @@ import ( "os" "regexp" "runtime/debug" - "strings" + "time" "github.com/certinia/asist/config" @@ -64,17 +64,14 @@ func DisplayOutput(finalResult *finding.Output, scanTime *ScanTime) { } /** - * extractRepoNameFromURL - method used to extract repoFolder/repoName from a sshUrl of repository + * extractRepoNameFromURL - method used to extract repoName from a sshUrl of repository */ func extractRepoNameFromURL(url string) string { if url != "" { - findRepoNameRegexp := regexp.MustCompile(`(?i)[a-z0-9-_.]+/[a-z0-9-_.]+\.git$`) + findRepoNameRegexp := regexp.MustCompile(`(?i)([a-z0-9-_.]+)\.git$`) match := findRepoNameRegexp.FindStringSubmatch(url) - if len(match) > 0 { - parts := strings.Split(match[0], ".git") - if len(parts) > 1 { - return parts[0] - } + if len(match) > 1 { + return match[1] } } return "" From 27ce49a1793bef8c02b68b2cf5799c9c6b9c95a9 Mon Sep 17 00:00:00 2001 From: Abhishek Dawer Date: Wed, 7 Jan 2026 17:27:33 +0530 Subject: [PATCH 2/4] fixed test method failure --- output/output_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/output/output_test.go b/output/output_test.go index b100854..d82a310 100644 --- a/output/output_test.go +++ b/output/output_test.go @@ -34,13 +34,13 @@ func TestCreateBaselineOutput(t *testing.T) { baselineOutputContent := finding.BaselineOutputContent{FindingID: "431d4935962ceb80271200", IsCustom: false, IsFalsePositive: false, Id: "ExposedMessageChannel", Severity: "High", RuleCategory: "Security"} expectedBaselineOutput := []finding.BaselineOutput{ { - RepositoryName: "test/test", + RepositoryName: "test", RepositoryURL: sshUrl, RecordType: "Finding", Content: baselineOutputContent, }, { - RepositoryName: "test/test", + RepositoryName: "test", RepositoryURL: sshUrl, RecordType: "Config", Content: config.GetConfigInstance(), From 1fe623fc99cef8f2b39a31378f82e5da8053ae4f Mon Sep 17 00:00:00 2001 From: Abhishek Dawer Date: Thu, 8 Jan 2026 14:55:29 +0530 Subject: [PATCH 3/4] added / in regex --- output/output.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/output/output.go b/output/output.go index c2441c8..b5344cf 100644 --- a/output/output.go +++ b/output/output.go @@ -68,8 +68,9 @@ func DisplayOutput(finalResult *finding.Output, scanTime *ScanTime) { */ func extractRepoNameFromURL(url string) string { if url != "" { - findRepoNameRegexp := regexp.MustCompile(`(?i)([a-z0-9-_.]+)\.git$`) + findRepoNameRegexp := regexp.MustCompile(`(?i)/([a-z0-9-_.]+)\.git$`) match := findRepoNameRegexp.FindStringSubmatch(url) + fmt.Println("match:", match) if len(match) > 1 { return match[1] } From c71ac0ad7fa0db3785217f4dc9c04a5059be3f5a Mon Sep 17 00:00:00 2001 From: Abhishek Dawer Date: Thu, 8 Jan 2026 15:11:00 +0530 Subject: [PATCH 4/4] Removed extra debug log --- output/output.go | 1 - 1 file changed, 1 deletion(-) diff --git a/output/output.go b/output/output.go index b5344cf..060783a 100644 --- a/output/output.go +++ b/output/output.go @@ -70,7 +70,6 @@ func extractRepoNameFromURL(url string) string { if url != "" { findRepoNameRegexp := regexp.MustCompile(`(?i)/([a-z0-9-_.]+)\.git$`) match := findRepoNameRegexp.FindStringSubmatch(url) - fmt.Println("match:", match) if len(match) > 1 { return match[1] }