Skip to content
This repository was archived by the owner on Apr 30, 2021. It is now read-only.

Commit dfc8505

Browse files
author
Yevgeny Pats
committed
bugfix in local regression authentication
1 parent 77f5ca1 commit dfc8505

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

client/agent.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,10 @@ func (c *FuzzitClient) transitionStatus(status string) error {
367367
}
368368

369369
func (c *FuzzitClient) RunLibFuzzer(targetId string, jobId string, updateDB bool, fuzzingType string) error {
370-
if err := c.refreshToken(true); err != nil {
371-
return err
370+
if updateDB {
371+
if err := c.refreshToken(true); err != nil {
372+
return err
373+
}
372374
}
373375

374376
c.targetId = targetId

client/client.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
const FuzzitEndpoint = "https://app.fuzzit.dev"
13-
const Version = "v2.4.44"
13+
const Version = "v2.4.45"
1414

1515
type Target struct {
1616
Name string `firestore:"target_name"`
@@ -69,6 +69,12 @@ type FuzzitClient struct {
6969
updateDB bool // this is mainly used by the agent
7070
}
7171

72+
func NewUnAuthenticatedClient() *FuzzitClient {
73+
c := &FuzzitClient{}
74+
c.httpClient = &http.Client{Timeout: 60 * time.Second}
75+
return c
76+
}
77+
7278
func NewFuzzitClient(apiKey string) (*FuzzitClient, error) {
7379
c := &FuzzitClient{}
7480
c.httpClient = &http.Client{Timeout: 60 * time.Second}

cmd/run.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,23 @@ var runCmd = &cobra.Command{
3232
Args: cobra.ExactArgs(0),
3333
Run: func(cmd *cobra.Command, args []string) {
3434
apiKey := viper.GetString("api-key")
35-
gFuzzitClient, err := client.NewFuzzitClient(apiKey)
35+
gFuzzitClient := client.NewUnAuthenticatedClient()
36+
updateDB, err := cmd.Flags().GetBool("update-db")
3637
if err != nil {
37-
log.Fatalln(err)
38+
log.Fatal(err)
39+
}
40+
if updateDB {
41+
gFuzzitClient, err = client.NewFuzzitClient(apiKey)
42+
if err != nil {
43+
log.Fatalln(err)
44+
}
3845
}
3946

4047
fuzzingType, err := cmd.Flags().GetString("type")
4148
if err != nil {
4249
log.Fatalln(err)
4350
}
4451

45-
updateDB, err := cmd.Flags().GetBool("update-db")
46-
if err != nil {
47-
log.Fatal(err)
48-
}
49-
5052
orgId := os.Getenv("ORG_ID")
5153
if orgId == "" {
5254
log.Fatalln(fmt.Errorf("ORG_ID environment variable should be provided"))

0 commit comments

Comments
 (0)