authress.go 1.2 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. // Rule Definition
  9. // (Note: When changes are made to this, rerun `go generate ./...` and commit the config/gitleaks.toml file
  10. r := config.Rule{
  11. Description: "Uncovered a possible Authress Service Client Access Key, which may compromise access control services and sensitive data.",
  12. RuleID: "authress-service-client-access-key",
  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}`, true),
  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. }