Skip to content

JSON output is invalid due to ANSI escape characters at the beginning making it unparseable #4654

@discapes

Description

@discapes

TruffleHog Version

trufflehog 3.92.4

Command and output:

docker run --rm -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --repo=https://....git --log-level=5 --json --no-color > out.json
head -1 out.json | xxd

00000000: 1b5d 3131 3b3f 1b5c 1b5b 366e 1b5d 3131  .]11;?.\.[6n.]11
00000010: 3b3f 1b5c 1b5b 366e 7b22 6c65 7665 6c22  ;?.\.[6n{"level"
00000020: 3a22 696e 666f 2d32 222c 2274 7322 3a22  :"info-2","ts":"
00000030: 3230 3236 2d30 312d 3130 5431 393a 3138  2026-01-10T19:18
00000040: 3a30 375a 222c 226c 6f67 6765 7222 3a22  :07Z","logger":"
00000050: 7472 7566 666c 6568 6f67 222c 226d 7367  trufflehog","msg
00000060: 223a 2274 7275 6666 6c65 686f 6720 332e  ":"trufflehog 3.
00000070: 3932 2e34 227d 0d0a                      92.4"}..

Expected Behavior

There should be no special ANSI escape characters at the start: �]11;?�\�[6n�]11;?�\�[6n

Actual Behavior

There's ANSI escape characters at the start of the output, making the JSON invalid and unparseable with jq for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions