Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

talisman

> 开发工具
Open source

Using a pre-commit hook, Talisman validates the outgoing changeset for things that look suspicious — such as tokens, passwords, and private keys.

2.1K stars0 likes1 views
WebsiteGitHub

About

Using a pre-commit hook, Talisman validates the outgoing changeset for things that look suspicious — such as tokens, passwords, and private keys.

Talisman

A tool to detect and prevent secrets from getting checked in

## Table of Contents
  • What is Talisman?
  • Installation
    • Install onto path (recommended approach)
    • Installation as a global hook template
  • Configuring a project
    • Using with hook frameworks
      • Pre-commit
      • Husky
    • Directly invoking talisman
  • Upgrading
  • Talisman in action
    • Validations
    • Ignoring Files
      • Interactive mode
      • Ignoring specific detectors
      • Ignoring specific keywords
      • Ignoring multiple files of same type (with wildcards)
      • Ignoring files by specifying language scope
      • Custom search patterns
    • Configuring severity threshold
    • Talisman as a CLI utility
      • Interactive mode
      • Git history Scanner
      • Checksum Calculator
  • Talisman HTML Reporting
    • Sample Screenshots
  • Uninstallation
    • Uninstallation from a global hook template
    • Uninstallation from a single repository
  • Contributing to Talisman

What is Talisman?

Talisman is a tool that scans git changesets to ensure that potential secrets or sensitive information do not leave the developer's workstation.

It validates the outgoing changeset for things that look suspicious - such as potential SSH keys, authorization tokens, private keys etc.

Installation

Talisman supports MAC OSX, Linux and Windows.

Talisman can be installed and used in one of the following ways:

  1. As a standalone executable
  2. As a git hook as a global git hook template and a CLI utility (for git repo scanning)
  3. As a git hook into a single git repository

Talisman can be set up as either a pre-commit or pre-push hook on the git repositories.

Find the instructions below.

Disclaimer: Secrets creeping in via a forced push in a git repository cannot be detected by Talisman. A forced push is believed to be notorious in its own ways, and we suggest git repository admins to apply appropriate measures to authorize such activities.

Install onto path (recommended approach)

We recommend installing talisman onto your path so that it is available for git hook frameworks and scripts. Pick the correct binary for your system from our Releases Page, or run our install script:

bash
bash -c "$(curl --silent https://raw.githubusercontent.com/thoughtworks/talisman/main/install.sh)"

Or set environment variable INSTALL_LOCATION to specify a custom location for the binary:

bash
INSTALL_LOCATION=/usr/local/bin bash -c "$(curl --silent https://raw.githubusercontent.com/thoughtworks/talisman/main/install.sh)"

Or set environment variable VERSION to a released tag to install a specific version::

bash
VERSION=v1.36.0 bash -c "$(curl --silent https://raw.githubusercontent.com/thoughtworks/talisman/main/install.sh)"

Or using linuxbrew in Linux and homebrew in macOS by running the following command in terminal:

bash
brew install talisman

Installation as a global hook template

We offer scripts that will install Talisman as a pre-commit git hook template, as that will cause Talisman to be present, not only in your existing git repositories, but also in any new repository that you 'init' or 'clone'.

  1. Run the following command on your terminal, to download and install the binary at $HOME/.talisman/bin

As a pre-commit hook:

bash -c "$(curl --silent https://raw.githubusercontent.com/thoughtworks/talisman/main/global_install_scripts/install.bash)"

OR

As a pre-push hook:

bash -c "$(curl --silent https://raw.githubusercontent.com/thoughtworks/talisman/main/global_install_scripts/install.bash)" -- pre-push
  1. 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.

Remember to execute source on the path file or restart your terminal. If you choose to set the $PATH later, please export TALISMAN_HOME=$HOME/.talisman/bin to the path.

  1. Choose a base directory where Talisman should scan for all git repositories, and set up a git hook (pre-commit or pre-push, as chosen in step 1) as a symlink. This script will not clobber pre-existing hooks. If you have existing hooks you can add talisman through a hook framework
  • you can set SEARCH_ROOT environment variable with the path of the base directory before executing the installation so you don't need to input it manually during the installation

Configuring a project

Using with hook frameworks

Globally installing talisman as a hook will not clobber any existing hooks. If the installation script finds any existing hooks, it will only indicate so on the console. To run multiple hooks we suggest using a hook framework, such as pre-commit or husky. These instructions assume that the talisman executable is installed somewhere on your system's path.

Pre-commit

Use pre-commit to manage existing hooks along with Talisman. Reference our pre-commit-hooks in your .pre-commit-config.yaml:

yaml
-   repo: https://github.com/thoughtworks/talisman
    rev: 'v1.32.2'  # Update me!
    hooks:
      # both pre-commit and pre-push supported
      # -   id: talisman-push
      - id: talisman-commit

