Skip to main content

GitlabHarvester

Tests PyPI Python License Downloads Last commit

GitlabHarvester is a lightweight tool built to install in a minute and show impact fast. It searches every repository of a GitLab instance for keywords and secrets through the API, without cloning, including GitLab CE, which has no instance-wide code search.

  • Red team engagements. A quick PoC: install, point it at an instance, get findings. Fine-grained settings (branch and fork strategies, time windows, parallel requests) control how many requests are sent and how much noise they make.
  • Penetration tests. Instance-wide discovery of credentials, tokens and keys as part of the assessment.
  • Blue teams. Secret hunting and audits: full baselines, regular re-scans of recent activity, deduplicated reports, and a history of runs in the log file.
  • Developers, analysts and architects. Surprisingly handy as plain instance-wide code search: find where an API, a config key or a library is used across all projects.

GitlabHarvester run: project index, search plan, per-term progress and results

Install

pipx install gitlab-harvester    # or: pip install gitlab-harvester

Requires Python 3.10+ and a GitLab token with the read_api scope.

Quick start

export GITLAB_TOKEN=...

# Search one term in the default branch of every project
gitlab-harvester -u https://gitlab.example.com -t "$GITLAB_TOKEN" -s password

# Search a list of terms in all branches, skipping branches forks share with their upstream.
# --dump-projects rebuilds the index so it includes all branch names.
gitlab-harvester -u https://gitlab.example.com -t "$GITLAB_TOKEN" -f words.txt -b all --forks branch-diff --dump-projects --session audit

# Search only repositories with activity on or after a date, e.g. a weekly re-scan.
# Projects inactive since then are skipped without API calls; in active ones every file is searched.
gitlab-harvester -u https://gitlab.example.com -t "$GITLAB_TOKEN" -f words.txt -b all --started-from 2024-06-01 --session since-june

# Continue after an interruption (reuses the index)
gitlab-harvester -u https://gitlab.example.com -t "$GITLAB_TOKEN" -f words.txt -b all --forks branch-diff --session audit --resume

# Optional: options can also come from a config file (see config.example.ini); CLI arguments override it
gitlab-harvester -c config.ini -s token

# Remove duplicate hits and export as a JSON array
gitlab-harvester -m dedup   --input-file audit.jsonl --output-file clean.jsonl
gitlab-harvester -m convert --input-file clean.jsonl --output-file clean.json

More scenarios, and when to use which options (index-only export, fork strategies, fresh findings only, parallel requests, baseline and re-scans): docs/USE_CASES.md.

The first run builds a project index (<host>_project_index.jsonl), and later runs reuse it. Branch options take effect when the index is built; add --dump-projects after changing them. Hits are written to a JSONL session file as they are found.

Common options:

Option Purpose
-b, --branches default|all|N branches to index and search
--forks include|skip|branch-diff|all-branches how forks are handled
--time-after DATE, --time-before DATE limit the index, its projects and the files with hits to a time window
--started-from 2024-06-01 search only indexed projects with activity since the date
-w, --workers N parallel API requests, for instances without rate limits
-m dump-index, --dump-projects build or rebuild the project index
--session NAME, --resume name a session and continue it later
--post-process dedup,convert, --final-only deduplicate and convert the session right after the search
-c, --config FILE read options from an INI file (config.example.ini)

See docs/usage.md for every option, branch and fork strategies, and the output formats, and docs/USE_CASES.md for typical scenarios.

Development

git clone https://github.com/Cur1iosity/GitlabHarvester.git && cd GitlabHarvester
pip install -r requirements-dev.txt -e .
pytest

The tests and local runs use a bundled Fake GitLab API, so they need no real instance:

python -m fakegitlab
gitlab-harvester -u http://127.0.0.1:8080 -t dev-token -s password -b all

Details: docs/testing.md, docs/architecture.md. Debian/Kali packaging readiness: docs/packaging.md.

License

MIT. Use it only on GitLab instances you are authorized to work with: your own, your organization's, or those within the scope of an agreed engagement.

Metadata

Release files for gitlab-harvester 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitlab-harvester 1.0.0
File Size Uploaded Provenance Actions
gitlab_harvester-1.0.0.tar.gz 51.9 kB With provenance Details for gitlab_harvester-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gitlab-harvester 1.0.0
File Interpreter ABI Platform Actions
gitlab_harvester-1.0.0-py3-none-any.whl Python 3 none any Details for gitlab_harvester-1.0.0-py3-none-any.whl

Total release size: 109.4 kB

Release files / gitlab_harvester-1.0.0.tar.gz

Download URL gitlab_harvester-1.0.0.tar.gz
Size 51.9 kB
Tags Source
SHA-256 checksum
How to use checksums
829ecd189b2d21f93ad0d293ffeac44ff8e12754c1909fafdf1ecd2281189502
BLAKE2b-256 checksum
How to use checksums
7540e5d0730ccd4a97362779869f413eaa271935fb309a1d617c2e197ee777ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / gitlab_harvester-1.0.0-py3-none-any.whl

Download URL gitlab_harvester-1.0.0-py3-none-any.whl
Size 57.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
186a689c126c7083bcdaf6e26eedae1805770ef0fc803736e80e3b85cde9d581
BLAKE2b-256 checksum
How to use checksums
6c1de347ef68f490dbfc2ebffe05aea8636f519924d8e73bb6c1342fdd3ceb9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for gitlab-harvester 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gitlab_harvester-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page