-
Notifications
You must be signed in to change notification settings - Fork 68
Enable TruffleHog in pre-commit and exclude markdown/svg files #412
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
base: main
Are you sure you want to change the base?
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ParagEkbote , could you disable your automatic formatting for all of the files within the repo? It is generally best practice to have everything nicely formatted according to the standard, but doing it for files you have not touched introduces a bit of uncertainty and bloat to PRs. I believe VS Code has some config for this :)
| /resources/llama.cpp/ | ||
|
|
||
| tests/openai | ||
| tests/openai |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we exluding these tests? I think we should include them, could you double check if this wasn't a mistake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not included this change. It has been there for quite some time, the pre-commit hook must have formatted something 😄 : https://github.com/PrunaAI/pruna/blame/main/.gitignore
| .*\.svg$ | ||
| ) | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps we could only include certain files? ".py" etc. this would simplify it a bit.
| .*\.svg$ | ||
| ) | ||
| - repo: https://github.com/trufflesecurity/trufflehog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rebase on main, I've also redone this implementation and forced only checking for files that have been commited, so this should resolve a huge part of it too. Perhaps we can also raise a certain error if this fails and redirect users to the install page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, trufflehog is a golang package, not a python package. I think that this approach should simplify the usage for contributors and maintainers and not worry about installation at all. I could reduce the scope of files being checked to further improve the hook. WDYT?
I have performed the formatting as per the existing pre-commit rules. This is a one-time lint backlog that needs to be cleared otherwise, it is an issue when contributing to the repo, we have to choose our changed files to commit in order to prevent accidental additions. WDYT? |
I think for now, you can leave it :) However I think it is best practise to avoid changing the formatting of files you have not functionally touched so it would be good to change or verify your setting if it is doing this automatically in a way. |
Bug: TruffleHog Hook Fails with Multiple PathsThe TruffleHog hook configuration passes multiple directory paths ("src", "tests", ".github/workflows") as separate arguments to the "trufflehog filesystem" command. However, the trufflehog filesystem command expects only a single path argument. This will cause the hook to fail during execution because trufflehog will interpret "tests" and ".github/workflows" as invalid arguments rather than additional directories to scan. |
Bug: Trufflehog Hook Limits Secret Scanning ScopeThe trufflehog hook now only scans hardcoded directories (src, tests, .github/workflows) instead of all staged files. This creates a security gap where secrets in files outside these directories (e.g., docs/, scripts/, root-level configuration files) will not be detected by the secret scanner during pre-commit. |
|
Let me open a separate PR since the diff here is quite large; it will only include the pre-commit file based on your changes. If you have any more comments, feel free to include them in this PR. |
|
This PR has been inactive for 10 days and is now marked as stale. |
Description
Currently, the pre-commit hook for
trufflehogfails with a package not installed warning. Since it is a golang package, I have adjusted the configuration for it to work. It currently scanssrc,testsand.github/workflowsin order for the checks to be completed in a reasonable amount of time.I've excluded .venv from it since it can give false positives as well. Additionally, I've excluded .md and .svg files from being linted every time pre-commit is executed and have linted the pending files as well.
Could you please review?
cc: @johannaSommer
Related Issue
Fixes #(issue number)
Type of Change
How Has This Been Tested?
Checklist
Note
Enables TruffleHog in pre-commit with proper config, upgrades lint hooks, adds md/svg exclusions, and applies minor docs/notebook and code formatting tweaks.
src,tests,.github/workflowswith excludes for.venv,.pyc,*.md,*.svg; stagespre-commitandpre-push.pre-commit-hookstov6.0.0andruff-pre-committov0.14.1.*.mdand*.svgacross hooks.tyandcheck-pruna-pro; remove old shell-based TruffleHog hook..gitignoreentry fortests/openai.llm_quantization_compilation_acceleration.ipynbJSON.docs/utils/gen_docs.py,src/pruna/data/datasets/text_generation.py, and metrics modules (no functional changes).Written by Cursor Bugbot for commit 15dedd9. This will update automatically on new commits. Configure here.