From a7fb0786f9ae45c5bb3a4d261eff42d85aca9a0e Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Tue, 23 May 2023 19:45:10 -0400 Subject: [PATCH] improve pre commit docs --- docs/cli/commands/scan-install.mdx | 23 +++++++++++++++++++++++ docs/cli/scanning-overview.mdx | 24 ++++++++++++++++++++++++ docs/mint.json | 3 ++- 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 docs/cli/commands/scan-install.mdx diff --git a/docs/cli/commands/scan-install.mdx b/docs/cli/commands/scan-install.mdx new file mode 100644 index 000000000..a0128ef18 --- /dev/null +++ b/docs/cli/commands/scan-install.mdx @@ -0,0 +1,23 @@ +--- +title: "scan install" +description: "Add various scanning tools seamlessly into your development lifecycle" +--- + +```bash +infisical scan install --pre-commit-hook +``` + +## Description +The command `infisical scan install` is designed to incorporate various scanning tools seamlessly into your development lifecycle. +Initially, we are offering users the ability to install a pre-commit hook. This hook conducts an automatic scan for any exposed secrets in your commits before they are pushed. + +### Flags + + ```bash + infisical scan install --pre-commit-hook + ``` + + **Description** + Installs a git pre-commit hook that triggers Infisical to scan your staged changes for any exposed secrets prior to pushing. + + \ No newline at end of file diff --git a/docs/cli/scanning-overview.mdx b/docs/cli/scanning-overview.mdx index 57504b1b4..4ff2683a6 100644 --- a/docs/cli/scanning-overview.mdx +++ b/docs/cli/scanning-overview.mdx @@ -52,6 +52,30 @@ In addition to scanning for past leaks, this new addition also actively aids in +# +# +# Automatically scan changes before you commit + +To lower the risk of committing hardcoded secrets to your code repository, we have designed a custom git pre-commit hook. +This hook scans the changes you're about to commit for any exposed secrets. If any hardcoded secrets are detected, it will block your commit. + +### Install pre-commit hook + +To install this git hook, go into your local git repository and run the following command. + +```bash +infisical scan install --pre-commit-hook +``` + +To disable this hook after installing it, run the command `git config --bool hooks.infisical-scan false` + +### Third party hooks management +If you prefer to manage your pre-commit hook outside of the .git/hooks directory, you can easily accomplish this by adding the following command to your pre-commit script + +```bash +infisical scan git-changes --staged --verbose +``` + # # # Creating a baseline diff --git a/docs/mint.json b/docs/mint.json index 7993c2769..a0612889d 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -154,7 +154,8 @@ "group": "infisical scan", "pages": [ "cli/commands/scan", - "cli/commands/scan-git-changes" + "cli/commands/scan-git-changes", + "cli/commands/scan-install" ] } ]