Skip to content

Commit

Permalink
try a brew install to get unit test to run on gitleaks execution
Browse files Browse the repository at this point in the history
  • Loading branch information
austimkelly committed Feb 2, 2024
1 parent 9268a76 commit 6ac1587
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ jobs:
with:
python-version: 3.8

- name: Install Homebrew
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./org-scan/requirements.txt
brew install gitleaks
brew install trufflehog
- name: Run tests
working-directory: ./org-scan
Expand Down
3 changes: 2 additions & 1 deletion org-scan/secretsynth.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ def count_top_level_dirs(directory):
gitleaks_merged_report_filename = f"{REPORTS_DIR}/gitleaks_report_merged_filename_{timestamp}.csv"
if not SKIP_GITLEAKS:
print("Concatenating gitleaks report CSV files...")
concatenate_gitleaks_csv_files(gitleaks_merged_report_filename, GITLEAKS_REPORTS_DIR, LOGGER)
if not DRY_RUN:
concatenate_gitleaks_csv_files(gitleaks_merged_report_filename, GITLEAKS_REPORTS_DIR, LOGGER)

ghas_secret_alerts_filename = f"{REPORTS_DIR}/ghas_secret_alerts_{timestamp}.csv"
if not SKIP_GHAS:
Expand Down
7 changes: 7 additions & 0 deletions org-scan/ss_unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,12 @@ def test_skip_all_scanners(self):
# Check that the command completed successfully
self.assertEqual(result.returncode, 0)

def test_skip_only_run_gitleaks(self):
# Run the command with arguments to skip some scanners and capture the output
result = subprocess.run(['python3', 'secretsynth.py', '--org-type', 'users', '--owners', 'swell-consulting', '--skip-ghas', '--skip-trufflehog', '--skip-noseyparker'], capture_output=True)

# Check that the command completed successfully
self.assertEqual(result.returncode, 0)

if __name__ == '__main__':
unittest.main()

0 comments on commit 6ac1587

Please sign in to comment.