mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 05:24:22 +01:00
1 parent
d8cd93cabe
commit
3474c58c9e
58 files changed
+264
-337
No files matched your search
@@ -3,10 +3,8 @@ package rules
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"github.com/zricethezav/gitleaks/v8/detect"
|
||||
)
|
||||
|
||||
func PyPiUploadToken() *config.Rule {
|
||||
@@ -22,15 +20,7 @@ func PyPiUploadToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{"pypiToken := \"pypi-AgEIcHlwaS5vcmc" + sampleHex32Token +
|
||||
sampleHex32Token + "\""}
|
||||
d := detect.NewDetector(config.Config{
|
||||
Rules: []*config.Rule{&r},
|
||||
})
|
||||
for _, tp := range tps {
|
||||
if len(d.DetectString(tp)) != 1 {
|
||||
log.Fatal().Msg("Failed to validate pypi-upload-token")
|
||||
}
|
||||
}
|
||||
return &r
|
||||
tps := []string{"pypiToken := \"pypi-AgEIcHlwaS5vcmc" + secrets.NewSecret(hex("32")) +
|
||||
secrets.NewSecret(hex("32")) + "\""}
|
||||
return validate(r, tps)
|
||||
}
|
||||
Reference in new issue
Block a user