trufflehog icon indicating copy to clipboard operation
trufflehog copied to clipboard

[FR] Redact detected secrets from files (Rewriting them)

Open Azathothas opened this issue 1 year ago • 0 comments

Hi, I couldn't find an option to auto redact detected secrets from logfiles. Example: My build script generates a log: "${TEMP_LOG}", I had like to use trufflehog to redact all detected secrets with ***** or another string.

Currently, I have to do something like:

trufflehog filesystem "${TEMP_LOG}" --no-fail --no-update --json 2>/dev/null | jq -r '.Raw' | sed '/{/d' | xargs -I "{}" sh -c 'echo "{}" | tr -d " \t\r\f\v"' | xargs -I "{}" sed "s/{}/ /g" -i "${TEMP_LOG}"

Azathothas avatar Nov 01 '24 07:11 Azathothas