mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-10 07:04:24 +00:00
Add --include-members flag to scan all members of an organization (#118)
* Add --member-repos flag to scan all members of an organization * Move flag to the githubScan sub-command Co-authored-by: Miccah Castorina <miccah.castorina@trufflesec.com>
This commit is contained in:
parent
cedb3393d1
commit
78b344d7b8
2 changed files with 4 additions and 2 deletions
3
main.go
3
main.go
|
@ -53,6 +53,7 @@ func main() {
|
|||
githubScanOrgs := githubScan.Flag("org", `GitHub organization to scan. You can repeat this flag. Example: "trufflesecurity"`).Strings()
|
||||
githubScanToken := githubScan.Flag("token", "GitHub token.").String()
|
||||
githubIncludeForks := githubScan.Flag("include-forks", "Include forks in scan.").Bool()
|
||||
githubIncludeMembers := githubScan.Flag("include-members", "Include organization member repositories in scan.").Bool()
|
||||
|
||||
gitlabScan := cli.Command("gitlab", "Find credentials in GitLab repositories.")
|
||||
// TODO: Add more GitLab options
|
||||
|
@ -138,7 +139,7 @@ func main() {
|
|||
if len(*githubScanOrgs) == 0 && len(*githubScanRepos) == 0 {
|
||||
log.Fatal("You must specify at least one organization or repository.")
|
||||
}
|
||||
err = e.ScanGitHub(ctx, *githubScanEndpoint, *githubScanRepos, *githubScanOrgs, *githubScanToken, *githubIncludeForks, filter, *concurrency)
|
||||
err = e.ScanGitHub(ctx, *githubScanEndpoint, *githubScanRepos, *githubScanOrgs, *githubScanToken, *githubIncludeForks, filter, *concurrency, *githubIncludeMembers)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Fatal("Failed to scan git.")
|
||||
}
|
||||
|
|
|
@ -12,12 +12,13 @@ import (
|
|||
"github.com/trufflesecurity/trufflehog/v3/pkg/sources/github"
|
||||
)
|
||||
|
||||
func (e *Engine) ScanGitHub(ctx context.Context, endpoint string, repos, orgs []string, token string, includeForks bool, filter *common.Filter, concurrency int) error {
|
||||
func (e *Engine) ScanGitHub(ctx context.Context, endpoint string, repos, orgs []string, token string, includeForks bool, filter *common.Filter, concurrency int, includeMembers bool) error {
|
||||
source := github.Source{}
|
||||
connection := sourcespb.GitHub{
|
||||
Endpoint: endpoint,
|
||||
Organizations: orgs,
|
||||
Repositories: repos,
|
||||
ScanUsers: includeMembers,
|
||||
}
|
||||
if len(token) > 0 {
|
||||
connection.Credential = &sourcespb.GitHub_Token{
|
||||
|
|
Loading…
Reference in a new issue