Skip to main content

Deep Scan

This guide helps you scan your repositories to uncover secrets hidden in your Git history.

Prerequisites

  1. Have a Vault++ account.
  2. Have a git repository.

1. Add a vpp scan config file

If you haven't already, create a vpp.scan.jsonc file in the root folder of your repository as shown below.

vpp.scan.jsonc
{
"$schema": "https://vaultplusplus.com/scan-schema.json",
"organization": "<your org slug>", // change to your organization slug

// Whitelisted Signatures
"whitelist": []
}

2. Scan a local repository

To scan a repository on your local machine, open a terminal, navigate to your repository folder, and run the following command:

# vpp scan repo --help
# Usage: vpp scan repo [options]

# Options:
# -c, --use-checkpoint Use checkpoints to skip previously scanned commits
# -s, --since <since> Oldest commit to scan from (excluding this commit)
# --worker <size> Worker size, defaults to the number of available CPU
# --mem <size> Memory size (MB) allocated to each worker, defaults to memory size / num of workers
# --max-batch <size> Maximum batch size
# -h, --help display help for command

vpp scan repo --use-checkpoint

3. Run a deep scan in CICD

Create a service account (If you have created a service account when creating the PR scanner, you can skip this step.)

The following steps will guide you in creating a dedicated service account without access to live environments, which can be used for deep repository scans and PR scans.

  1. Log in to your Vault++ account, choose the desired application, and navigate to the Settings tab.

  2. Find the Service Accounts section and click the Add () button.

  3. Enter a descriptive label, for example PR Scan, then press Enter.

  4. A dialog will display the private key and an encryption password. Do not close the dialog as you cannot access these credentials again after closing.

  1. In a new browser tab, open your GitHub repository and click the Settings tab.

  2. In the left sidebar, under Security , click Secrets and variables > Actions.

  3. Add the following secrets from the Vault++ dialog to Repository secrets:

    • VPP_SERVICE_ACCOUNT_KEY
    • VPP_SERVICE_ACCOUNT_PASSWORD
    warning
    Do not grant this service account access to any environment, as it will be used in PR pipelines, which run on unprotected branches.

Follow these steps to automatically run deep scans in your repository:

  1. Open your repository in your IDE.

  2. Create a new workflow YAML file, e.g., .github/workflows/vpp-scan.yml, with the following content:

    .github/workflows/vpp-scan.yml
    name: VPP Deep Scan
    on:
    push:
    branches:
    - main

    jobs:
    vpp:
    name: VPP Deep Scan
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    with:
    # fetch all history for deep scanning
    fetch-depth: 0

    - uses: vaultplusplus/setup@latest

    # Requires a vpp.scan.jsonc config file.
    - run: vpp scan repo --use-checkpoint
    env:
    VPP_SERVICE_ACCOUNT_KEY: ${{ secrets.VPP_SERVICE_ACCOUNT_KEY }}
    VPP_SERVICE_ACCOUNT_PASSWORD: ${{ secrets.VPP_SERVICE_ACCOUNT_PASSWORD }}
  3. Commit and push your changes.

Great job! 🎉 Your repository is now protected against secret leaks. In the next guide, we'll set up automated secret rotation.