Skip to content
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

Replace trufflehog with detect-secrets #4404

Merged
merged 10 commits into from
Jan 9, 2025

Conversation

ElenaKhaustova
Copy link
Contributor

@ElenaKhaustova ElenaKhaustova commented Jan 8, 2025

Description

Solves #4062

Development notes

In this PR we replace trufflehog with detect-secrets - https://github.com/Yelp/detect-secrets for secrets detecting locally and at the CI:

  • Added detect-secrets as a test dependency;
  • Generated and added .secrets.baseline - a baseline of potential secrets currently found in git repository against which further checks are done. So they are not considered as newly added secrets.
  • Added pre-commit hook locally to run detect-secrets on committed files only;
  • Added Github Action to run detect-secrets to scan all tracked files;
  • Removed trufflehog dependency and secret-scan make command.

CI test: 8d7da69

To test locally:

1. make install-test-requirements
2. make install-pre-commit
3. Add some key to the codebase and try to commit changes

Developer Certificate of Origin

We need all contributions to comply with the Developer Certificate of Origin (DCO). All commits must be signed off by including a Signed-off-by line in the commit message. See our wiki for guidance.

If your PR is blocked due to unsigned commits, then you must follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR. This will retroactively add the sign-off to all unsigned commits and allow the DCO check to pass.

Checklist

  • Read the contributing guidelines
  • Signed off each commit with a Developer Certificate of Origin (DCO)
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added a description of this change in the RELEASE.md file
  • Added tests to cover my changes
  • Checked if this change will affect Kedro-Viz, and if so, communicated that with the Viz team

Signed-off-by: Elena Khaustova <[email protected]>
Signed-off-by: Elena Khaustova <[email protected]>
Signed-off-by: Elena Khaustova <[email protected]>
Signed-off-by: Elena Khaustova <[email protected]>
Signed-off-by: Elena Khaustova <[email protected]>
Signed-off-by: Elena Khaustova <[email protected]>
Signed-off-by: Elena Khaustova <[email protected]>
@ElenaKhaustova ElenaKhaustova marked this pull request as ready for review January 8, 2025 16:29
Copy link
Contributor

@ravi-kumar-pilla ravi-kumar-pilla left a comment

Choose a reason for hiding this comment

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

Tested locally and it works well... awesome work @ElenaKhaustova . Thank you

@@ -40,11 +40,9 @@ repos:
pass_filenames: false
entry: lint-imports

- repo: local
- repo: https://github.com/Yelp/detect-secrets
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the PR, @ElenaKhaustova!
Could you please provide some context on:

  • Why we changed the architecture from local to repo (and removed secret-scan from the Makefile)?
  • In this case, do we still need the detect-secrets~=1.5.0 dependency in pyproject.toml?

Copy link
Contributor Author

@ElenaKhaustova ElenaKhaustova Jan 9, 2025

Choose a reason for hiding this comment

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

Previously we had secret-scan command in the Makefile and pre-commit used this command as entry point (local). Now we use proper pre-commit hook (https://github.com/Yelp/detect-secrets) to run locally and an executable is still needed.

Copy link
Contributor

@ankatiyar ankatiyar left a comment

Choose a reason for hiding this comment

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

LGTM! Tried locally

@ElenaKhaustova ElenaKhaustova enabled auto-merge (squash) January 9, 2025 12:41
Copy link
Member

@DimedS DimedS left a comment

Choose a reason for hiding this comment

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

thanks for PR and clarification, @ElenaKhaustova !

@ankatiyar
Copy link
Contributor

Worth doing this in the other repos too - kedro-plugins

@ElenaKhaustova
Copy link
Contributor Author

Worth doing this in the other repos too - kedro-plugins

Yep, makes sense - I will keep original issue opened until we make it for other repos 👍

@ElenaKhaustova ElenaKhaustova merged commit 396a1f5 into main Jan 9, 2025
42 checks passed
@ElenaKhaustova ElenaKhaustova deleted the feature/4062-replace-trufflehog branch January 9, 2025 14:57
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.

5 participants