@@ -30,6 +30,59 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
3030.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
3131.in \\n[ rst2man-indent\\n[ rst2man-indent-level ] ]u
3232..
33+ .SS Contents
34+ .INDENT 0.0
35+ .IP \(bu 2
36+ \fI \% Synopsis \fP
37+ .IP \(bu 2
38+ \fI \% Description \fP
39+ .IP \(bu 2
40+ \fI \% Installing git \- secrets \fP
41+ .INDENT 2.0
42+ .IP \(bu 2
43+ \fI \% *nix (Linux/macOS) \fP
44+ .IP \(bu 2
45+ \fI \% Windows \fP
46+ .IP \(bu 2
47+ \fI \% Homebrew (for macOS users) \fP
48+ .UNINDENT
49+ .IP \(bu 2
50+ \fI \% Advanced configuration \fP
51+ .IP \(bu 2
52+ \fI \% Before making public a repository \fP
53+ .IP \(bu 2
54+ \fI \% Options \fP
55+ .INDENT 2.0
56+ .IP \(bu 2
57+ \fI \% Operation Modes \fP
58+ .IP \(bu 2
59+ \fI \% Options for \fB \-\- install \fP\fP
60+ .IP \(bu 2
61+ \fI \% Options for \fB \-\- scan \fP\fP
62+ .IP \(bu 2
63+ \fI \% Options for \fB \-\- list \fP\fP
64+ .IP \(bu 2
65+ \fI \% Options for \fB \-\- add \fP\fP
66+ .IP \(bu 2
67+ \fI \% Options for \fB \-\- register \- aws \fP\fP
68+ .IP \(bu 2
69+ \fI \% Options for \fB \-\- aws \- provider \fP\fP
70+ .IP \(bu 2
71+ \fI \% Options for \fB \-\- add \- provider \fP\fP
72+ .UNINDENT
73+ .IP \(bu 2
74+ \fI \% Defining prohibited patterns \fP
75+ .IP \(bu 2
76+ \fI \% Ignoring false positives \fP
77+ .IP \(bu 2
78+ \fI \% Secret providers \fP
79+ .IP \(bu 2
80+ \fI \% Example walkthrough \fP
81+ .IP \(bu 2
82+ \fI \% Skipping validation \fP
83+ .IP \(bu 2
84+ \fI \% About \fP
85+ .UNINDENT
3386.SH SYNOPSIS
3487.INDENT 0.0
3588.INDENT 3.5
@@ -55,12 +108,27 @@ prevent adding secrets into your git repositories. If a commit,
55108commit message, or any commit in a \fB \-\- no \- ff \fP merge history matches one of
56109your configured prohibited regular expression patterns, then the commit is
57110rejected.
58- .SS Installing git \- secrets
111+ .SH INSTALLING GIT-SECRETS
59112.sp
60113\fB git \- secrets \fP must be placed somewhere in your PATH so that it is picked up
61- by \fB git \fP when running \fB git secrets \fP \& . You can use \fB install \fP target of the
62- provided Makefile to install \fB git secrets \fP and the man page. You can
63- customize the install path using the PREFIX and MANPREFIX variables.
114+ by \fB git \fP when running \fB git secrets \fP \& .
115+ .SS *nix (Linux/macOS)
116+ .IP " System Message: WARNING/2 (README.rst:, line 43)"
117+ Title underline too short.
118+ .INDENT 0.0
119+ .INDENT 3.5
120+ .sp
121+ .nf
122+ .ft C
123+ \e *nix (Linux/macOS)
124+ ~~~~~~~~~~~~~~~~~
125+ .ft P
126+ .fi
127+ .UNINDENT
128+ .UNINDENT
129+ .sp
130+ You can use the \fB install \fP target of the provided Makefile to install \fB git secrets \fP and the man page.
131+ You can customize the install path using the PREFIX and MANPREFIX variables.
64132.INDENT 0.0
65133.INDENT 3.5
66134.sp
@@ -71,8 +139,22 @@ make install
71139.fi
72140.UNINDENT
73141.UNINDENT
142+ .SS Windows
74143.sp
75- Or, installing with Homebrew (for OS X users).
144+ Run the provided \fB install.ps1 \fP powershell script. This will copy the needed files
145+ to an installation directory (\fB %USERPROFILE%/.git \- secrets \fP by default) and add
146+ the directory to the current user \fB PATH \fP \& .
147+ .INDENT 0.0
148+ .INDENT 3.5
149+ .sp
150+ .nf
151+ .ft C
152+ PS > ./install.ps1
153+ .ft P
154+ .fi
155+ .UNINDENT
156+ .UNINDENT
157+ .SS Homebrew (for macOS users)
76158.INDENT 0.0
77159.INDENT 3.5
78160.sp
@@ -106,42 +188,94 @@ git secrets \-\-register\-aws
106188.fi
107189.UNINDENT
108190.UNINDENT
191+ .SH ADVANCED CONFIGURATION
192+ .sp
193+ Add a configuration template if you want to add hooks to all repositories you
194+ initialize or clone in the future.
195+ .INDENT 0.0
196+ .INDENT 3.5
197+ .sp
198+ .nf
199+ .ft C
200+ git secrets \-\- register\- aws \-\- global
201+ .ft P
202+ .fi
203+ .UNINDENT
204+ .UNINDENT
205+ .sp
206+ Add hooks to all your local repositories.
207+ .INDENT 0.0
208+ .INDENT 3.5
209+ .sp
210+ .nf
211+ .ft C
212+ git secrets \-\- install ~/.git\- templates/git\- secrets
213+ git config \-\- global init.templateDir ~/.git\- templates/git\- secrets
214+ .ft P
215+ .fi
216+ .UNINDENT
217+ .UNINDENT
218+ .sp
219+ Add custom providers to scan for security credentials.
220+ .INDENT 0.0
221+ .INDENT 3.5
222+ .sp
223+ .nf
224+ .ft C
225+ git secrets \-\- add\- provider \-\- cat /path/to/secret/file/patterns
226+ .ft P
227+ .fi
228+ .UNINDENT
229+ .UNINDENT
230+ .SH BEFORE MAKING PUBLIC A REPOSITORY
231+ .sp
232+ With git\- secrets is also possible to scan a repository including all revisions:
233+ .INDENT 0.0
234+ .INDENT 3.5
235+ .sp
236+ .nf
237+ .ft C
238+ git secrets \-\- scan\- history
239+ .ft P
240+ .fi
241+ .UNINDENT
242+ .UNINDENT
109243.SH OPTIONS
110244.SS Operation Modes
111245.sp
112246Each of these options must appear first on the command line.
113247.INDENT 0.0
114248.TP
115249.B \fB \-\- install \fP
116- Installs hooks for a repository. Once the hooks are installed for a git
117- repository, commits and non\- ff merges for that repository will be prevented
250+ Installs git hooks for a repository. Once the hooks are installed for a git
251+ repository, commits and non\- fast \- forward merges for that repository will be prevented
118252from committing secrets.
119253.TP
120254.B \fB \-\- scan \fP
121255Scans one or more files for secrets. When a file contains a secret, the
122256matched text from the file being scanned will be written to stdout and the
123- script will exit with a non\- zero RC . Each matched line will be written with
257+ script will exit with a non\- zero status . Each matched line will be written with
124258the name of the file that matched, a colon, the line number that matched,
125259a colon, and then the line of text that matched. If no files are provided,
126260all files returned by \fB git ls \- files \fP are scanned.
127261.TP
128262.B \fB \-\- scan \- history \fP
129263Scans repository including all revisions. When a file contains a secret, the
130264matched text from the file being scanned will be written to stdout and the
131- script will exit with a non\- zero RC . Each matched line will be written with
265+ script will exit with a non\- zero status . Each matched line will be written with
132266the name of the file that matched, a colon, the line number that matched,
133267a colon, and then the line of text that matched.
134268.TP
135269.B \fB \-\- list \fP
136- Lists the git \ - secrets configuration for the current repo or in the global
270+ Lists the \fB git \ -secrets \fP configuration for the current repo or in the global
137271git config.
138272.TP
139273.B \fB \-\- add \fP
140274Adds a prohibited or allowed pattern.
141275.TP
142276.B \fB \-\- add \- provider \fP
143277Registers a secret provider. Secret providers are executables that when
144- invoked outputs prohibited patterns that \fB git \- secrets \fP should treat as
278+ invoked output prohibited patterns that \fB git \- secrets \fP should treat as
145279prohibited.
146280.TP
147281.B \fB \-\- register \- aws \fP
@@ -150,7 +284,7 @@ in \fB~/.aws/credentials\fP are not found in any commit. The following
150284checks are added:
151285.INDENT 7.0
152286.IP \(bu 2
153- AWS Access Key ID via \fB [A \- Z0 \- 9]{20 } \fP
287+ AWS Access Key IDs via \fB (A3T [A\- Z0 \- 9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A \- Z0 \- 9]{16 }\fP
154288.IP \(bu 2
155289AWS Secret Access Key assignments via ":" or "=" surrounded by optional
156290quotes
@@ -160,7 +294,7 @@ AWS account ID assignments via ":" or "=" surrounded by optional quotes
160294Allowed patterns for example AWS keys (\fB AKIAIOSFODNN7EXAMPLE \fP and
161295\fB wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY \fP )
162296.IP \(bu 2
163- Enables using \fB ~/.aws/credentials \fP to scan for known credentials.
297+ Known credentials from \fB ~/.aws/credentials \fP
164298.UNINDENT
165299.sp
166300\fB NOTE: \fP
@@ -176,7 +310,7 @@ do not commit credentials to a repository.
176310.TP
177311.B \fB \-\- aws \- provider \fP
178312Secret provider that outputs credentials found in an INI file. You can
179- optionally provide the path to an ini file.
313+ optionally provide the path to an INI file.
180314.UNINDENT
181315.SS Options for \fB \-\- install \fP
182316.INDENT 0.0
@@ -188,18 +322,18 @@ Overwrites existing hooks if present.
188322When provided, installs git hooks to the given directory. The current
189323directory is assumed if \fB <target \- directory> \fP is not provided.
190324.sp
191- If the provided \fB <target \- directory> \fP is not in a Git repository, the
325+ If the provided \fB <target \- directory> \fP is not in a git repository, the
192326directory will be created and hooks will be placed in
193- \fB <target \- directory>/hooks \fP \& . This can be useful for creating Git template
327+ \fB <target \- directory>/hooks \fP \& . This can be useful for creating git template
194328directories using with \fB git init \-\- template <target \- directory> \fP \& .
195329.sp
196330You can run \fB git init \fP on a repository that has already been initialized.
197331From the \fI \% git init documentation \fP :
198332.INDENT 7.0
199333.INDENT 3.5
200- From the git documentation: Running git init in an existing repository
334+ From the git documentation: Running \fB git init \fP in an existing repository
201335is safe. It will not overwrite things that are already there. The
202- primary reason for rerunning git init is to pick up newly added
336+ primary reason for rerunning \fB git init \fP is to pick up newly added
203337templates (or to move the repository to another place if
204338\fB \-\- separate \- git \- dir \fP is given).
205339.UNINDENT
@@ -223,7 +357,7 @@ Please note that this hook is only invoked for non fast\-forward merges.
223357.INDENT 7.0
224358.INDENT 3.5
225359Git only allows a single script to be executed per hook. If the
226- repository contains Debian style subdirectories like \fB pre \- commit.d \fP
360+ repository contains Debian\- style subdirectories like \fB pre \- commit.d \fP
227361and \fB commit \- msg.d \fP , then the git hooks will be installed into these
228362directories, which assumes that you\(aq ve configured the corresponding
229363hooks to execute all of the scripts found in these directories. If
@@ -299,7 +433,7 @@ ignored.
299433Searches blobs registered in the index file.
300434.TP
301435.B \fB \-\- no \- index \fP
302- Searches files in the current directory that is not managed by Git .
436+ Searches files in the current directory that is not managed by git .
303437.TP
304438.B \fB \-\- untracked \fP
305439In addition to searching in the tracked files in the working tree,
@@ -507,16 +641,16 @@ git secrets \-\-add\-provider \-\- cat /path/to/secret/file/patterns
507641.UNINDENT
508642.SH DEFINING PROHIBITED PATTERNS
509643.sp
510- egrep compatible regular expressions are used to determine if a commit or
644+ \fB egrep \fP \- compatible regular expressions are used to determine if a commit or
511645commit message contains any prohibited patterns. These regular expressions are
512646defined using the \fB git config \fP command. It is important to note that
513647different systems use different versions of egrep. For example, when running on
514- OS X , you will use a different version of egrep than when running on something
648+ macOS , you will use a different version of \fB egrep \fP than when running on something
515649like Ubuntu (BSD vs GNU).
516650.sp
517651You can add prohibited regular expression patterns to your git config using
518652\fB git secrets \-\- add <pattern> \fP \& .
519- .SH IGNORING FALSE- POSITIVES
653+ .SH IGNORING FALSE POSITIVES
520654.sp
521655Sometimes a regular expression might match false positives. For example, git
522656commit SHAs look a lot like AWS access keys. You can specify many different
@@ -533,12 +667,12 @@ git secrets \-\-add \-\-allowed \(aqmy regex pattern\(aq
533667.UNINDENT
534668.sp
535669You can also add regular expressions patterns to filter false positives to a
536- .gitallowed file located in the repository \(aq s root directory. Lines starting
537- with # are skipped (comment line) and empty lines are also skipped.
670+ \fB \& .gitallowed \fP file located in the repository\(aq s root directory. Lines starting
671+ with \fB # \fP are skipped (comment line) and empty lines are also skipped.
538672.sp
539673First, git\- secrets will extract all lines from a file that contain a prohibited
540674match. Included in the matched results will be the full path to the name of
541- the file that was matched, followed \(aq :\(aq , followed by the line number that was
675+ the file that was matched, followed by \(aq :\(aq , followed by the line number that was
542676matched, followed by the entire line from the file that was matched by a secret
543677pattern. Then, if you\(aq ve defined allowed regular expressions, git\- secrets will
544678check to see if all of the matched lines match at least one of your registered
@@ -605,8 +739,8 @@ And the following registered patterns:
605739.sp
606740.nf
607741.ft C
608- git config \-\- add \(aq password\e s*=\e s*.+\(aq
609- git config \-\- add \-\- allowed \-\- literal \(aq ex@mplepassword\(aq
742+ git secrets \-\- add \(aq password\e s*=\e s*.+\(aq
743+ git secrets \-\- add \-\- allowed \-\- literal \(aq ex@mplepassword\(aq
610744.ft P
611745.fi
612746.UNINDENT
@@ -669,7 +803,7 @@ git secrets \-\-scan /tmp/example && echo $?
669803.UNINDENT
670804.UNINDENT
671805.sp
672- Alternatively, you could whitelist a specific line number of a file if that
806+ Alternatively, you could allow a specific line number of a file if that
673807line is unlikely to change using something like the following:
674808.INDENT 0.0
675809.INDENT 3.5
@@ -689,13 +823,13 @@ patterns are not inadvertently matched due to the fact that the filename is
689823included in the subject text that allowed patterns are matched against.
690824.SH SKIPPING VALIDATION
691825.sp
692- Use the \fB \-\- no \- verify \fP option in the event of a false\- positive match in a
826+ Use the \fB \-\- no \- verify \fP option in the event of a false positive match in a
693827commit, merge, or commit message. This will skip the execution of the
694828git hook and allow you to make the commit or merge.
695829.SH ABOUT
696830.INDENT 0.0
697831.IP \(bu 2
698- Author: Michael Dowling < \fI \% https://github.com/mtdowling \fP >
832+ Author: \fI \% Michael Dowling \fP
699833.IP \(bu 2
700834Issue tracker: This project\(aq s source code and issue tracker can be found at
701835\fI \% https://github.com/awslabs/git \- secrets \fP
0 commit comments