Skip to content

Commit 8364d02

Browse files
Merge pull request #38 from grafana/trufflehog-pre-commit
Create trufflehog precommit
2 parents e784a02 + 02c3c2e commit 8364d02

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repos:
2+
- repo: https://github.com/grafana/security-github-actions
3+
rev: main
4+
hooks:
5+
- id: trufflehog

.pre-commit-hooks.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- id: trufflehog
2+
name: TruffleHog
3+
language: script
4+
entry: pre-commit/trufflehog.sh
5+
stages:
6+
- pre-commit
7+
- pre-push
8+
types: [text]

pre-commit/trufflehog.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
# vim: ai:ts=8:sw=8:noet
3+
set -euo pipefail
4+
5+
# renovate: datasource=docker depName=trufflesecurity/trufflehog
6+
TRUFFLEHOG_DEFAULT_VERSION="3.88.29@sha256:6375b4dd7d045656bf78f52ac5a6e992eff344da9def96f0953cda26f791ffb7"
7+
TRUFFLEHOG_VERSION="${TRUFFLEHOG_VERSION:-${TRUFFLEHOG_DEFAULT_VERSION}}"
8+
9+
docker \
10+
run \
11+
--volume "$(pwd):/workdir" \
12+
--interactive \
13+
--rm \
14+
"trufflesecurity/trufflehog:$TRUFFLEHOG_VERSION" \
15+
git \
16+
file:///workdir \
17+
--since-commit HEAD \
18+
--results=verified,unknown \
19+
--log-level=-1 \
20+
--fail

0 commit comments

Comments
 (0)