Files
trufflehog/pkg/feature/feature.go
joeleonjrandRichard Gomez 8f2ebc924e Add support for scanning APK files (#3517)
* apk initial

* added a couple tests

* Update pkg/handlers/handlers.go

Co-authored-by: Richard Gomez <[email protected]>

* updating log status

* refactored + added new integration test

* updated test

* fixed linting error

* added keyword-value pairs during dex file scanning

* fixed test

* performance updates

* fixing decodeXML memory issue

* added feature flag

* refactored keyword matching + ahocorasick

* small updates

* refactored for dextk.WithReadCache()

---------

Co-authored-by: Richard Gomez <[email protected]>
2024-11-15 13:25:11 -05:00

36 lines
753 B
Go

package feature
import "sync/atomic"
var (
ForceSkipBinaries atomic.Bool
ForceSkipArchives atomic.Bool
SkipAdditionalRefs atomic.Bool
EnableAPKHandler atomic.Bool
UserAgentSuffix AtomicString
)
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
}