Add a new NDJSON / JSONL input source #4721
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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).