-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a flag to disable ssl verify #2905
base: main
Are you sure you want to change the base?
Conversation
bc5f5d1
to
ae43a9b
Compare
cd9eb96
to
ea06b39
Compare
Slapping a draft label on this since it's an incomplete POC |
It could use a review to determine whether it's worth putting any more effort into. |
I like the idea, but I'm a bit nervous about the global variable. Is there a way to use the flag to construct the transport instead? I'm concerned that it's too easy for anyone to reach into the transport and change the TLSConfig. That being said, if others are okay with this approach, I won't object. 😅 |
It's a bit of a smell. I couldn't think of an easier way to propagate such a value to multiple packages before the dependent code initializes. |
8864c74
to
4866a8f
Compare
4866a8f
to
0289e10
Compare
864bff4
to
e6cc78b
Compare
Unfortunately, it seems this isn't possible. The hundreds of detectors with logic like As far as I'm aware, there's no equivalent to something like Kotlin's |
For this to work, the top-level var would need to be replaced with a lazy initialization. trufflehog/pkg/detectors/scrapingbee/scrapingbee.go Lines 61 to 63 in 316316e
|
28f6bfe
to
dcfd02a
Compare
I've managed to partially solve this, at least for detectors that were using |
d6edbe8
to
dc5983e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory, if you could toggle ssl-verify
while the scan was running, changes to it wouldn't affect detectors that had already been initialized, right?
If so - and I really hate to be the bearer of bad news on this - that means the new feature flag operates differently from the other defined ones in a way that actually matters not to you (or any other OSS user) but to TruffleHog Enterprise, which also uses this code. TruffleHog Enterprise runs as a persistent daemon, so we need the ability to dynamically toggle feature flags of running processes and have the changes be reflected. Having some flags require scanner restarts and other flags not require them is an accident waiting to happen.
I know this kind of sends you back to the drawing board, but I really want to avoid some future person having a really irritating surprise.
(Or I'm misreading this and imagined a problem that doesn't exist!)
That is correct for HTTP-based detectors. Non-HTTP detectors like MongoDB would work dynamically. Detectors that use Since this pattern is literally from the first commit of v3, I think a change of that scale is probably outside of the scope of this. :/ |
8148920
to
592b1fb
Compare
Description:
This creates an experimental flag to disable SSL verification for detectors. This is useful in corporate environments where MITMing SSL traffic is common and certificates are replaced with self-signed ones.
This implementation is an incomplete POC.
Checklist:
make test-community
)?make lint
this requires golangci-lint)?