Skip to content

Commit f89f7b4

Browse files
fix(trufflehog): exclude paths with ./ prefix (dashboards, vendor)
TruffleHog often sees repo-relative paths like ./content/grafana/...; (^|[/\\])content did not match. Use (^|\.\/|[/\\]) for segment boundary. Made-with: Cursor
1 parent 757774d commit f89f7b4

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/reusable-trufflehog.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ jobs:
9393
9494
# Go vendor/ directory (standard Go vendoring): third-party code and large data
9595
# files (e.g. golang.org/x/net/publicsuffix) are not repo secrets; TruffleHog often false-positives there.
96-
(^|[/\\])vendor([/\\]|$)
96+
(^|\./|[/\\])vendor([/\\]|$)
9797
9898
# User-supplied Grafana dashboards checked into site repos (e.g. *.md / JSON); not org-managed secrets.
99-
(^|[/\\])content/grafana/dashboards([/\\]|$)
99+
(^|\./|[/\\])content/grafana/dashboards([/\\]|$)
100100
EOF
101101
fi
102102
echo "--- effective exclude file ---"
@@ -161,7 +161,11 @@ jobs:
161161
return pats
162162
163163
def vendor_skip(path: str) -> bool:
164-
return path.startswith("vendor/") or "/vendor/" in path
164+
return (
165+
path.startswith("vendor/")
166+
or path.startswith("./vendor/")
167+
or "/vendor/" in path
168+
)
165169
166170
def manifest_skip(path: str) -> bool:
167171
return Path(path).name in MANIFEST
@@ -244,7 +248,7 @@ jobs:
244248
if [[ -s changed-files.txt ]]; then
245249
python3 /tmp/trufflehog_exclude_helpers.py report-pr
246250
while IFS= read -r file; do
247-
if [[ "$file" == vendor/* || "$file" == */vendor/* ]]; then
251+
if [[ "$file" == vendor/* || "$file" == */vendor/* || "$file" == ./vendor/* ]]; then
248252
echo "Skipping: ${file} (Go vendor directory)"
249253
continue
250254
fi

trufflehog/global-exclude.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ path:grafana\.json$
2323

2424
# Go vendor/ directory (standard Go vendoring): third-party code and large data
2525
# files (e.g. golang.org/x/net/publicsuffix) are not repo secrets; TruffleHog often false-positives there.
26-
(^|[/\\])vendor([/\\]|$)
26+
# Allow repo-relative paths that start with "./" (common on Actions checkout).
27+
(^|\./|[/\\])vendor([/\\]|$)
2728

2829
# User-supplied Grafana dashboards checked into site repos (e.g. *.md / JSON); not org-managed secrets.
29-
(^|[/\\])content/grafana/dashboards([/\\]|$)
30+
(^|\./|[/\\])content/grafana/dashboards([/\\]|$)

0 commit comments

Comments
 (0)