@@ -5,16 +5,19 @@ import (
5
5
6
6
gogit "github.com/go-git/go-git/v5"
7
7
"github.com/google/go-github/v67/github"
8
+ "github.com/shurcooL/githubv4"
9
+
8
10
"github.com/trufflesecurity/trufflehog/v3/pkg/common"
9
11
"github.com/trufflesecurity/trufflehog/v3/pkg/context"
10
12
"github.com/trufflesecurity/trufflehog/v3/pkg/pb/credentialspb"
11
13
"github.com/trufflesecurity/trufflehog/v3/pkg/sources/git"
12
14
)
13
15
14
16
type basicAuthConnector struct {
15
- apiClient * github.Client
16
- username string
17
- password string
17
+ apiClient * github.Client
18
+ graphQlClient * githubv4.Client
19
+ username string
20
+ password string
18
21
}
19
22
20
23
var _ connector = (* basicAuthConnector )(nil )
@@ -33,16 +36,21 @@ func newBasicAuthConnector(apiEndpoint string, cred *credentialspb.BasicAuth) (*
33
36
}
34
37
35
38
return & basicAuthConnector {
36
- apiClient : apiClient ,
37
- username : cred .Username ,
38
- password : cred .Password ,
39
+ apiClient : apiClient ,
40
+ graphQlClient : githubv4 .NewEnterpriseClient (apiEndpoint , httpClient ),
41
+ username : cred .Username ,
42
+ password : cred .Password ,
39
43
}, nil
40
44
}
41
45
42
46
func (c * basicAuthConnector ) APIClient () * github.Client {
43
47
return c .apiClient
44
48
}
45
49
50
+ func (c * basicAuthConnector ) GraphQLClient () * githubv4.Client {
51
+ return c .graphQlClient
52
+ }
53
+
46
54
func (c * basicAuthConnector ) Clone (ctx context.Context , repoURL string ) (string , * gogit.Repository , error ) {
47
55
return git .CloneRepoUsingToken (ctx , c .password , repoURL , c .username )
48
56
}
0 commit comments