File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,11 +21,12 @@ var (
2121 // Use the SSRF-safe client that blocks requests to local/private IP ranges.
2222 client = detectors .DetectorHttpClientWithNoLocalAddresses
2323
24- // Rancher API tokens: 54–64 lowercase alphanumeric chars, named with cattle/rancher prefixes.
25- keyPat = regexp .MustCompile (`(?i)(?:CATTLE_TOKEN|RANCHER_TOKEN|CATTLE_BOOTSTRAP_PASSWORD|RANCHER_API_TOKEN)[\w]*\s*[=:]\s*["']?([a-z0-9]{54,64})["']?` )
24+ // Match variable name case-insensitively via (?i:...) scope, then require strictly
25+ // lowercase alphanumeric token to avoid false positives from the broad character set.
26+ keyPat = regexp .MustCompile (`(?i:(?:CATTLE_TOKEN|RANCHER_TOKEN|CATTLE_BOOTSTRAP_PASSWORD|RANCHER_API_TOKEN)[\w]*\s*[=:]\s*["']?)([a-z0-9]{54,64})["']?` )
2627
2728 // Server URL used for validation; must appear nearby in the same chunk.
28- serverPat = regexp .MustCompile (`(?i) (?:CATTLE_SERVER|RANCHER_URL|RANCHER_SERVER)\s*[=:]\s*["']?(https?://[^\s"']+)["']?` )
29+ serverPat = regexp .MustCompile (`(?i: (?:CATTLE_SERVER|RANCHER_URL|RANCHER_SERVER)\s*[=:]\s*["']?) (https?://[^\s"']+)["']?` )
2930)
3031
3132func (s Scanner ) Keywords () []string {
Original file line number Diff line number Diff line change @@ -609,6 +609,7 @@ import (
609609 "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/rabbitmq"
610610 "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/railwayapp"
611611 "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/ramp"
612+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/rancher"
612613 "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/rapidapi"
613614 "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/rawg"
614615 "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/razorpay"
@@ -709,7 +710,6 @@ import (
709710 "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/sonarcloud"
710711 "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/sourcegraph"
711712 "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/sourcegraphcody"
712- "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/rancher"
713713 "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/spectralops"
714714 "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/speechtextai"
715715 "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/splunkobservabilitytoken"
@@ -1502,6 +1502,7 @@ func buildDetectorList() []detectors.Detector {
15021502 & rabbitmq.Scanner {},
15031503 & railwayapp.Scanner {},
15041504 & ramp.Scanner {},
1505+ & rancher.Scanner {},
15051506 & rapidapi.Scanner {},
15061507 // &raven.Scanner{},
15071508 & rawg.Scanner {},
@@ -1606,7 +1607,6 @@ func buildDetectorList() []detectors.Detector {
16061607 & sourcegraph.Scanner {},
16071608 & sourcegraphcody.Scanner {},
16081609 // &sparkpost.Scanner{},
1609- & rancher.Scanner {},
16101610 & spectralops.Scanner {},
16111611 & speechtextai.Scanner {},
16121612 & splunkobservabilitytoken.Scanner {},
You can’t perform that action at this time.
0 commit comments