Commit graph

18 commits

Author SHA1 Message Date
Cody Rose
f39a5254ff
Customize results cleaning (using smuggled interface) (#3235)
We have identified some cases in which the results "cleaning" logic (the logic that eliminates superfluous results) should not run. In order to allow this, we need to expose the cleaning logic to the engine. This PR does so by doing these things:

- Create a CustomResultsCleaner interface that can be implemented by detectors that want to use custom cleaning logic
- Implement this interface for the aws and awssessionkey detectors (and remove their previous invocation of their custom cleaning logic)
- Modify the engine to invoke this logic (conditionally)

This PR also removes the "custom" cleaning logic for the opsgenie, razorpay, and twilio detectors, because it was added erroneously.

This is an alternative implementation of #3233.
2024-08-21 09:42:20 -04:00
ahrav
ce1ce29b90
[feat] - Optimize detector performance by reducing data passed to regex (#2812)
* optimize maching detetors

* update method name

* updates

* update naming

* updates

* update comment

* updates

* remove testcase

* update default match len to 512

* update

* update test

* add support for multpart cred provider

* add ability to scan entire chunk

* encapsulate matches logic within FindDetectorMatches

* use []byte directly

* nil chunk data

* use []byte

* set hidden flag to true

* remove

* [refactor] - multi part detectors (#2906)

* Detectors beginning w/ a

* Detectors beginning w/ b

* Detectors beginning w/ c

* Detectors beginning w/ d

* Detectors beginning w/ e

* Detectors beginning w/ f

* Detectors beginning w/ f&g

* fix

* Detectors beginning w/ i-l

* Detectors beginning w/ m-p

* Detectors beginning w/ r-s

* Detectors beginning w/ t

* Detectors beginning w/ u-z

* revert alconst

* remaining fixes

* lint

* [feat] - Add Support for `compareDetectionStrategies` Mode (#2918)

* Detector comparison mode

* remove else

* return error if results dont match

* update default hidden flag to not scan entire chunks

* fix tests

* enhance encapsulation by including methods on DetectorMatch to handle merging and extracting

* remove space

* fix

* update detector

* updates

* remove else

* run comparison concurrently
2024-06-05 13:28:19 -07:00
ahrav
fccf7c9a41
[chore] - Use http.NewRequestWithContext (#2870) 2024-05-22 06:58:12 -07:00
Dustin Decker
14e44db2be
Move detectors.IsKnownFalsePositive from the detectors and into the engine (#2643)
* Remove detectors.IsKnownFalsePositive from detectors

* Centralize false positive removal in engine

* Don't apply fp filtering on custom regex to preserve previous behavior.

* fix empty branch

* update excludes

* update filtering

* Add result flag option and exclude some detectors
2024-04-22 15:18:04 -07:00
ahrav
e44802a31d
[feat] - Replace regexp pkg w/ go-re2 in detectors (#2324)
* update detectors to use go-re regex library replacement

* update go mod and sum

* add tests with invalid utf-8

* revert
2024-01-23 13:16:22 -08:00
Dylan Ayrey
b232ec8b4e
fixing razorpay (#1852)
Co-authored-by: counter <counter@counters-MacBook-Air.local>
2023-10-02 08:49:40 -05:00
ahrav
a5fbc54312
[chore] - update benchmarks. (#1641)
* update benchmarks.

* remove dupe timer reset.
2023-08-23 14:34:10 -07:00
Dustin Decker
eeefde1ec9
Ensure results are collected correctly when verification is off, and dedupe twilio (#1420) 2023-06-23 14:14:08 -07:00
trufflesteeeve
114f4b6989
Add Type() to detector interface (#1088)
* Add Type() to detector interface

The goal here is to allow the detector type information to be used
without the need for reflection. This could possibly allow us to more
easily inject information into detectors or filter them out if
necessary.

Co-authored-by: ahmed <ahmed.zahran@trufflesec.com>

* remove test detector

---------

Co-authored-by: ahmed <ahmed.zahran@trufflesec.com>
2023-02-09 14:46:03 -08:00
Dustin Decker
466b9e2d6b
only detect live env razor pay and use std lib (#869)
* only detect live env razor pay and use std lib

* fix shadowed var
2022-10-26 08:13:13 -07:00
Dustin Decker
2452e93a80
Import 27 new detectors (#737) 2022-08-26 12:35:06 -07:00
Miccah
c4ca7d7c8b
Mark detector tests with a build flag (#613) 2022-07-07 10:27:21 -07:00
ahrav
198cb1a786
Clean up comments. (#562) 2022-05-16 09:03:10 -07:00
Dustin Decker
c80bd5e905 Fix linting and dogfood in CI 2022-03-04 08:39:23 -08:00
Dustin Decker
86c2eb507b Adding detectors (#46)
* rename secret

* Add supporting docs and tooling for adding new detectors
2022-03-04 08:39:22 -08:00
Dustin Decker
c20e9f4732 improvements 2022-03-04 08:39:17 -08:00
Dustin Decker
77418fb3f8 module v3 2022-02-15 18:54:47 -08:00
Dustin Decker
5596025b0b more detectors 2022-02-15 18:46:28 -08:00