TruffleHog configuration#
Cartography ingests secrets that TruffleHog finds in container images and links each one to the image it was found in. It reads pre-generated TruffleHog reports and does not run the TruffleHog binary.
Prerequisites#
Run the module for the registry that holds the scanned images before
TruffleHog. Findings attach to ontology Image nodes by manifest digest. The
ontology schema lists every node type that carries the
Image label.
To link AWS findings to the IAM access key they leak, also run the AWS module for the account that owns the key.
Configure Cartography#
Set --trufflehog-source to the location of the reports. It accepts a local
file or directory, or a supported object storage URI (s3://, gs://,
azblob://). Cartography reads every .json and .jsonl file under the
location.
Run Cartography#
Run with a local directory of reports:
cartography --selected-modules trufflehog --trufflehog-source /path/to/trufflehog-reports
Run with reports in object storage:
cartography --selected-modules trufflehog --trufflehog-source s3://my-bucket/trufflehog/
Input artifacts#
Generate input artifacts#
Scan each image by digest and write one report per image:
trufflehog docker \
--image 123456789012.dkr.ecr.us-east-1.amazonaws.com/api@sha256:0123... \
--json --no-update > api.json
Scan by digest, not by tag. TruffleHog records the image digest in its output only when you pass a digest reference, and Cartography needs the digest to find the image in the graph. Results from a tag reference are skipped with a warning.
To report every secret TruffleHog matches without checking it with the provider,
add --no-verification. Findings are then ingested with verified set to
false.
Input format#
Each report holds the output of trufflehog --json: one result object per line.
Cartography ingests only results from the docker source. An empty report is
valid and means TruffleHog found no secrets in that image.
Cartography ignores the Raw, RawV2, SecretParts, and StructuredData
fields: it neither stores them nor derives anything from them. You can drop
those fields before writing a report, so the report holds no secret either.
Troubleshooting#
Cartography removes every finding that no report in the run mentions. Pass a report for each image whose findings should stay, including an empty report for an image with no secrets. If a report cannot be read or parsed, Cartography skips that cleanup for the run, so the findings from earlier runs stay in the graph until every report reads cleanly.