Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 22, 2025

The SAST security workflow was failing on main branch pushes with the error:

Error: BASE and HEAD commits are the same. TruffleHog won't scan anything. 
Please see documentation (https://github.com/trufflesecurity/trufflehog#octocat-trufflehog-github-action).
Error: Process completed with exit code 1.

This occurs because TruffleHog's diff-based scanning compares base and head commits, but on main branch pushes these are often identical. The tool expects to compare different commits to detect newly introduced secrets.

Solution

Added a conditional to skip TruffleHog's diff scan specifically for main branch push events:

- name: TruffleHog OSS
  # Skip on main branch pushes where base and head are the same
  if: github.event_name != 'push' || github.ref != 'refs/heads/main'
  uses: trufflesecurity/trufflehog@main

Impact

This change:

  • Fixes workflow failures on main branch pushes
  • Preserves security coverage - Gitleaks still runs on all events
  • Maintains TruffleHog functionality for pull requests (where base/head comparison is meaningful)
  • Keeps scheduled scans and dev branch scanning intact
  • Uses minimal, surgical change - only affects the problematic scenario

Security coverage remains comprehensive since secrets are primarily introduced via pull requests, where TruffleHog continues to provide diff-based scanning.

Fixes #27.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copy link

netlify bot commented Aug 22, 2025

Deploy Preview for gridfinity-drawer-planner ready!

Name Link
🔨 Latest commit 285e53d
🔍 Latest deploy log https://app.netlify.com/projects/gridfinity-drawer-planner/deploys/68a7fa973f1ba20008a588a4
😎 Deploy Preview https://deploy-preview-28--gridfinity-drawer-planner.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Copilot Copilot AI changed the title [WIP] [BUG] The sast security scan always fails on main because it can't compare the BASE to the HEAD Fix SAST TruffleHog failure on main branch pushes Aug 22, 2025
@Copilot Copilot AI requested a review from ntindle August 22, 2025 05:08
Copilot finished work on behalf of ntindle August 22, 2025 05:08
@ntindle ntindle marked this pull request as ready for review August 22, 2025 05:15
Copy link

codecov bot commented Aug 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@e6a9fa1). Learn more about missing BASE report.
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #28   +/-   ##
=======================================
  Coverage        ?   64.50%           
=======================================
  Files           ?       49           
  Lines           ?     3381           
  Branches        ?      319           
=======================================
  Hits            ?     2181           
  Misses          ?     1178           
  Partials        ?       22           
Flag Coverage Δ
unittests 64.50% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

github-actions bot commented Aug 22, 2025

PR Quality Report 📊

Check Status
TypeScript
ESLint
Tests
Build

View detailed results

@ntindle ntindle merged commit 5633261 into main Aug 22, 2025
60 of 62 checks passed
@ntindle ntindle deleted the copilot/fix-27 branch August 22, 2025 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] The sast security scan always fails on main because it can't compare the BASE to the HEAD
2 participants