ruledefine

package
v5.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const TagAccessId = "access-id"
View Source
const TagAccessKey = "access-key"
View Source
const TagAccessToken = "access-token"
View Source
const TagApiKey = "api-key"
View Source
const TagApiToken = "api-token"
View Source
const TagClientId = "client-id"
View Source
const TagClientSecret = "client-secret"
View Source
const TagEncryptionKey = "encryption-key"
View Source
const TagPassword = "password"
View Source
const TagPrivateKey = "private-key"
View Source
const TagPublicKey = "public-key"
View Source
const TagPublicSecret = "public-secret"
View Source
const TagRefreshToken = "refresh-token"
View Source
const TagRegistrationToken = "registration-token"
View Source
const TagSecretKey = "secret-key"
View Source
const TagSensitiveUrl = "sensitive-url"
View Source
const TagTriggerToken = "trigger-token"
View Source
const TagUploadToken = "upload-token"
View Source
const TagWebhook = "webhook"

Variables

View Source
var DefaultStopWords = []string{}/* 1476 elements not displayed */
View Source
var SeverityOrder = []Severity{Critical, High, Medium, Low, Info}

Functions

func AlphaNumeric

func AlphaNumeric(size string) string

func AlphaNumericExtended

func AlphaNumericExtended(size string) string

func AlphaNumericExtendedLong

func AlphaNumericExtendedLong(size string) string

func AlphaNumericExtendedShort

func AlphaNumericExtendedShort(size string) string

func Hex

func Hex(size string) string

func Hex8_4_4_4_12

func Hex8_4_4_4_12() string

func Numeric

func Numeric(size string) string

func TwomsToGitleaksRule

func TwomsToGitleaksRule(rule *Rule) *gitleaksrule.Rule

Types

type AllowList

type AllowList struct {
	Description    string   `json:"description,omitempty" yaml:"description,omitempty"`
	MatchCondition string   `json:"matchCondition,omitempty" yaml:"matchCondition,omitempty"` //nolint:lll // determines whether all criteria must match. OR or AND
	Paths          []string `json:"paths,omitempty" yaml:"paths,omitempty"`                   // regex
	RegexTarget    string   `json:"regexTarget,omitempty" yaml:"regexTarget,omitempty"`       // match or line. Default match
	Regexes        []string `json:"regexes,omitempty" yaml:"regexes,omitempty"`
	StopWords      []string `json:"stopWords,omitempty" yaml:"stopWords,omitempty"` // stop words that are allowed to be ignored
}

type Rule

type Rule struct {
	RuleID            string       `json:"ruleId,omitempty" yaml:"ruleId,omitempty"` // uuid4, should be consistent across changes in rule
	RuleName          string       `json:"ruleName,omitempty" yaml:"ruleName,omitempty"`
	Description       string       `json:"description,omitempty" yaml:"description,omitempty"`
	Regex             string       `json:"regex,omitempty" yaml:"regex,omitempty"` // regex pattern as string
	Keywords          []string     `json:"keywords,omitempty" yaml:"keywords,omitempty"`
	Entropy           float64      `json:"entropy,omitempty" yaml:"entropy,omitempty"`
	Path              string       `json:"path,omitempty" yaml:"path,omitempty"`               // present in some gitleaks secrets (regex)
	SecretGroup       int          `json:"secretGroup,omitempty" yaml:"secretGroup,omitempty"` //nolint:lll // SecretGroup is used to extract secret from regex match and used as the group that will have its entropy checked if `entropy` is set.
	Severity          Severity     `json:"severity,omitempty" yaml:"severity,omitempty"`
	OldSeverity       string       `json:"oldSeverity,omitempty" yaml:"oldSeverity,omitempty"` //nolint:lll // fallback for when critical is not enabled, has no effect on open source
	AllowLists        []*AllowList `json:"allowLists,omitempty" yaml:"allowLists,omitempty"`
	Tags              []string     `json:"tags,omitempty" yaml:"tags,omitempty"`
	Category          RuleCategory `json:"category,omitempty" yaml:"category,omitempty"`                   // used for cvssScore
	ScoreRuleType     uint8        `json:"scoreRuleType,omitempty" yaml:"scoreRuleType,omitempty"`         // used for cvssScore
	DisableValidation bool         `json:"disableValidation,omitempty" yaml:"disableValidation,omitempty"` ////nolint:lll // if true, validation checks will be skipped for this rule if any validation is possible
	Deprecated        bool         `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
}

func AWS

func AWS() *Rule

func AdafruitAPIKey

func AdafruitAPIKey() *Rule

func AdobeClientID

func AdobeClientID() *Rule

func AdobeClientSecret

func AdobeClientSecret() *Rule

func AgeSecretKey

func AgeSecretKey() *Rule

func Airtable

func Airtable() *Rule

func AlgoliaApiKey

func AlgoliaApiKey() *Rule

func AlibabaAccessKey

func AlibabaAccessKey() *Rule

func AlibabaSecretKey

func AlibabaSecretKey() *Rule

func AnthropicAdminApiKey

func AnthropicAdminApiKey() *Rule

func AnthropicApiKey

func AnthropicApiKey() *Rule

func AsanaClientID

func AsanaClientID() *Rule

func AsanaClientSecret

func AsanaClientSecret() *Rule

func Atlassian

func Atlassian() *Rule

func AuthenticatedURL

func AuthenticatedURL() *Rule

func Authress

func Authress() *Rule

func AzureActiveDirectoryClientSecret

func AzureActiveDirectoryClientSecret() *Rule

func Beamer

func Beamer() *Rule

func BitBucketClientID

func BitBucketClientID() *Rule

func BitBucketClientSecret

func BitBucketClientSecret() *Rule

func BittrexAccessKey

func BittrexAccessKey() *Rule

func BittrexSecretKey

func BittrexSecretKey() *Rule

func ClickHouseCloud

func ClickHouseCloud() *Rule

func Clojars

func Clojars() *Rule

func CloudflareAPIKey

func CloudflareAPIKey() *Rule

func CloudflareGlobalAPIKey

func CloudflareGlobalAPIKey() *Rule

func CloudflareOriginCAKey

func CloudflareOriginCAKey() *Rule

func CodecovAccessToken

func CodecovAccessToken() *Rule

func CohereAPIToken

func CohereAPIToken() *Rule

func CoinbaseAccessToken

func CoinbaseAccessToken() *Rule

func ConfluentAccessToken

func ConfluentAccessToken() *Rule

func ConfluentSecretKey

func ConfluentSecretKey() *Rule

func Contentful

func Contentful() *Rule

func CurlBasicAuth

func CurlBasicAuth() *Rule

func CurlHeaderAuth

func CurlHeaderAuth() *Rule

func Databricks

func Databricks() *Rule

func DatadogtokenAccessToken

func DatadogtokenAccessToken() *Rule

func DefinedNetworkingAPIToken

func DefinedNetworkingAPIToken() *Rule

func DigitalOceanOAuthToken

func DigitalOceanOAuthToken() *Rule

func DigitalOceanPAT

func DigitalOceanPAT() *Rule

func DigitalOceanRefreshToken

func DigitalOceanRefreshToken() *Rule

func DiscordAPIToken

func DiscordAPIToken() *Rule

func DiscordClientID

func DiscordClientID() *Rule

func DiscordClientSecret

func DiscordClientSecret() *Rule

func Doppler

func Doppler() *Rule

func DroneciAccessToken

func DroneciAccessToken() *Rule

func DropBoxAPISecret

func DropBoxAPISecret() *Rule

func DropBoxLongLivedAPIToken

func DropBoxLongLivedAPIToken() *Rule

func DropBoxShortLivedAPIToken

func DropBoxShortLivedAPIToken() *Rule

func Duffel

func Duffel() *Rule

func Dynatrace

func Dynatrace() *Rule

func EasyPost

func EasyPost() *Rule

func EasyPostTestAPI

func EasyPostTestAPI() *Rule

func EtsyAccessToken

func EtsyAccessToken() *Rule

func FacebookAccessToken

func FacebookAccessToken() *Rule

func FacebookPageAccessToken

func FacebookPageAccessToken() *Rule

func FacebookSecret

func FacebookSecret() *Rule

func FastlyAPIToken

func FastlyAPIToken() *Rule

func FinicityAPIToken

func FinicityAPIToken() *Rule

func FinicityClientSecret

func FinicityClientSecret() *Rule

func FinnhubAccessToken

func FinnhubAccessToken() *Rule

func FlickrAccessToken

func FlickrAccessToken() *Rule

func FlutterwaveEncKey

func FlutterwaveEncKey() *Rule

func FlutterwavePublicKey

func FlutterwavePublicKey() *Rule

func FlutterwaveSecretKey

func FlutterwaveSecretKey() *Rule

func FlyIOAccessToken

func FlyIOAccessToken() *Rule

func FrameIO

func FrameIO() *Rule

func Freemius

func Freemius() *Rule

func FreshbooksAccessToken

func FreshbooksAccessToken() *Rule

func GCPAPIKey

func GCPAPIKey() *Rule

func GenericCredential

func GenericCredential() *Rule

func GitHubApp

func GitHubApp() *Rule

func GitHubFineGrainedPat

func GitHubFineGrainedPat() *Rule

func GitHubOauth

func GitHubOauth() *Rule

func GitHubPat

func GitHubPat() *Rule

func GitHubRefresh

func GitHubRefresh() *Rule

func GitlabCiCdJobToken

func GitlabCiCdJobToken() *Rule

func GitlabDeployToken

func GitlabDeployToken() *Rule

func GitlabFeatureFlagClientToken

func GitlabFeatureFlagClientToken() *Rule

func GitlabFeedToken

func GitlabFeedToken() *Rule

func GitlabIncomingMailToken

func GitlabIncomingMailToken() *Rule

func GitlabKubernetesAgentToken

func GitlabKubernetesAgentToken() *Rule

func GitlabOauthAppSecret

func GitlabOauthAppSecret() *Rule

func GitlabPat

func GitlabPat() *Rule

func GitlabPatRoutable

func GitlabPatRoutable() *Rule

func GitlabPipelineTriggerToken

func GitlabPipelineTriggerToken() *Rule

func GitlabRunnerAuthenticationToken

func GitlabRunnerAuthenticationToken() *Rule

func GitlabRunnerAuthenticationTokenRoutable

func GitlabRunnerAuthenticationTokenRoutable() *Rule

func GitlabRunnerRegistrationToken

func GitlabRunnerRegistrationToken() *Rule

func GitlabScimToken

func GitlabScimToken() *Rule

func GitlabSessionCookie

func GitlabSessionCookie() *Rule

func GitterAccessToken

func GitterAccessToken() *Rule

func GoCardless

func GoCardless() *Rule

func GrafanaApiKey

func GrafanaApiKey() *Rule

func GrafanaCloudApiToken

func GrafanaCloudApiToken() *Rule

func GrafanaServiceAccountToken

func GrafanaServiceAccountToken() *Rule

func HardcodedPassword

func HardcodedPassword() *Rule

func HashiCorpTerraform

func HashiCorpTerraform() *Rule

func HashicorpField

func HashicorpField() *Rule

func Heroku

func Heroku() *Rule

func HerokuV2

func HerokuV2() *Rule

func HubSpot

func HubSpot() *Rule

func HuggingFaceAccessToken

func HuggingFaceAccessToken() *Rule

func HuggingFaceOrganizationApiToken

func HuggingFaceOrganizationApiToken() *Rule

func InfracostAPIToken

func InfracostAPIToken() *Rule

func Intercom

func Intercom() *Rule

func Intra42ClientSecret

func Intra42ClientSecret() *Rule

func JFrogAPIKey

func JFrogAPIKey() *Rule

func JFrogIdentityToken

func JFrogIdentityToken() *Rule

func JWT

func JWT() *Rule

func JWTBase64

func JWTBase64() *Rule

func KrakenAccessToken

func KrakenAccessToken() *Rule

func KubernetesSecret

func KubernetesSecret() *Rule

func KucoinAccessToken

func KucoinAccessToken() *Rule

func KucoinSecretKey

func KucoinSecretKey() *Rule

func LaunchDarklyAccessToken

func LaunchDarklyAccessToken() *Rule

func LinearAPIToken

func LinearAPIToken() *Rule

func LinearClientSecret

func LinearClientSecret() *Rule

func LinkedinClientID

func LinkedinClientID() *Rule

func LinkedinClientSecret

func LinkedinClientSecret() *Rule

func LobAPIToken

func LobAPIToken() *Rule

func LobPubAPIToken

func LobPubAPIToken() *Rule

func MailChimp

func MailChimp() *Rule

func MailGunPrivateAPIToken

func MailGunPrivateAPIToken() *Rule

func MailGunPubAPIToken

func MailGunPubAPIToken() *Rule

func MailGunSigningKey

func MailGunSigningKey() *Rule

func MapBox

func MapBox() *Rule

func MattermostAccessToken

func MattermostAccessToken() *Rule

func MaxMindLicenseKey

func MaxMindLicenseKey() *Rule

func Meraki

func Meraki() *Rule

func MessageBirdAPIToken

func MessageBirdAPIToken() *Rule

func MessageBirdClientID

func MessageBirdClientID() *Rule

func NPM

func NPM() *Rule

func NetlifyAccessToken

func NetlifyAccessToken() *Rule

func NewRelicBrowserAPIKey

func NewRelicBrowserAPIKey() *Rule

func NewRelicInsertKey

func NewRelicInsertKey() *Rule

func NewRelicUserID

func NewRelicUserID() *Rule

func NewRelicUserKey

func NewRelicUserKey() *Rule

func Notion

func Notion() *Rule

func NugetConfigPassword

func NugetConfigPassword() *Rule

func NytimesAccessToken

func NytimesAccessToken() *Rule

func OctopusDeployApiKey

func OctopusDeployApiKey() *Rule

func OktaAccessToken

func OktaAccessToken() *Rule

func OnePasswordSecretKey

func OnePasswordSecretKey() *Rule

func OnePasswordServiceAccountToken

func OnePasswordServiceAccountToken() *Rule

func OpenAI

func OpenAI() *Rule

func OpenshiftUserToken

func OpenshiftUserToken() *Rule

func PerplexityAPIKey

func PerplexityAPIKey() *Rule

func PlaidAccessID

func PlaidAccessID() *Rule

func PlaidAccessToken

func PlaidAccessToken() *Rule

func PlaidSecretKey

func PlaidSecretKey() *Rule

func PlanetScaleAPIToken

func PlanetScaleAPIToken() *Rule

func PlanetScaleOAuthToken

func PlanetScaleOAuthToken() *Rule

func PlanetScalePassword

func PlanetScalePassword() *Rule

func PostManAPI

func PostManAPI() *Rule

func Prefect

func Prefect() *Rule

func PrivateAIToken

func PrivateAIToken() *Rule

func PrivateKey

func PrivateKey() *Rule

func PulumiAPIToken

func PulumiAPIToken() *Rule

func PyPiUploadToken

func PyPiUploadToken() *Rule

func RapidAPIAccessToken

func RapidAPIAccessToken() *Rule

func ReadMe

func ReadMe() *Rule

func RubyGemsAPIToken

func RubyGemsAPIToken() *Rule

func ScalingoAPIToken

func ScalingoAPIToken() *Rule

func SendGridAPIToken

func SendGridAPIToken() *Rule

func SendInBlueAPIToken

func SendInBlueAPIToken() *Rule

func SendbirdAccessID

func SendbirdAccessID() *Rule

func SendbirdAccessToken

func SendbirdAccessToken() *Rule

func SentryAccessToken

func SentryAccessToken() *Rule

func SentryOrgToken

func SentryOrgToken() *Rule

func SentryUserToken

func SentryUserToken() *Rule

func SettlemintApplicationAccessToken

func SettlemintApplicationAccessToken() *Rule

func SettlemintPersonalAccessToken

func SettlemintPersonalAccessToken() *Rule

func SettlemintServiceAccessToken

func SettlemintServiceAccessToken() *Rule

func ShippoAPIToken

func ShippoAPIToken() *Rule

func ShopifyAccessToken

func ShopifyAccessToken() *Rule

func ShopifyCustomAccessToken

func ShopifyCustomAccessToken() *Rule

func ShopifyPrivateAppAccessToken

func ShopifyPrivateAppAccessToken() *Rule

func ShopifySharedSecret

func ShopifySharedSecret() *Rule

func SidekiqSecret

func SidekiqSecret() *Rule

func SidekiqSensitiveUrl

func SidekiqSensitiveUrl() *Rule

func SlackAppLevelToken

func SlackAppLevelToken() *Rule

func SlackBotToken

func SlackBotToken() *Rule

func SlackConfigurationRefreshToken

func SlackConfigurationRefreshToken() *Rule

func SlackConfigurationToken

func SlackConfigurationToken() *Rule

func SlackLegacyBotToken

func SlackLegacyBotToken() *Rule

func SlackLegacyToken

func SlackLegacyToken() *Rule

func SlackLegacyWorkspaceToken

func SlackLegacyWorkspaceToken() *Rule

func SlackUserToken

func SlackUserToken() *Rule

func SlackWebHookUrl

func SlackWebHookUrl() *Rule

func Snyk

func Snyk() *Rule

func SquareAccessToken

func SquareAccessToken() *Rule

func SquareSpaceAccessToken

func SquareSpaceAccessToken() *Rule

func StripeAccessToken

func StripeAccessToken() *Rule

func SumoLogicAccessID

func SumoLogicAccessID() *Rule

func SumoLogicAccessToken

func SumoLogicAccessToken() *Rule

func TeamsWebhook

func TeamsWebhook() *Rule

func TelegramBotToken

func TelegramBotToken() *Rule

func TravisCIAccessToken

func TravisCIAccessToken() *Rule

func Twilio

func Twilio() *Rule

func TwitchAPIToken

func TwitchAPIToken() *Rule

func TwitterAPIKey

func TwitterAPIKey() *Rule

func TwitterAPISecret

func TwitterAPISecret() *Rule

func TwitterAccessSecret

func TwitterAccessSecret() *Rule

func TwitterAccessToken

func TwitterAccessToken() *Rule

func TwitterBearerToken

func TwitterBearerToken() *Rule

func Typeform

func Typeform() *Rule

func VaultBatchToken

func VaultBatchToken() *Rule

func VaultServiceToken

func VaultServiceToken() *Rule

func YandexAPIKey

func YandexAPIKey() *Rule

func YandexAWSAccessToken

func YandexAWSAccessToken() *Rule

func YandexAccessToken

func YandexAccessToken() *Rule

func ZendeskSecretKey

func ZendeskSecretKey() *Rule

func (*Rule) CreateRuleNameFromRuleID

func (r *Rule) CreateRuleNameFromRuleID()

type RuleCategory

type RuleCategory string
const (
	CategoryAuthenticationAndAuthorization RuleCategory = "Authentication and Authorization"
	CategoryCryptocurrencyExchange         RuleCategory = "Cryptocurrency Exchange"
	CategoryFinancialServices              RuleCategory = "Financial Services"
	CategoryPaymentProcessing              RuleCategory = "Payment Processing"
	CategorySecurity                       RuleCategory = "Security"
	CategoryAPIAccess                      RuleCategory = "API Access"
	CategoryCICD                           RuleCategory = "CI/CD"
	CategoryCloudPlatform                  RuleCategory = "Cloud Platform"
	CategoryDatabaseAsAService             RuleCategory = "Database as a Service"
	CategoryDevelopmentPlatform            RuleCategory = "Development Platform"
	CategoryEmailDeliveryService           RuleCategory = "Email Delivery Service"
	CategoryInfrastructureAsCode           RuleCategory = "Infrastructure as Code (IaC)"
	CategoryPackageManagement              RuleCategory = "Package Management"
	CategorySourceCodeManagement           RuleCategory = "Source Code Management"
	CategoryWebHostingAndDeployment        RuleCategory = "Web Hosting and Deployment"
	CategoryBackgroundProcessingService    RuleCategory = "Background Processing Service"
	CategoryCDN                            RuleCategory = "CDN (Content Delivery Network)"
	CategoryContentManagementSystem        RuleCategory = "Content Management System (CMS)"
	CategoryCustomerSupport                RuleCategory = "Customer Support"
	CategoryDataAnalytics                  RuleCategory = "Data Analytics"
	CategoryFileStorageAndSharing          RuleCategory = "File Storage and Sharing"
	CategoryIoTPlatform                    RuleCategory = "IoT platform"
	CategoryMappingAndLocationServices     RuleCategory = "Mapping and Location Services"
	CategoryNetworking                     RuleCategory = "Networking"
	CategoryPhotoSharing                   RuleCategory = "Photo Sharing"
	CategorySaaS                           RuleCategory = "SaaS"
	CategoryShipping                       RuleCategory = "Shipping"
	CategorySoftwareDevelopment            RuleCategory = "Software Development"
	CategoryAIAndMachineLearning           RuleCategory = "AI and Machine Learning"
	CategoryApplicationMonitoring          RuleCategory = "Application Monitoring"
	CategoryECommercePlatform              RuleCategory = "E-commerce Platform"
	CategoryMarketingAutomation            RuleCategory = "Marketing Automation"
	CategoryNewsAndMedia                   RuleCategory = "News and Media"
	CategoryOnlineSurveyPlatform           RuleCategory = "Online Survey Platform"
	CategoryProjectManagement              RuleCategory = "Project Management"
	CategorySearchService                  RuleCategory = "Search Service"
	CategorySocialMedia                    RuleCategory = "Social Media"
	CategoryGeneralOrUnknown               RuleCategory = "General"
)

type Severity

type Severity string

define severity

const (
	Critical Severity = "Critical"
	High     Severity = "High"
	Medium   Severity = "Medium"
	Low      Severity = "Low"
	Info     Severity = "Info"
)

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL