-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Move verify flag into detectableChunk
#4558
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
base: main
Are you sure you want to change the base?
Conversation
I was poking around at a refactor idea (in #4558) and realized that it had no test coverage. This PR adds that test coverage. I think I uncovered a bug in the process - see a comment in one of the tests.
e69e95f to
802b672
Compare
mcastorina
left a comment
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.
Love this! I always found it confusing the two uses of "verify".
Why does a source need this information anyway, though? Could we lift this up a level and centralize it in the SourceManager like we do with JobID here (+2 other locations in that file)?
trufflehog/pkg/sources/source_manager.go
Lines 499 to 501 in 35a5bf2
| chunk.JobID = source.JobID() | |
| report.ReportChunk(nil, chunk) | |
| s.outputChunks <- chunk |
Also, this would be a breaking change to enterprise sources, right?
|
Re: Miccah's comment, we can do a bridging change where we support both fields in enterprise, do the cutover, then remove the old field. |
Yeah, I have idle plans to change all of this even more aggressively. I want to take things very slow, though, and do it as a bunch of smaller changes. It will break enterprise sources, but the required change is simple enough that I was planning to make it immediately after merging this as part of the dependency update. |
Description:
Chunk.Verifyis an odd field - it originally conveys whether a source is going to run with verification, but then, at a certain point in the scanning pipeline, is mutated such that it instead indicates whether the chunk should be scanned with verification - which is not solely dependent on the source'sverifyflag. This is unnecessarily difficult to understand and maintain. This PR separates those two pieces of information into two flags:Chunk.Verifyhas been renamed toChunk.SourceVerifydetectableChunkChecklist:
make test-community)?make lintthis requires golangci-lint)?