Skip to content

Secretscan Command

The secretscan command discovers GitLab projects, clones them locally, and scans each repository for secrets using TruffleHog, Gitleaks, and/or Titus. Use it to find hardcoded credentials, API keys, and tokens across project repositories.

Terminal window
gogatoz secretscan [options]

Authentication:

Terminal window
export GITLAB_TOKEN=glpat_xxx
export GITLAB_URL=https://gitlab.com # optional, defaults to https://gitlab.com

You can also pass –token and –gitlab-url flags explicitly, or use --no-token for public projects.

Project discovery:

  • --query Search query filter for project discovery
  • --language Comma-separated language filter
  • --topic Comma-separated topic filter
  • --visibility Filter by visibility: public, internal, private
  • --membership Only projects the user is a member of
  • --owned Only projects owned by the user
  • --per-page Results per API page, max 100 (default: 50)
  • --max-pages Maximum pages to fetch, 0 = unlimited (default: 0)

Scanning:

  • --scanners Scanners to use: auto, trufflehog, gitleaks, titus (default: auto)
  • --clone-depth Git clone depth, 0 = full history (default: 1)
  • --concurrency Number of concurrent clone+scan workers (default: 4)
  • --scan-dir Scan pre-cloned repos in this directory (skips clone)
  • --discard-repos-after-scanning Remove repos after scanning to save disk (default: false)

Output:

  • -o, --output-dir Directory for cloned repos (required unless --scan-dir)
  • --output Write output to file (default: stdout)
  • --format Output format: text, json, jsonl
  • --redact Redact secret values in output (default: false)

Global flags (–token, –gitlab-url, –verbose, –insecure-skip-tls-verify, –ca-cert, rate/HTTP tuning) apply as usual.

At least one scanner must be installed:

  • TruffleHogbrew install trufflehog or pip install trufflehog
  • Gitleaksbrew install gitleaks or download from GitHub
  • Titus – download from GitHub

Use --scanners auto to detect all available tools and run them in parallel.

Auto-detect scanners, scan all accessible projects

Section titled “Auto-detect scanners, scan all accessible projects”
Terminal window
gogatoz secretscan --query "" -o ./scan-results
Terminal window
gogatoz secretscan --query "deploy" --scanners trufflehog -o ./scan-results
Terminal window
gogatoz secretscan --query "" --clone-depth 0 -o ./scan-results
Terminal window
gogatoz secretscan --query "" --no-token --visibility public -o ./scan-results
Terminal window
gogatoz secretscan --scan-dir /path/to/cloned/repos --scanners auto --redact

Find hardcoded tokens across an organization

Section titled “Find hardcoded tokens across an organization”
Terminal window
gogatoz secretscan \
--query "" \
--scanners trufflehog \
--clone-depth 0 \
--concurrency 8 \
-o ./full-scan \
--redact \
--json > secrets-report.json
Terminal window
gogatoz secretscan \
--query "ci runner deploy" \
--membership \
--scanners gitleaks \
-o ./ci-scan
Feature enumerate secretscan
Scans CI config (.gitlab-ci.yml) Full git history
Finds CI/CD misconfigurations Hardcoded secrets in code
Requires clone No (API only) Yes (clones repos)
Tools Built-in rules engine TruffleHog, Gitleaks, Titus
Speed Fast (API-based) Slower (clones + scans)

These commands are complementary – use both for full coverage.

  • The --scanners auto mode probes your PATH for available tools and runs all that are found.
  • Use --discard-repos-after-scanning when disk space is limited. Results are written to stdout/file before repos are removed.
  • The --clone-depth 0 flag clones full git history, which is slower but catches secrets in old commits.
  • Respect GitLab rate limits when scanning many projects. Use --concurrency and the global rate/retry flags to tune throughput.