Files
trufflehog/pkg/feature/feature.go
Dave HubbardandCursor 080c22fb8e [INT-942] Add HumioAPIToken detector (#5258)
* [INT-942] Add HumioAPIToken detector

Add a TruffleHog detector for Humio/CrowdStrike Falcon LogScale API
tokens. These are personal and repository-scoped tokens in a
tilde-delimited base62 format ({24 or 32}~{44}) that grant read/write
access to LogScale repositories via the REST and GraphQL APIs.

Verification uses the read-only GET /api/v1/health-json endpoint.
Known SaaS regions (US and EU) are tried automatically; self-hosted or
CrowdStrike regional instances are supported via explicit endpoint
configuration. ExtraData surfaces token type (Personal API Token vs
Repository API Token) based on prefix length.

Feature-flag gated behind HumioAPITokenDetectorEnabled.

Co-authored-by: Cursor <[email protected]>

* Use realistic test inputs for pattern matching

Replace synthetic one-liner inputs with multi-line snippets that
mirror real-world contexts: Python client config, .env file, Docker
Compose environment block. Adopt require.NoError from testify to
match the convention in solarwindsobservability_test.go.

Co-authored-by: Cursor <[email protected]>

* Use url.JoinPath for verification endpoint URLs

Replace string concatenation with url.JoinPath to safely construct
verification URLs from base endpoints.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>
2026-09-08 09:22:21 -04:00

80 lines
3.1 KiB
Go

package feature
import (
"sync/atomic"
)
var (
ForceSkipBinaries atomic.Bool
ForceSkipArchives atomic.Bool
GitCloneTimeoutDuration atomic.Int64
SkipAdditionalRefs atomic.Bool
EnableAPKHandler atomic.Bool
UserAgentSuffix AtomicString
UseSimplifiedGitlabEnumeration atomic.Bool
UseGitMirror atomic.Bool
GitlabProjectsPerPage atomic.Int64
UseGithubGraphQLAPI atomic.Bool // use github graphql api to fetch issues, pr's and comments
HTMLDecoderEnabled atomic.Bool
PineconeDetectorEnabled atomic.Bool
CloudinaryDetectorEnabled atomic.Bool
GitLabOAuthDetectorEnabled atomic.Bool
SonarCloudV2DetectorEnabled atomic.Bool
EnigmaDetectorEnabled atomic.Bool
DatadogApiKeyDetectorEnabled atomic.Bool
TlyDetectorEnabled atomic.Bool
WitDetectorEnabled atomic.Bool
RevDetectorEnabled atomic.Bool
UserDetectorEnabled atomic.Bool
BraintrustDetectorEnabled atomic.Bool
PgAnalyzeReadKeyDetectorEnabled atomic.Bool
RedHatPyxisDetectorEnabled atomic.Bool
OctopusDeployDetectorEnabled atomic.Bool
DropUnverifiedJWTResults atomic.Bool
OpenRouterDetectorEnabled atomic.Bool
NewRelicInsightsInsertKeyDetectorEnabled atomic.Bool
DuffelTokenDetectorEnabled atomic.Bool
ShippoDetectorEnabled atomic.Bool
IPInfoDetectorEnabled atomic.Bool
LobDetectorEnabled atomic.Bool
HashiCorpVaultBatchTokenDetectorEnabled atomic.Bool
HashiCorpVaultTokenDetectorEnabled atomic.Bool
CloudflareApiTokenV2DetectorEnabled atomic.Bool
CloudflareGlobalApiKeyV2DetectorEnabled atomic.Bool
DuoDetectorEnabled atomic.Bool
FigmaV3DetectorEnabled atomic.Bool
NewRelicLicenseKeyDetectorEnabled atomic.Bool
NewRelicBrowserKeyDetectorEnabled atomic.Bool
NewRelicUserKeyDetectorEnabled atomic.Bool
NewRelicInsightsQueryKeyDetectorEnabled atomic.Bool
NewRelicMobileAppTokenDetectorEnabled atomic.Bool
MSTeamsWebhookV2DetectorEnabled atomic.Bool
SolarwindsDetectorEnabled atomic.Bool
WeightsAndBiasesV2DetectorEnabled atomic.Bool
HumioAPITokenDetectorEnabled atomic.Bool
)
type AtomicString struct {
value atomic.Value
}
// Load returns the current value of the atomic string
func (as *AtomicString) Load() string {
if v := as.value.Load(); v != nil {
return v.(string)
}
return ""
}
// Store sets the value of the atomic string
func (as *AtomicString) Store(newValue string) {
as.value.Store(newValue)
}
// Swap atomically swaps the current string with a new one and returns the old value
func (as *AtomicString) Swap(newValue string) string {
oldValue := as.Load()
as.Store(newValue)
return oldValue
}