Husky

husky is an npm module for managing hooks. Add the following line to the husky pre-commit configuration in your package.json:

talisman --githook pre-commit

Directly invoking talisman

Once the talisman executable is installed you can configure a standalone pre-commit hook for a git repository:

bash
cd my-git-project
echo "talisman -g pre-commit" >> .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

Upgrading

Since release v0.4.4, Talisman automatically updates the binary to the latest release, when the hook is invoked (at pre-commit/pre-push, as set up). So, just sit back, relax, and keep using the latest Talisman without any extra efforts.

The following environment variables can be set:

  1. TALISMAN_SKIP_UPGRADE: Set to true if you want to skip the automatic upgrade check. Default is false
  2. TALISMAN_UPGRADE_CONNECT_TIMEOUT: Max connect timeout before the upgrade is cancelled(in seconds). Default is 10 seconds.

If at all you need to manually upgrade, here are the steps:
[Recommended] Update Talisman binary and hook scripts to the latest release:

bash
curl --silent  https://raw.githubusercontent.com/thoughtworks/talisman/main/global_install_scripts/update_talisman.bash > /tmp/update_talisman.bash && /bin/bash /tmp/update_talisman.bash

Update only Talisman binary by executing:

bash
curl --silent  https://raw.githubusercontent.com/thoughtworks/talisman/main/global_install_scripts/update_talisman.bash > /tmp/update_talisman.bash && /bin/bash /tmp/update_talisman.bash talisman-binary

Talisman in action

After the installation is successful, Talisman will run checks for obvious secrets automatically before each commit or push (as chosen during installation). In case there are any security breaches detected, talisman will display a detailed report of the errors:

…

In the above example, the file danger.pem has been flagged as a security breach due to the following reasons:

  • The filename matches one of the pre-configured patterns.
  • The file contains an awsSecretKey which is scanned and flagged by Talisman

If you have installed Talisman as a pre-commit hook, it will scan only the diff within each commit. This means that it would only report errors for parts of the file that were changed.

In case you have installed Talisman as a pre-push hook, it will scan the complete file in which changes are made. As mentioned above, it is recommended that you use Talisman as a pre-commit hook.

Validations

The following detectors execute against the changesets to detect secrets/sensitive information:

  • Encoded values - scans for encoded secrets in Base64, hex etc.
  • File content - scans for suspicious content in file that could be potential secrets or passwords
  • File size - scans for large files that may potentially contain keys or other secrets
  • Entropy - scans for content with high entropy that are likely to contain passwords
  • Credit card numbers - scans for content that could be potential credit card numbers
  • File names - scans for file names and extensions that could indicate them potentially containing secrets, such as keys, credentials etc.

Ignoring Files

If you're really sure you want to push that file, you can configure it into the .talismanrc file in the project root. The contents required for ignoring your failed files will be printed by Talisman on the console immediately after the Talisman Error Report:

bash
If you are absolutely sure that you want to ignore the above files from talisman detectors, consider pasting the following format in .talismanrc file in the project root
fileignoreconfig:
- filename: danger.pem
  checksum: cf97abd34cebe895417eb4d97fbd7374aa138dcb65b1fe7f6b6cc1238aaf4d48
  ignore_detectors: []

Entering this in the .talismanrc file will ensure that Talisman will ignore the danger.pem file as long as the checksum matches the value mentioned in the checksum field.

Interactive mode

Available only for non-Windows users

If it is too much of a hassle to keep copying content to .talismanrc everytime you encounter an error from Talisman, you could enable the interactive mode and let Talisman assist you in prompting the additions of the files to ignore. Just follow the simple steps:

  1. Open your bash profile where your environment variables are set (.bashrc, .bash_profile, .profile or any other location)
  2. You will see TALISMAN_INTERACTIVE variable under # >>> talisman >>>
  3. If not already set to true, add export TALISMAN_INTERACTIVE=true
  4. Don't forget to save and source the file

That's it! Every time Talisman hook finds an error during pre-push/pre-commit, just follow the instructions as Talisman suggests. Be careful to not ignore a file without verifying the content. You must be confident that no secret is getting leaked out.

Ignoring specific detectors

Below is a detailed description of the various fields that can be configured into the .talismanrc file:

  • filename : This field should mention the fully qualified filename.
  • checksum : This field should always have the value specified by Talisman in the message displayed above. If at any point, a new change is made to the file, it will result in a new checksum and Talisman will scan the file again for any potential security threats.
  • ignore_detectors : This field will disable specific detectors for a particular file. For example, if your init-env.sh filename triggers a warning, you can only disable this warning while still

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gogitgit-hookshacktoberfesthusky

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具