Skip to content
Merged
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
24 changes: 3 additions & 21 deletions .github/workflows/trufflehog-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ jobs:
id: parse
if: github.event_name != 'workflow_dispatch'
run: |
echo "========================================"
echo "SCANNING PR CHANGES"
echo "========================================"
echo "Parsing TruffleHog results..."

VERIFIED_COUNT=0
UNVERIFIED_COUNT=0
Expand All @@ -94,19 +92,7 @@ jobs:
--branch ${{ github.event.pull_request.head.sha }} \
--json \
${{ steps.config.outputs.exclude_args }} \
--no-update 2>&1 || true)

echo "========================================"
echo "FILES SCANNED BY TRUFFLEHOG"
echo "========================================"
SCANNED_FILES=$(echo "$SCAN_OUTPUT" | jq -r 'select(.SourceMetadata.Data.Git.file) | .SourceMetadata.Data.Git.file' | sort -u 2>/dev/null || echo "")
if [ -n "$SCANNED_FILES" ]; then
echo "$SCANNED_FILES"
else
echo "No secrets found. Files that were scanned:"
git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
fi
echo "========================================"
--no-update 2>/dev/null || true)
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redirecting stderr to /dev/null silences all errors, making debugging difficult. Consider using 2>&1 to capture errors in the output or logging them separately for troubleshooting purposes.

Suggested change
--no-update 2>/dev/null || true)
--no-update || true)

Copilot uses AI. Check for mistakes.

if [ -n "$SCAN_OUTPUT" ]; then
while IFS= read -r line; do
Expand All @@ -125,8 +111,6 @@ jobs:
DETECTOR=$(echo "$line" | jq -r '.DetectorName // "Secret"')
VERIFIED=$(echo "$line" | jq -r '.Verified // false')

echo "Found: ${DETECTOR} in ${FILE}:${LINE_NUM} (Verified: ${VERIFIED})"

if [ "$VERIFIED" == "true" ]; then
VERIFIED_COUNT=$((VERIFIED_COUNT + 1))
echo "::error file=${FILE},line=${LINE_NUM},title=${DETECTOR} [VERIFIED]::VERIFIED ACTIVE CREDENTIAL: ${DETECTOR} found in ${FILE} at line ${LINE_NUM}. This secret is confirmed active. Remove and rotate immediately!"
Expand All @@ -137,11 +121,9 @@ jobs:
done <<< "$SCAN_OUTPUT"
fi

echo ""
echo "Verified: ${VERIFIED_COUNT}, Unverified: ${UNVERIFIED_COUNT}"

echo "verified_count=${VERIFIED_COUNT}" >> $GITHUB_OUTPUT
echo "unverified_count=${UNVERIFIED_COUNT}" >> $GITHUB_OUTPUT
echo "Scan complete: ${VERIFIED_COUNT} verified, ${UNVERIFIED_COUNT} unverified secrets found"
Comment on lines 124 to +126
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The summary message is now output after setting GITHUB_OUTPUT variables, but it will only appear in the workflow logs. Consider whether this message should be output before setting the output variables for better visibility during workflow execution, or if the current placement is intentional.

Suggested change
echo "verified_count=${VERIFIED_COUNT}" >> $GITHUB_OUTPUT
echo "unverified_count=${UNVERIFIED_COUNT}" >> $GITHUB_OUTPUT
echo "Scan complete: ${VERIFIED_COUNT} verified, ${UNVERIFIED_COUNT} unverified secrets found"
echo "Scan complete: ${VERIFIED_COUNT} verified, ${UNVERIFIED_COUNT} unverified secrets found"
echo "verified_count=${VERIFIED_COUNT}" >> $GITHUB_OUTPUT
echo "unverified_count=${UNVERIFIED_COUNT}" >> $GITHUB_OUTPUT

Copilot uses AI. Check for mistakes.

- name: Process scan results
id: process
Expand Down