mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-10 15:14:38 +00:00
[fixup ] - Allow ssh cloning with AWS Code Commit (#2307)
This commit is contained in:
parent
d6419a8ab2
commit
a1dc660f41
1 changed files with 10 additions and 2 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
|
@ -451,11 +452,18 @@ func CloneRepoUsingUnauthenticated(ctx context.Context, url string, args ...stri
|
|||
}
|
||||
|
||||
// CloneRepoUsingSSH clones a repo using SSH.
|
||||
func CloneRepoUsingSSH(ctx context.Context, gitUrl string, args ...string) (string, *git.Repository, error) {
|
||||
func CloneRepoUsingSSH(ctx context.Context, gitURL string, args ...string) (string, *git.Repository, error) {
|
||||
if isCodeCommitURL(gitURL) {
|
||||
return CloneRepo(ctx, nil, gitURL, args...)
|
||||
}
|
||||
userInfo := url.User("git")
|
||||
return CloneRepo(ctx, userInfo, gitUrl, args...)
|
||||
return CloneRepo(ctx, userInfo, gitURL, args...)
|
||||
}
|
||||
|
||||
var codeCommitRE = regexp.MustCompile(`ssh://git-codecommit\.[\w-]+\.amazonaws\.com`)
|
||||
|
||||
func isCodeCommitURL(gitURL string) bool { return codeCommitRE.MatchString(gitURL) }
|
||||
|
||||
func (s *Git) CommitsScanned() uint64 {
|
||||
return atomic.LoadUint64(&s.metrics.commitsScanned)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue