Add secrets scanner to pre-commit#5226
Draft
stevenschrayer wants to merge 1 commit intomainfrom
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Describe your changes and why you're making them. Please include the context, motivation, and relevant dependencies.
Resolves #5224.
Opted for a pre-commit check for now. gitleaks is also useful, but requires provisioning a (free) license key to use the github action in CI/CD. Would rather not have that tied to my email with the amount of runway remaining so probably follow-up ticket.
Type of change
How has this been tested?
Include commands/logs/screenshots as relevant.
If making changes to dbt models, make sure they were created or update on Staging. Please run the command
uv run dbt run -s CHANGED_MODEL --target staginganduv run dbt test -s CHANGED_MODEL --target staging, then include the output in this section of the PR.Generated the
.secrets.baselinewithdetect-secrets(viauv tool add detect-secrets) and populated. Currently a bit too much to audit since most seem fine.Added a fake secret via
GITHUB_TOKEN=ghp_some-long-fake-token-that-isnt-thisand confirmed that I was unable to commit the secret.Post-merge follow-ups
Document any actions that must be taken post-merge to deploy or otherwise implement the changes in this PR (for example, running a full refresh of some incremental model in dbt). If these actions will take more than a few hours after the merge or if they will be completed by someone other than the PR author, please create a dedicated follow-up issue and link it here to track resolution.
Determine if it makes sense to still implement gitleaks -- pre-commit only runs when a user is committing, and requires explicitly running
pre-commit install, so it could be sidestepped. Adding gitleaks a CI/CD allows configuring notifications for leaked secrets which is a good second layer.