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

Commit 52cf777

Browse files
author
Yevgeny Pats
committed
add target name validation
1 parent f656ecb commit 52cf777

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

client/commands.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"log"
1818
"os"
1919
"path/filepath"
20+
"regexp"
2021
"strings"
2122
//"github.com/docker/docker/api/types/container"
2223
"github.com/docker/docker/client"
@@ -145,6 +146,11 @@ func (c *fuzzitClient) CreateTarget(targetName string, seedPath string) (*firest
145146
return nil, err
146147
}
147148

149+
re := regexp.MustCompile("^[a-z0-9-]+$")
150+
if !re.MatchString(targetName) {
151+
return nil, fmt.Errorf("target can only contain lowercase characetrs, numbers and hypens")
152+
}
153+
148154
ctx := context.Background()
149155
docRef := c.firestoreClient.Doc("orgs/" + c.Org + "/targets/" + targetName)
150156
_, err = docRef.Get(ctx)

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var cfgFile string
2626
var rootCmd = &cobra.Command{
2727
Use: "fuzzit",
2828
Short: "Continuous fuzzing made simple CLI",
29-
Version: "2.4.10",
29+
Version: "2.4.11",
3030
}
3131

3232
func Execute() {

0 commit comments

Comments
 (0)