chore(autoreview): centralize secret scanning (#112036)

* chore(autoreview): centralize secret scanning

* chore(autoreview): remove generated caches

* chore(autoreview): remove generated caches
This commit is contained in:
Patrick Erichsen
2026-07-20 22:59:20 -07:00
committed by GitHub
parent 37ac5d671f
commit 45270a02c8
9 changed files with 3610 additions and 535 deletions
-30
View File
@@ -40,17 +40,6 @@ if [ "${#files[@]}" -eq 0 ]; then
exit 0
fi
if ! command -v trufflehog >/dev/null 2>&1; then
cat >&2 <<'EOF'
OpenClaw requires TruffleHog for pre-commit secret scanning.
Install it, then retry the commit:
macOS: brew install trufflehog
Other platforms: https://github.com/trufflesecurity/trufflehog#installation
EOF
exit 1
fi
restage_files=()
for file in "${files[@]}"; do
if ! git check-ignore --no-index -q -- "$file"; then
@@ -70,22 +59,3 @@ fi
if [ "${#restage_files[@]}" -gt 0 ]; then
git add -- "${restage_files[@]}"
fi
staged_snapshot="$(mktemp -d "${TMPDIR:-/tmp}/openclaw-trufflehog.XXXXXX")"
trap 'rm -rf "$staged_snapshot"' EXIT
for file in "${files[@]}"; do
if [[ "$(git cat-file -t ":0:$file")" != "blob" ]]; then
continue
fi
snapshot_path="$staged_snapshot/$file"
mkdir -p "${snapshot_path%/*}"
git cat-file blob ":0:$file" > "$snapshot_path"
done
trufflehog \
--no-update \
--no-color \
--results=verified,unknown \
--fail \
--fail-on-scan-errors \
filesystem "$staged_snapshot"