trufflehog icon indicating copy to clipboard operation
trufflehog copied to clipboard

Change source reporter interfaces to not return errors

Open mcastorina opened this issue 9 months ago • 2 comments

Description:

The error was meant to allow the reporter to end scanning, but in practice would only be useful for context cancellations, which sources should be handling anyway. Removing the error simplifies the usage of the interface.

Checklist:

  • [ ] Tests passing (make test-community)?
  • [ ] Lint passing (make lint this requires golangci-lint)?

mcastorina avatar Feb 11 '25 09:02 mcastorina

If I understand this PR correctly, it (effectively) removes context cancellation checks from a lot of places (anywhere that used to check for a non-nil error returned from a reporter, and return if one was found). Do we need to re-add them explicitly?

That's correct. Additionally, it removes confirmation of whether the item was successfully handled. That is the main tradeoff of this change. The argument is that sources shouldn't need to care whether the item was handled or not.

They do need to be context aware, though.

mcastorina avatar Feb 12 '25 00:02 mcastorina

If I understand this PR correctly, it (effectively) removes context cancellation checks from a lot of places (anywhere that used to check for a non-nil error returned from a reporter, and return if one was found). Do we need to re-add them explicitly?

That's correct. Additionally, it removes confirmation of whether the item was successfully handled. That is the main tradeoff of this change. The argument is that sources shouldn't need to care whether the item was handled or not.

They do need to be context aware, though.

Yep, so then should this PR re-add the (implicit) context cancellation checks that it's removed?

rosecodym avatar Feb 13 '25 16:02 rosecodym