authress.go 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. package rules
  2. import (
  3. "fmt"
  4. "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
  5. "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
  6. "github.com/zricethezav/gitleaks/v8/config"
  7. )
  8. func Authress() *config.Rule {
  9. // Rule Definition
  10. // (Note: When changes are made to this, rerun `go generate ./...` and commit the config/gitleaks.toml file
  11. r := config.Rule{
  12. RuleID: "authress-service-client-access-key",
  13. Description: "Uncovered a possible Authress Service Client Access Key, which may compromise access control services and sensitive data.",
  14. Regex: utils.GenerateUniqueTokenRegex(`(?:sc|ext|scauth|authress)_(?i)[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.(?-i:acc)[_-][a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120}`, false),
  15. Entropy: 2,
  16. Keywords: []string{"sc_", "ext_", "scauth_", "authress_"},
  17. }
  18. // validate
  19. // https://authress.io/knowledge-base/docs/authorization/service-clients/secrets-scanning/#1-detection
  20. service_client_id := "sc_" + utils.AlphaNumeric("10")
  21. access_key_id := utils.AlphaNumeric("4")
  22. account_id := "acc_" + utils.AlphaNumeric("10")
  23. signature_key := utils.AlphaNumericExtendedShort("40")
  24. tps := utils.GenerateSampleSecrets("authress", secrets.NewSecret(fmt.Sprintf(`%s\.%s\.%s\.%s`, service_client_id, access_key_id, account_id, signature_key)))
  25. return utils.Validate(r, tps, nil)
  26. }