Skip to content

wrap trufflehog and add 'write to file' entrypoint' #842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions components/scanners/trufflehog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,8 @@ as the following:
|--------------------------|--------|----------|------------|---------------------------------------------------------|
| TRUFFLEHOG\_RAW\_OUT\_FILE\_PATH | string | yes | - | The path where to find the trufflehog report |
| TRUFFLEHOG\_TARGET\_TYPE | string | false | repository | The type of target that was used to generate the report |
| RAW\_OUT\_FILE | string | yes | "{{ scratchWorkspace }}/trufflehog.json" | The path where to put the trufflehog report

## Test data

The `trufflehog.json` file used in tests was generated with the following steps:

* Cloning:

```shell
git clone https://github.com/smithy-security/e2e-monorepo
```

* Running trufflehog

```shell
docker run \
--rm -it -v "$PWD:/pwd" \
trufflesecurity/trufflehog:latest \
filesystem --json \
--no-fail \
--no-update \
--log-level=-1 \
--directory="/pwd"
```
9 changes: 9 additions & 0 deletions components/scanners/trufflehog/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ parameters:
type: "string"
value: "TARGET_TYPE_REPOSITORY"
steps:
- name: "run-trufflehog"
image: ghcr.io/trufflesecurity/trufflehog:3.88.23
executable: /bin/bash
args:
- -c
- >-
echo "Running trufflehog and sending output to {{ scratchWorkspace }}/trufflehog.json" &&
/etc/entrypoint.sh filesystem --json --no-fail --directory="{{sourceCodeWorkspace}}" |
tee {{ scratchWorkspace }}/trufflehog.json
- name: "secret-scanner"
image: "components/scanners/trufflehog"
executable: "/bin/app"
Expand Down
4 changes: 4 additions & 0 deletions examples/trufflehog/overrides.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
git-clone:
- name: "repo_url"
type: "string"
value: "https://github.com/OWASP/igoat"
7 changes: 7 additions & 0 deletions examples/trufflehog/workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: Trufflehog based workflow
name: trufflehog
components:
- component: file://components/targets/git-clone/component.yaml
- component: file://components/scanners/trufflehog/component.yaml
- component: file://components/enrichers/custom-annotation/component.yaml
- component: file://components/reporters/json-logger/component.yaml
Loading