fix broken vet, format some stuff

This commit is contained in:
Zach committed 2023-06-13 16:05:04 -05:00
1 parent fab4f4e97d
commit b1d59bf890
6 files changed
+9 -9

No files matched your search

+2 -2
View File
@@ -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("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("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().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{ var detectCmd = &cobra.Command{
@@ -81,7 +81,7 @@ func runDetect(cmd *cobra.Command, args []string) {
log.Fatal().Err(err).Msg("") log.Fatal().Err(err).Msg("")
} }
gitleaksIgnorePath, err:= cmd.Flags().GetString("gitleaks-ignore-path") gitleaksIgnorePath, err := cmd.Flags().GetString("gitleaks-ignore-path")
if err != nil { if err != nil {
log.Fatal().Err(err).Msg("could not get .gitleaksignore path") log.Fatal().Err(err).Msg("could not get .gitleaksignore path")
} }
+1 -1
View File
@@ -13,7 +13,7 @@ func Authress() *config.Rule {
Description: "Authress Service Client Access Key", Description: "Authress Service Client Access Key",
RuleID: "authress-service-client-access-key", RuleID: "authress-service-client-access-key",
SecretGroup: 1, 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_"}, Keywords: []string{"sc_", "ext_", "scauth_", "authress_"},
} }
+2 -2
View File
@@ -17,7 +17,7 @@ import (
func init() { func init() {
protectCmd.Flags().Bool("staged", false, "detect secrets in a --staged state") protectCmd.Flags().Bool("staged", false, "detect secrets in a --staged state")
protectCmd.Flags().String("log-opts", "", "git log options") 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) rootCmd.AddCommand(protectCmd)
} }
@@ -75,7 +75,7 @@ func runProtect(cmd *cobra.Command, args []string) {
log.Fatal().Err(err).Msg("") log.Fatal().Err(err).Msg("")
} }
gitleaksIgnorePath, err:= cmd.Flags().GetString("gitleaks-ignore-path") gitleaksIgnorePath, err := cmd.Flags().GetString("gitleaks-ignore-path")
if err != nil { if err != nil {
log.Fatal().Err(err).Msg("could not get .gitleaksignore path") log.Fatal().Err(err).Msg("could not get .gitleaksignore path")
} }
+2 -2
View File
@@ -156,10 +156,10 @@ func (d *Detector) AddGitleaksIgnore(gitleaksIgnorePath string) error {
// https://github.com/securego/gosec/issues/512 // https://github.com/securego/gosec/issues/512
defer func() { defer func() {
if err := file.Close(); err != nil { if err := file.Close(); err != nil {
log.Warn().Msgf("Error closing .gitleaksignore file: %s\n", err) log.Warn().Msgf("Error closing .gitleaksignore file: %s\n", err)
} }
}() }()
scanner := bufio.NewScanner(file) scanner := bufio.NewScanner(file)
for scanner.Scan() { for scanner.Scan() {
+1 -1
View File
@@ -101,7 +101,7 @@ func printFinding(f report.Finding, noColor bool) {
skipColor := noColor skipColor := noColor
finding := "" finding := ""
var secret lipgloss.Style var secret lipgloss.Style
// Matches from filenames do not have a |line| or |secret| // Matches from filenames do not have a |line| or |secret|
if !isFileMatch { if !isFileMatch {
matchInLineIDX := strings.Index(f.Line, f.Match) matchInLineIDX := strings.Index(f.Line, f.Match)
+1 -1
View File
@@ -65,7 +65,7 @@ func TestWriteJunit(t *testing.T) {
for _, test := range tests { for _, test := range tests {
// create tmp file using os.TempDir() // 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 { if err != nil {
os.Remove(tmpfile.Name()) os.Remove(tmpfile.Name())
t.Error(err) t.Error(err)