[INS-467] Add IPinfo detector to default detectors list (#4970)
* Add feature flags for new detectors * Slight rename, ensure the flags are false by default * Missed a name change * Turn on new detectors for OSS user * Instead of only adding flagged detectors when their flag is enabled, remove them when their flag is disabled * Thank you cursorbot * Excempt the flagged detectors from a test * add datadogapikey detector to defaults.go * gate detector behind feature flag * enable the flag on main * make detector list consistent in alphabetical order * add ipinfo detector to default detectors list * gate behind feature flag * add new Result fields to IgnoreFields in integration test --------- Co-authored-by: Charlie Gunyon <[email protected]> Co-authored-by: Charlie Gunyon <[email protected]>
This commit is contained in:
co-authored by
Charlie Gunyon
Charlie Gunyon
parent
53e63918ad
commit
5c2762667c
@@ -555,6 +555,7 @@ func run(state overseer.State, logSync func() error) {
|
||||
feature.NewRelicInsightsInsertKeyDetectorEnabled.Store(true)
|
||||
feature.DuffelTokenDetectorEnabled.Store(true)
|
||||
feature.ShippoDetectorEnabled.Store(true)
|
||||
feature.IPInfoDetectorEnabled.Store(true)
|
||||
|
||||
conf := &config.Config{}
|
||||
if *configFilename != "" {
|
||||
|
||||
@@ -133,11 +133,14 @@ func TestIpinfo_FromChunk(t *testing.T) {
|
||||
if len(got[i].Raw) == 0 {
|
||||
t.Fatalf("no raw secret present: \n %+v", got[i])
|
||||
}
|
||||
if len(got[i].SecretParts) == 0 {
|
||||
t.Fatalf("no secret parts present: \n %+v", got[i])
|
||||
}
|
||||
if (got[i].VerificationError() != nil) != tt.wantVerificationErr {
|
||||
t.Fatalf("wantVerificationError = %v, verification error = %v", tt.wantVerificationErr, got[i].VerificationError())
|
||||
}
|
||||
}
|
||||
ignoreOpts := cmpopts.IgnoreFields(detectors.Result{}, "Raw", "verificationError")
|
||||
ignoreOpts := cmpopts.IgnoreFields(detectors.Result{}, "Raw", "verificationError", "primarySecret", "SecretParts", "chunkOffset", "chunkOffsetSet")
|
||||
if diff := cmp.Diff(got, tt.want, ignoreOpts); diff != "" {
|
||||
t.Errorf("Ipinfo.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
|
||||
}
|
||||
|
||||
@@ -404,6 +404,7 @@ import (
|
||||
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors/ip2location"
|
||||
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors/ipapi"
|
||||
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors/ipgeolocation"
|
||||
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors/ipinfo"
|
||||
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors/ipinfodb"
|
||||
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors/ipquality"
|
||||
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors/ipstack"
|
||||
@@ -1302,6 +1303,7 @@ func buildDetectorList() []detectors.Detector {
|
||||
&ip2location.Scanner{},
|
||||
&ipapi.Scanner{},
|
||||
&ipgeolocation.Scanner{},
|
||||
&ipinfo.Scanner{},
|
||||
&ipinfodb.Scanner{},
|
||||
&ipquality.Scanner{},
|
||||
&ipstack.Scanner{},
|
||||
@@ -1832,6 +1834,8 @@ func buildDetectorList() []detectors.Detector {
|
||||
return !feature.DuffelTokenDetectorEnabled.Load()
|
||||
case *shippo.Scanner:
|
||||
return !feature.ShippoDetectorEnabled.Load()
|
||||
case *ipinfo.Scanner:
|
||||
return !feature.IPInfoDetectorEnabled.Load()
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -118,10 +118,9 @@ var excludedFromDefaultList = map[detector_typepb.DetectorType]struct{}{
|
||||
// to buildDetectorList() — discovered by TestAllDetectorTypesAreInDefaultList.
|
||||
// They are not added immediately out of caution for the impact on customers/users.
|
||||
// Remove each entry once its detector has been carefully added.
|
||||
detector_typepb.DetectorType_Guru: {},
|
||||
detector_typepb.DetectorType_IPInfo: {},
|
||||
detector_typepb.DetectorType_Lob: {},
|
||||
detector_typepb.DetectorType_Tru: {},
|
||||
detector_typepb.DetectorType_Guru: {},
|
||||
detector_typepb.DetectorType_Lob: {},
|
||||
detector_typepb.DetectorType_Tru: {},
|
||||
|
||||
// Feature flag gated detectors
|
||||
// These should be removed from this list when we remove the feature flag
|
||||
@@ -142,6 +141,7 @@ var excludedFromDefaultList = map[detector_typepb.DetectorType]struct{}{
|
||||
detector_typepb.DetectorType_NewRelicInsightsInsertKey: {},
|
||||
detector_typepb.DetectorType_DuffelToken: {},
|
||||
detector_typepb.DetectorType_Shippo: {},
|
||||
detector_typepb.DetectorType_IPInfo: {},
|
||||
|
||||
// Reserved / special types.
|
||||
detector_typepb.DetectorType_CustomRegex: {}, // added dynamically via engine config, not via buildDetectorList()
|
||||
|
||||
@@ -34,6 +34,7 @@ var (
|
||||
NewRelicInsightsInsertKeyDetectorEnabled atomic.Bool
|
||||
DuffelTokenDetectorEnabled atomic.Bool
|
||||
ShippoDetectorEnabled atomic.Bool
|
||||
IPInfoDetectorEnabled atomic.Bool
|
||||
)
|
||||
|
||||
type AtomicString struct {
|
||||
|
||||
Reference in New Issue
Block a user