You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [As a global hook template (Recommended)](#installation-as-a-global-hook-template)
15
+
- [To a single repository](#installation-to-a-single-project)
16
+
- [As a CLI to find file types](#installation-as-a-cli)
17
+
-[Talisman in action](#talisman-in-action)
18
+
- [Validations](#validations)
19
+
- [Ignoring files](#ignoring-files)
20
+
-[Uninstallation](#uninstallation)
21
+
- [From a global hook template](#uninstallation-from-a-global-hook-template)
22
+
- [From a single repository](#uninstallation-from-a-single-repository)
23
+
-[Contributing to Talisman](#contributing-to-talisman)
24
+
- [Developing locally](#developing-locally)
25
+
- [Releasing](#releasing)
26
+
27
+
# What is Talisman?
28
+
Talisman is a tool that installs a hook to your repository to ensure that potential secrets or sensitive information do not leave the developer's workstation.
29
+
30
+
It validates the outgoing changeset for things that look suspicious - such as potential SSH
7
31
keys, authorization tokens, private keys etc.
8
32
9
-
The aim is for this tool to do this through a variety of means
10
-
including file names and file content. We hope to have it be an
11
-
effective check to prevent potentially harmful security mistakes from
12
-
happening due to secrets which get accidentally checked in to a
13
-
repository.
14
33
15
-
The implementation as it stands is very bare bones and only has the
16
-
skeleton structure required to add the full range of functionality we
17
-
wish to incorporate. However, we encourage folks that want to
18
-
contribute to have a look around and contribute ideas/suggestions or
19
-
ideally, code that implements your ideas and suggestions!
34
+
# Installation
35
+
36
+
Talisman supports MAC OSX, Linux and Windows.
20
37
21
-
## Installation
38
+
Talisman can be installed and used in one of three different ways:
22
39
23
-
Talisman can either be installed and used in three different ways
24
-
1. As a git hook into a single git repository
25
-
2. As a git hook as a global [git hook template](https://git-scm.com/docs/git-init#_template_directory)
40
+
1. As a git hook as a global [git hook template](https://git-scm.com/docs/git-init#_template_directory)
41
+
2. As a git hook into a single git repository
26
42
3. As a CLI with the `--pattern` argument to find files
27
43
28
-
As a git hook, Talisman can be set up a as a pre-push or pre-commit hook on git repositories.
44
+
Talisman can be set up as either a pre-commit or pre-push hook on the git repositories.
45
+
46
+
Find the instructions below.
47
+
48
+
## [Recommended approach]
49
+
## Installation as a global hook template
50
+
51
+
We recommend installing Talisman as a git hook template, as that will cause
52
+
Talisman to be present, not only in your existing git repositories, but also in any new repository that you 'init' or
53
+
'clone'.
54
+
55
+
1. Run the following command on your terminal, to download and install the binary at $HOME/.talisman/bin
2. If you do not have TALISMAN\_HOME set up in your `$PATH`, you will be asked an appropriate place to set it up. Choose the option number where you set the profile source on your machine.
72
+
73
+
74
+
Remember to execute *source* on the path file or restart your terminal.
75
+
If you choose to set the `$PATH` later, please export TALISMAN\_HOME=$HOME/.talisman/bin to the path.
29
76
30
-
### Installation to a single project
77
+
78
+
3. Choose a base directory where Talisman should scan for all git repositories, and setup a git hook (pre-commit or pre-push, as chosen in step 1) as a symlink.
79
+
This script will not clobber pre-existing hooks. If you have existing hooks, [look for ways to chain Talisman into them.] (#handling-existing-hooks)
80
+
81
+
82
+
### Handling existing hooks
83
+
Installation of Talisman globally does not clobber pre-existing hooks on repositories. <br>
84
+
If the installation script finds any existing hooks, it will only indicate so on the console. <br>
85
+
To achieve running multiple hooks we suggest (but not limited to) the following two tools
86
+
87
+
#### 1. Pre-commit (Linux/Unix)
88
+
Use [pre-commit](https://pre-commit.com) tool to manage all the existing hooks along with Talisman.
89
+
In the suggestion, it will prompt the following code to be included in .pre-commit-config.yaml
90
+
91
+
```
92
+
- repo: local
93
+
hooks:
94
+
- id: talisman-precommit
95
+
name: talisman
96
+
entry: bash -c 'if [ -n "${TALISMAN_HOME:-}" ]; then ${TALISMAN_HOME}/talisman_hook_script pre-commit; else echo "TALISMAN does not exist. Consider installing from https://github.com/thoughtworks/talisman . If you already have talisman installed, please ensure TALISMAN_HOME variable is set to where talisman_hook_script resides, for example, TALISMAN_HOME=${HOME}/.talisman/bin"; fi'
97
+
language: system
98
+
pass_filenames: false
99
+
types: [text]
100
+
verbose: true
101
+
```
102
+
103
+
#### 2. Husky (Linux/Unix/Windows)
104
+
[husky](https://github.com/typicode/husky/blob/master/DOCS.md) is an npm module for managing git hooks.
105
+
In order to use husky, make sure you have already set TALISMAN_HOME to `$PATH`.
106
+
107
+
+**Existing Users**
108
+
109
+
If you already are using husky, add the following lines to husky pre-commit in package.json
1. Download the Talisman binary from the [Releases page](https://github.com/thoughtworks/talisman/releases) corresponding to your system type
47
-
2. Place the binary somewhere (either directly in your repository, or by putting it somewhere in your system and adding it to your `$PATH`)
48
-
3. Run talisman with the `--pattern` argument (matches glob-like patterns, [see more](https://github.com/bmatcuk/doublestar#patterns))
49
-
```bash
50
-
# finds all .go and .md files in the current directory (recursively)
51
-
talisman --pattern="./**/*.{go,md}"
52
-
```
53
-
54
-
### Installation as a global hook template (recommended)
55
-
We recommend installing it as a git hook template, as that will cause
56
-
Talisman to be present, not only in your existing git repositories, but also in any new repository that you 'init' or
57
-
'clone'.
58
-
59
-
Use the [Global scripts Readme](global_install_scripts/Readme.md) to guide you through the installation process.
60
-
61
-
### Installation
62
-
63
-
#### Usage with the [pre-commit](https://pre-commit.com) git hooks framework
165
+
### Handling existing hooks
166
+
Talisman will need to be chained with any existing git hooks.You can use [pre-commit](https://pre-commit.com) git hooks framework to handle this.
64
167
65
168
Add this to your `.pre-commit-config.yaml` (be sure to update `rev` to point to
66
169
a real git revision!)
@@ -74,9 +177,19 @@ a real git revision!)
74
177
# - id: talisman-push
75
178
```
76
179
77
-
## Talisman in action
180
+
## Installation as a CLI
181
+
1. Download the Talisman binary from the [Releases page](https://github.com/thoughtworks/talisman/releases) corresponding to your system type
182
+
2. Place the binary somewhere (either directly in your repository, or by putting it somewhere in your system and adding it to your `$PATH`)
183
+
3. Run talisman with the `--pattern` argument (matches glob-like patterns, [see more](https://github.com/bmatcuk/doublestar#patterns))
78
184
79
-
After the installation is successful, Talisman will run checks for obvious secrets automatically before each push:
185
+
```bash
186
+
# finds all .go and .md files in the current directory (recursively)
187
+
talisman --pattern="./**/*.{go,md}"
188
+
```
189
+
190
+
# Talisman in action
191
+
192
+
After the installation is successful, Talisman will run checks for obvious secrets automatically before each commit or push (as chosen during installation):
80
193
81
194
```bash
82
195
$ git push
@@ -86,7 +199,18 @@ The following errors were detected in danger.pem
86
199
error: failed to push some refs to 'git@github.com:jacksingleton/talisman-demo.git'
87
200
```
88
201
89
-
### Ignoring Files
202
+
## Validations
203
+
The following detectors execute against the changesets to detect secrets/sensitive information:
204
+
205
+
***Encoded values** - scans for encoded secrets in Base64, hex etc.
206
+
***File content** - scans for suspicious content in file that could be potential secrets or passwords
207
+
***File size** - scans for large files that may potentially contain keys or other secrets
208
+
***Entropy** - scans for content with high entropy that are likely to contain passwords
209
+
***Credit card numbers** - scans for content that could be potential credit card numbers
210
+
***File names** - scans for file names and extensions that could indicate them potentially containing secrets, such as keys, credentials etc.
211
+
212
+
213
+
## Ignoring Files
90
214
91
215
If you're *really* sure you want to push that file, you can add it to
92
216
a `.talismanignore` file in the project root:
@@ -124,6 +248,32 @@ At the moment, you can ignore
124
248
*`filename`
125
249
*`filesize`
126
250
251
+
# Uninstallation
252
+
The uninstallation process depends on how you had installed Talisman.
253
+
You could have chosen to install as a global hook template or at a single repository.
254
+
255
+
Please follow the steps below based on which option you had chosen at installation.
256
+
257
+
## Uninstallation from a global hook template
258
+
To uninstall talisman globally from your machine, run:
1. ask you for the base dir of all your repos, find all git repos inside it and remove talisman hooks
266
+
2. remove talisman hook from .git-template
267
+
3. remove talisman from the central install location ($HOME/.talisman/bin).<br>
268
+
269
+
<i>You will have to manually remove TALISMAN_HOME from your environment variables</i>
270
+
271
+
## Uninstallation from a single repository
272
+
When you installed Talisman, it must have created a pre-commit or pre-push hook (as selected) in your repository during installation.
273
+
274
+
You can remove the hook manually by deleting the Talisman pre-commit or pre-push hook from .git/hooks folder in repository.
275
+
276
+
# Contributing to Talisman
127
277
128
278
## Developing locally
129
279
@@ -147,9 +297,8 @@ To build Talisman, we can use [gox](https://github.com/mitchellh/gox):
147
297
148
298
Convenince scripts ```./build``` and ```./clean``` perform build and clean-up as mentioned above.
149
299
150
-
#### Contributing to Talisman
151
300
152
-
#####Releasing
301
+
## Releasing
153
302
154
303
* Follow the instructions at the end of 'Developing locally' to build the binaries
155
304
* Bump the [version in install.sh](https://github.com/thoughtworks/talisman/blob/d4b1b1d11137dbb173bf681a03f16183a9d82255/install.sh#L10) according to [semver](https://semver.org/) conventions
0 commit comments