mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 12:14:22 +01:00
fix broken vet, format some stuff
This commit is contained in:
1 parent
fab4f4e97d
commit
b1d59bf890
6 files changed
+9
-9
No files matched your search
+2
-2
@@ -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{
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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_"},
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
+2
-2
@@ -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() {
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user