chore: setup husky and pre-commit secret scanning for stellar keys an… - #757
Open
richiesplug wants to merge 1 commit into
Open
chore: setup husky and pre-commit secret scanning for stellar keys an…#757richiesplug wants to merge 1 commit into
richiesplug wants to merge 1 commit into
Conversation
…d generic secrets
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Closes #419
Description
This PR introduces a robust local pre-commit secret scanning mechanism to prevent accidental exposure of sensitive credentials, such as Stellar secret keys, AWS keys, and other high-entropy strings, before they are ever pushed to GitHub.
As contributors routinely work with sensitive credentials in local development for Soroban smart contracts, GitHub's native secret scanning isn't always enough since it only alerts after the fact. This local hook provides cheap insurance by blocking problematic commits entirely.
Changes Made
huskyfor zero-friction Node integration: IncludedhuskyindevDependenciesalong with a"prepare": "husky"script inpackage.json. This ensures the hook structure is automatically installed when developers runnpm install..husky/pre-commithook:grepcommand to scan the Git diff cache for patterns matching exact Stellar keys (starts withS, 56 characters long, base32 characters).gitleaksas an optional but highly recommended dependency to catch AWS credentials and general high-entropy secrets.CONTRIBUTING.md: Added a one-time global setup step forgitleaks(e.g.,brew install gitleaks) under the Quick Start section so developers have full secret coverage.Motivation and Context
Prevents exposing development wallets, application webhook secrets, or cloud platform infrastructure keys. Blocking them at the pre-commit stage saves contributors the headache of having to rotate exposed keys or purge Git history.
Verification / Test-Driven Development (TDD)
SABCDEFGHIJKLMNOPQRSTUVWXYZ234567ABCDEFGHIJKLMNOPQRSTUVWX).Error: Stellar secret key detected in staged files. Commit blocked.message and returns a non-zero exit code.