• Stars
    star
    331
  • Rank 127,323 (Top 3 %)
  • Language
  • License
    MIT License
  • Created over 4 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GitGuardian Shield GitHub Action - Find exposed credentials in your commits


GitGuardian Shield GitHub Action

GitHub Marketplace Docker Image Version (latest semver) License GitHub stars

Find exposed credentials in your commits using GitGuardian shield.

The GitGuardian shield (ggshield) is a CLI application that runs in your local environment or in a CI environment to help you detect more than 200 types of secrets, as well as other potential security vulnerabilities or policy breaks.

GitGuardian shield uses our public API through py-gitguardian to scan your files and detect potential secrets or issues in your code. The /v1/scan endpoint of the public API is stateless. We will not store any files you are sending or any secrets we have detected.

Requirements

  • Have an account on GitGuardian. Sign up now if you haven't before!
  • Create an API key on the API Section of your dashboard.

Project secrets

  • GITGUARDIAN_API_KEY [Required]: Necessary to authenticate to GitGuardian's API. You can set the GITGUARDIAN_API_KEY value in the "Secrets" page of your repository's settings. You can create your API Key here.

Usage

Add a new job to your GitHub workflow using the GitGuardian/ggshield-action action.

name: GitGuardian scan

on: [push, pull_request]

jobs:
  scanning:
    name: GitGuardian scan
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0 # fetch all history so multiple commits can be scanned
      - name: GitGuardian scan
        uses: GitGuardian/[email protected]
        env:
          GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }}
          GITHUB_PUSH_BASE_SHA: ${{ github.event.base }}
          GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }}
          GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
          GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}

Do not forget to add your GitGuardian API Key to the GITGUARDIAN_API_KEY secret in your project settings.

Adding extra options to the action

The following options can be added to the action by using action inputs:

Options:
  --show-secrets  Show secrets in plaintext instead of hiding them.
  --exit-zero     Always return a 0 (non-error) status code, even if issues
                  are found.The env var GITGUARDIAN_EXIT_ZERO can also be used
                  to set this option.

  --all-policies  Present fails of all policies (Filenames, FileExtensions,
                  Secret Detection).By default, only Secret Detection is
                  shown.

  -v, --verbose   Verbose display mode.

Example:

name: GitGuardian scan

on: [push, pull_request]

jobs:
  scanning:
    name: GitGuardian scan
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0 # fetch all history so multiple commits can be scanned
      - name: GitGuardian scan
        uses: GitGuardian/[email protected]
        with:
          args: -v --all-policies
        env:
          GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }}
          GITHUB_PUSH_BASE_SHA: ${{ github.event.base }}
          GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }}
          GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
          GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}

Examples of GitGuardian scanning

Scan output example

This a sample scan result from GitGuardian shield.

If the secret detected has been revoked and you do not wish to rewrite git history, you can use a value of the policy break (for example: the value of |_password_|) or the ignore SHA displayed in your .gitguardian.yaml under matches-ignore.

An example configuration file is available here.

Status example

If there are secret leaks or other security issues in your commit your workflow will be marked as failed.

Be sure to add GitGuardian scan to your required status checks in your repository settings to stop pull requests with security issues from being merged.

License

GitGuardian shield is MIT licensed.

More Repositories

1

APISecurityBestPractices

Resources to help you keep secrets (API keys, database credentials, certificates, ...) out of source code and remediate the issue in case of a leaked API key. Made available by GitGuardian.
1,911
star
2

ggshield

Find and fix 400+ types of hardcoded secrets and 70+ types of infrastructure-as-code misconfigurations.
Python
1,669
star
3

ggcanary

GitGuardian Canary Tokens
Python
131
star
4

py-gitguardian

Python API client library for the GitGuardian API
Python
75
star
5

src-fingerprint

Extract git related information (file shas, commit shas) from your hosted source version control system
Go
20
star
6

gitguardian-vscode

Stop leaks. Safeguard your secrets with GitGuardian. GitGuardian actively prevents accidental exposure of sensitive information in your code, allowing you to code confidently and maintain the integrity of your data.
TypeScript
18
star
7

sample_secrets

Python
14
star
8

esdump-rs

Dump Elasticsearch or Opensearch indexes to blob storage, fast πŸš€
Rust
12
star
9

homebrew-tap

Homebrew tap for GitGuardian's tools
Ruby
5
star
10

blog-playground

Try our tips to optimize Django queries by yourself
Jupyter Notebook
5
star
11

ggtools

Welcome to the GitGuardian Tools Repository! Here, you'll find a collection of shared tools and scripts designed to enhance the experience of GitGuardian's customers.
Python
5
star
12

homebrew-ggshield

Homebrew tap for ggshield
3
star
13

gitguardian-examples

A Jupyter Notebook based example of using the GitGuardian API for remediation
Jupyter Notebook
3
star
14

.github

2
star
15

gg-shield-orb

GitGuardian Shield Circle CI Orb - Find exposed credentials in your commits
1
star