Skip to content

HelpersTask622_gitleaks_doesnt_run_in_submodules_2 #664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

heanhsok
Copy link
Contributor

@heanhsok heanhsok commented May 5, 2025

Task #622

  • Move gitleaks rule from .github to dev_scripts_helpers/git/gitleaks so it can be pointed to from both the GH actions and the git hooks without creating symlinks

heanhsok added 2 commits May 5, 2025 16:21
Pre-commit checks:
- 'check_master' passed
- 'check_author' passed
- 'check_file_size' passed
- 'check_python_compile' passed
- 'check_gitleaks' passed
All checks passed ✅
Pre-commit checks:
- 'check_master' passed
- 'check_author' passed
- 'check_file_size' passed
- 'check_python_compile' passed
- 'check_gitleaks' passed
All checks passed ✅
@heanhsok heanhsok self-assigned this May 5, 2025
heanhsok added 4 commits May 5, 2025 18:06
Pre-commit checks:
- 'check_master' passed
- 'check_author' passed
- 'check_file_size' passed
- 'check_python_compile' passed
- 'check_gitleaks' passed
All checks passed ✅
Pre-commit checks:
- 'check_master' passed
- 'check_author' passed
- 'check_file_size' passed
- 'check_python_compile' passed
- 'check_gitleaks' passed
All checks passed ✅
…github.com:causify-ai/helpers into HelpersTask622_gitleaks_doesnt_run_in_submodules_2

Pre-commit checks:
- 'check_master' passed
- 'check_author' passed
- 'check_file_size' passed
- 'check_python_compile' passed
- 'check_gitleaks' passed
All checks passed ✅
@heanhsok heanhsok marked this pull request as draft May 5, 2025 18:23
git_root_dir = get_git_root_dir()
# Find relative path from the git root to the helpers root.
git_root_dir = hgit.find_git_root()
helpers_root_dir = hgit.find_helpers_root()
Copy link
Contributor Author

@heanhsok heanhsok May 5, 2025

Choose a reason for hiding this comment

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

  • I realize we'll be copying a lot of code from hgit for these two functions
  • Since Git hooks are now installed and run after our thin client is activated, should we consider using the helpers module?
  • This script is already somewhat coupled to the helpers, especially with the introduction of the gitleaks config path in dev_script_XYZ dir
  • To keep things decoupled, we can also just copy all the functions needed (although a lot of codes) as well

WDYT? @gpsaggese

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree. Let's just import helpers and embrace it that a piece of the infra checking on the code depends on the code itself.

In an ideal world the git hooks should be a prod container (like the linter), but it is too paranoid

@heanhsok heanhsok added the PR for reviewers The PR needs to be reviewed by RPs label May 5, 2025
@heanhsok heanhsok requested a review from gpsaggese May 5, 2025 20:55
heanhsok added 2 commits May 6, 2025 01:00
Pre-commit checks:
- 'check_master' passed
- 'check_author' passed
- 'check_file_size' passed
- 'check_python_compile' passed
- 'check_gitleaks' passed
All checks passed ✅
@heanhsok heanhsok marked this pull request as ready for review May 7, 2025 23:53
@gpsaggese gpsaggese requested a review from Copilot May 8, 2025 20:11
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR moves the gitleaks configuration from the .github directory into dev_scripts_helpers/git/gitleaks so that it can be referenced by both GitHub Actions and git hooks without relying on symlinks.

  • Refactored the check_gitleaks function in utils.py to compute repository paths using the new hgit helpers.
  • Updated the GitHub Actions workflow to point to the new gitleaks configuration file path.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
dev_scripts_helpers/git/git_hooks/utils.py Removed get_git_root_dir and updated check_gitleaks to compute and use the new config path
.github/workflows/gitleaks.yml Updated GITLEAKS_CONFIG to reference the new location of the gitleaks configuration file
Comments suppressed due to low confidence (1)

dev_scripts_helpers/git/git_hooks/utils.py:482

  • [nitpick] Consider adding an inline comment to explain the rationale behind concatenating '/app' with the relative helpers root to form the config path, which would help future maintainers understand the docker mount configuration.
config_path = os.path.join("/app", rel_path, "dev_scripts_helpers/git/gitleaks")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR for reviewers The PR needs to be reviewed by RPs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants