authress.go 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. package rules
  2. import (
  3. "fmt"
  4. "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
  5. "github.com/zricethezav/gitleaks/v8/config"
  6. )
  7. func Authress() *config.Rule {
  8. // define rule
  9. r := config.Rule{
  10. Description: "Authress Service Client Access Key",
  11. RuleID: "authress-service-client-access-key",
  12. SecretGroup: 1,
  13. 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}`),
  14. Keywords: []string{"sc_", "ext_", "scauth_", "authress_"},
  15. }
  16. // validate
  17. // https://authress.io/knowledge-base/docs/authorization/service-clients/secrets-scanning/#1-detection
  18. service_client_id := "sc_" + alphaNumeric("10")
  19. access_key_id := alphaNumeric("4")
  20. account_id := "acc_" + alphaNumeric("10")
  21. signature_key := alphaNumericExtendedShort("40")
  22. tps := []string{
  23. generateSampleSecret("authress", secrets.NewSecret(fmt.Sprintf(`%s\.%s\.%s\.%s`, service_client_id, access_key_id, account_id, signature_key))),
  24. }
  25. return validate(r, tps, nil)
  26. }