trufflehog
trufflehog copied to clipboard
Application is hanging for 128 vCPU EC2 instance
TruffleHog Version
trufflehog 3.67.6
Trace Output
2024-02-17T05:44:13Z info-2 trufflehog trufflehog 3.67.6
🐷🔑🐷 TruffleHog. Unearth your secrets. 🐷🔑🐷
2024-02-17T05:44:13Z info-4 trufflehog engine initialized
2024-02-17T05:44:13Z info-4 trufflehog setting up aho-corasick core
2024-02-17T05:44:13Z info-4 trufflehog set up aho-corasick core
2024-02-17T05:44:13Z info-3 trufflehog engine started {"workers": 128}
2024-02-17T05:44:13Z info-4 trufflehog default engine options set
2024-02-17T05:44:13Z info-2 trufflehog starting scanner workers {"count": 128}
2024-02-17T05:44:13Z info-2 trufflehog starting detector workers {"count": 0}
2024-02-17T05:44:13Z info-2 trufflehog starting verificationOverlap workers {"count": 128}
2024-02-17T05:44:13Z info-2 trufflehog starting notifier workers {"count": 32}
2024-02-17T05:44:13Z info-0 trufflehog running source {"source_manager_worker_id": "HIhWh", "with_units": false, "target_count": 0, "source_manager_units_configurable": true}
2024-02-17T05:44:13Z info-0 trufflehog Completed enumeration {"num_repos": 1, "num_orgs": 0, "num_members": 0}
2024-02-17T05:44:13Z info-2 trufflehog Found repos to scan {"count": 1}
.....
2024-02-17T05:44:14Z info-4 trufflehog finished scanning chunks {"secret_worker_id": "jus1e"}
2024-02-17T05:44:14Z info-4 trufflehog finished scanning chunks {"secret_worker_id": "bysTe"}
2024-02-17T05:44:14Z info-4 trufflehog finished scanning chunks {"secret_worker_id": "N8jpU"}
2024-02-17T05:44:14Z info-4 trufflehog finished scanning chunks {"secret_worker_id": "SuQk5"}
**Hanging here**
Expected Behavior
Run successfully and provide the result
Actual Behavior
It hangs in the middle.
Steps to Reproduce
Using any 32xlarge size instance (128 vCPU) and run the following command to start:
docker run --rm -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --repo https://github.com/trufflesecurity/test_keys
Environment
- OS: AL2023
Additional Context
From code: ctx.Logger().V(2).Info("starting detector workers", "count", e.concurrency*detectorWorkerMultiplier)
From line 434 and 480, numCPU := runtime.NumCPU() e.concurrency = uint8(numCPU) const detectorWorkerMultiplier = 50
For 32xlarge size EC2 instance, it has 128 vCPU. Since the e.concurrency is using uint8(), e.concurrency*detectorWorkerMultiplier = uinit8(128) * 50 = 0. This seems cause the for loop in line 482 and 496 not working.
##Workaround
Using "--concurrency" options to customize number of concurrent workers.