Skip to content

Commit c033f22

Browse files
authored
Added how to scan a local git repo (#3593)
Issue #1864 because it's not written in README yet.
1 parent 2a01091 commit c033f22

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -257,43 +257,55 @@ docker run --rm -v "$HOME/.ssh:/root/.ssh:ro" trufflesecurity/trufflehog:latest
257257
trufflehog filesystem path/to/file1.txt path/to/file2.txt path/to/dir
258258
```
259259

260-
## 9: Scan GCS buckets for verified secrets
260+
## 9: Scan a local git repo
261+
262+
Clone the git repo. For example [test keys]([email protected]:trufflesecurity/test_keys.git) repo.
263+
```bash
264+
$ git clone [email protected]:trufflesecurity/test_keys.git
265+
```
266+
267+
Run trufflehog from the parent directory (outside the git repo).
268+
```bash
269+
$ trufflehog git file://test_keys --only-verified
270+
```
271+
272+
## 10: Scan GCS buckets for verified secrets
261273

262274
```bash
263275
trufflehog gcs --project-id=<project-ID> --cloud-environment --only-verified
264276
```
265277

266-
## 10: Scan a Docker image for verified secrets
278+
## 11: Scan a Docker image for verified secrets
267279

268280
Use the `--image` flag multiple times to scan multiple images.
269281

270282
```bash
271283
trufflehog docker --image trufflesecurity/secrets --only-verified
272284
```
273285

274-
## 11: Scan in CI
286+
## 12: Scan in CI
275287

276288
Set the `--since-commit` flag to your default branch that people merge into (ex: "main"). Set the `--branch` flag to your PR's branch name (ex: "feature-1"). Depending on the CI/CD platform you use, this value can be pulled in dynamically (ex: [CIRCLE_BRANCH in Circle CI](https://circleci.com/docs/variables/) and [TRAVIS_PULL_REQUEST_BRANCH in Travis CI](https://docs.travis-ci.com/user/environment-variables/)). If the repo is cloned and the target branch is already checked out during the CI/CD workflow, then `--branch HEAD` should be sufficient. The `--fail` flag will return an 183 error code if valid credentials are found.
277289

278290
```bash
279291
trufflehog git file://. --since-commit main --branch feature-1 --only-verified --fail
280292
```
281293

282-
## 12: Scan a Postman workspace
294+
## 13: Scan a Postman workspace
283295

284296
Use the `--workspace-id`, `--collection-id`, `--environment` flags multiple times to scan multiple targets.
285297

286298
```bash
287299
trufflehog postman --token=<postman api token> --workspace-id=<workspace id>
288300
```
289301

290-
## 13: Scan a Jenkins server
302+
## 14: Scan a Jenkins server
291303

292304
```bash
293305
trufflehog jenkins --url https://jenkins.example.com --username admin --password admin
294306
```
295307

296-
## 14: Scan an Elasticsearch server
308+
## 15: Scan an Elasticsearch server
297309

298310
### Scan a Local Cluster
299311

@@ -321,7 +333,7 @@ trufflehog elasticsearch \
321333
--api-key 'MlVtVjBZ...ZSYlduYnF1djh3NG5FQQ=='
322334
```
323335

324-
## 15. Scan a GitHub Repository for Cross Fork Object References and Deleted Commits
336+
## 16. Scan a GitHub Repository for Cross Fork Object References and Deleted Commits
325337

326338
The following command will enumerate deleted and hidden commits on a GitHub repository and then scan them for secrets. This is an alpha release feature.
327339

@@ -335,7 +347,7 @@ In addition to the normal TruffleHog output, the `--object-discovery` flag creat
335347

336348
For more information on Cross Fork Object References, please [read our blog post](https://trufflesecurity.com/blog/anyone-can-access-deleted-and-private-repo-data-github).
337349

338-
## 16. Scan Hugging Face
350+
## 17. Scan Hugging Face
339351

340352
### Scan a Hugging Face Model, Dataset or Space
341353

0 commit comments

Comments
 (0)