-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add a new NDJSON / JSONL input source #4721
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
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.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
rosecodym
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.
This looks like a good start! In addition to my inline questions, I have this one: Are scans of individual paths cancellation-aware? It looks like the source is only cancellation-aware between paths.
This adds a new input source to TruffleHog, accessible via
trufflehog json-enumerator.This input source requires a list of filenames, each of which is an NDJSON-formatted sequence of objects that take one of two forms:
Form 1:
{"data": "utf-8 string", "metadata": <non-null JSON value>}Form 2:
{"data_b64": "base64-encoded bytestring", "metadata": <non-null JSON value>}The
data/data_b64field specifies the content to be scanned. Themetadatafield is arbitrary, and is simply propagated downstream with scan results from the corresponding content.Note that although
trufflehog json-enumeratorrequires a list of filenames to be given, the NDJSON data that you wish to scan may not need to be first written to disk. On Linux and macOS, at least, you can use shell process substitution to set up a named pipe from a producer process, liketrufflehog json-enumerator <(some-program-that-emits-ndjson).