Skip to content

Commit

Permalink
fix broken vet, format some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
zricethezav committed Jun 13, 2023
1 parent fab4f4e commit b1d59bf
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cmd/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func init() {
detectCmd.Flags().Bool("no-git", false, "treat git repo as a regular directory and scan those files, --log-opts has no effect on the scan when --no-git is set")
detectCmd.Flags().Bool("pipe", false, "scan input from stdin, ex: `cat some_file | gitleaks detect --pipe`")
detectCmd.Flags().Bool("follow-symlinks", false, "scan files that are symlinks to other files")
detectCmd.Flags().StringP("gitleaks-ignore-path","i",".","path to .gitleaksignore file or folder containing one")
detectCmd.Flags().StringP("gitleaks-ignore-path", "i", ".", "path to .gitleaksignore file or folder containing one")
}

var detectCmd = &cobra.Command{
Expand Down Expand Up @@ -81,7 +81,7 @@ func runDetect(cmd *cobra.Command, args []string) {
log.Fatal().Err(err).Msg("")
}

gitleaksIgnorePath, err:= cmd.Flags().GetString("gitleaks-ignore-path")
gitleaksIgnorePath, err := cmd.Flags().GetString("gitleaks-ignore-path")
if err != nil {
log.Fatal().Err(err).Msg("could not get .gitleaksignore path")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/generate/config/rules/authress.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func Authress() *config.Rule {
Description: "Authress Service Client Access Key",
RuleID: "authress-service-client-access-key",
SecretGroup: 1,
Regex: generateUniqueTokenRegex(`(?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.acc_[a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120}`),
Regex: generateUniqueTokenRegex(`(?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.acc_[a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120}`),
Keywords: []string{"sc_", "ext_", "scauth_", "authress_"},
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/protect.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
func init() {
protectCmd.Flags().Bool("staged", false, "detect secrets in a --staged state")
protectCmd.Flags().String("log-opts", "", "git log options")
protectCmd.Flags().StringP("gitleaks-ignore-path","i",".","path to .gitleaksignore file or folder containing one")
protectCmd.Flags().StringP("gitleaks-ignore-path", "i", ".", "path to .gitleaksignore file or folder containing one")
rootCmd.AddCommand(protectCmd)
}

Expand Down Expand Up @@ -75,7 +75,7 @@ func runProtect(cmd *cobra.Command, args []string) {
log.Fatal().Err(err).Msg("")
}

gitleaksIgnorePath, err:= cmd.Flags().GetString("gitleaks-ignore-path")
gitleaksIgnorePath, err := cmd.Flags().GetString("gitleaks-ignore-path")
if err != nil {
log.Fatal().Err(err).Msg("could not get .gitleaksignore path")
}
Expand Down
4 changes: 2 additions & 2 deletions detect/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ func (d *Detector) AddGitleaksIgnore(gitleaksIgnorePath string) error {

// https://github.com/securego/gosec/issues/512
defer func() {
if err := file.Close(); err != nil {
if err := file.Close(); err != nil {
log.Warn().Msgf("Error closing .gitleaksignore file: %s\n", err)
}
}()
}()
scanner := bufio.NewScanner(file)

for scanner.Scan() {
Expand Down
2 changes: 1 addition & 1 deletion detect/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func printFinding(f report.Finding, noColor bool) {
skipColor := noColor
finding := ""
var secret lipgloss.Style

// Matches from filenames do not have a |line| or |secret|
if !isFileMatch {
matchInLineIDX := strings.Index(f.Line, f.Match)
Expand Down
2 changes: 1 addition & 1 deletion report/junit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestWriteJunit(t *testing.T) {

for _, test := range tests {
// create tmp file using os.TempDir()
tmpfile, err := os.Create(filepath.Join(tmpPath, test.testReportName+".xml"))
tmpfile, err := os.Create(filepath.Join(t.TempDir(), test.testReportName+".xml"))
if err != nil {
os.Remove(tmpfile.Name())
t.Error(err)
Expand Down

0 comments on commit b1d59bf

Please sign in to comment.