Metadata-Version: 2.5
Name: refhound
Version: 0.1.0b1
Summary: Git repository security and forensic analysis tool
Project-URL: Homepage, https://github.com/MichaelWeissDEV/RefHound
Project-URL: Documentation, https://refhound.readthedocs.io/
Project-URL: Repository, https://github.com/MichaelWeissDEV/RefHound
Project-URL: Issues, https://github.com/MichaelWeissDEV/RefHound/issues
Project-URL: Changelog, https://github.com/MichaelWeissDEV/RefHound/blob/master/CHANGELOG.md
Author: Michael Weiss
License: MIT
License-File: LICENSE
Keywords: audit,forensics,git,secret-scanning,security
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Version Control :: Git
Requires-Python: >=3.12
Requires-Dist: httpx>=0.27
Requires-Dist: platformdirs>=4.2
Requires-Dist: pydantic>=2.6
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.7
Requires-Dist: sqlalchemy>=2.0
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: jsonschema>=4.23; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx-rtd-theme>=2.0; extra == 'docs'
Requires-Dist: sphinx>=7.0; extra == 'docs'
Provides-Extra: graph
Requires-Dist: networkx>=3.2; extra == 'graph'
Description-Content-Type: text/markdown

# RefHound

Git repository security and forensic analysis tool.

RefHound deeply inspects git repositories in order to surface information
that is no longer visible in the current working tree:

* deleted branches, lost / unreachable commits, dangling objects
* secrets that were introduced and later removed
* historical versions of credentials, keys and configuration
* suspicious CI/CD, authentication and deployment changes
* timeline, identity and force-push anomalies

It behaves like a combination of git forensics, repository archaeology,
secret scanning, history analysis, security audit and repository
inventorying. It answers the question:

> What happened in this repository, what information is still findable,
> and where should a security reviewer look?

RefHound is a *defensive* tool for repositories you are authorized to
analyse. It never attempts to bypass an access control, brute-force object
IDs or validate/reuse found credentials.

Full documentation is available at <https://refhound.readthedocs.io/>.

## Installation

During development:

```
uv sync --all-extras
```

(Once packaged: `pipx install refhound`.)

## Quick start

```
refhound scan .                  # standard profile
refhound scan . --deep           # deep archaeology (unreachable + lost chains)
refhound scan . --format json    # machine-readable output
refhound scan . --fail-on high   # exit 1 if a HIGH (or worse) finding exists

refhound secrets .
refhound lost .
refhound timeline .
refhound interesting .
refhound stats .
refhound doctor .
refhound report . --format markdown -o report.md
refhound analyze churn .
```

Completed scans are persisted locally. Run `refhound scan URL --deep` once;
all reporting and analysis commands then reuse its complete snapshot while
refs and relevant settings remain unchanged. `scan` itself also uses the
cache unless `--fresh` is passed. Remote mirrors are reused and are not
automatically downloaded again. Use `--refresh-remote` to fetch/prune a
mirror, `--fresh` to rerun analysis without fetching, and `--offline` to
prohibit network acquisition. Full secret values are never stored; scan,
repository, commit, author, finding, and redacted secret metadata are.

Exit codes: `0` clean / `1` findings above `--fail-on` threshold / `2` usage
or configuration error / `3` git, repository or provider error / `4`
internal error / `5` scan incomplete because a recoverable component failed.

## Project structure

```
refhound/
|-- pyproject.toml
|-- docs/                Sphinx (Read the Docs) documentation
|-- src/refhound/
|   |-- cli.py           command line interface
|   |-- config.py        profiles and .refhound.yml
|   |-- git/             centralised git command layer
|   |-- models/          pydantic data models
|   |-- detectors/       secret detectors
|   |-- scanners/        scan pipeline stages
|   |-- analysis/        correlation, scoring, anomaly analysis
|   |-- providers/       internal GitHub/GitLab adapter scaffold (not public in v0.1)
|   |-- storage/         SQLite persistence (SQLAlchemy)
|   |-- reporting/       console, JSON, Markdown, SARIF
|   `-- util/            hashing, redaction, date/path helpers
`-- tests/               unit + integration tests over fixture repos
```

## Security promises

* Found secrets are **redacted** by default (`ghp_ABCD...IJK`); only
  fingerprints, prefixes and suffixes are persisted.
* Full secret values are never written to console, JSON, Markdown, SQLite,
  logs or exceptions.
* No token validation, no login attempts, no credential reuse, no
  enumeration of private repositories.
* Facts and interpretation are strictly separated; heuristic results carry
  an explicit confidence value.

See [SECURITY.md](SECURITY.md).

## Development

```
uv sync --all-extras
uv run ruff check .
uv run ruff format --check .
uv run mypy src/refhound
uv run pytest
```

## Documentation build

```
uv sync --all-extras
uv run sphinx-build docs docs/_build
```

## License

MIT - see [LICENSE](LICENSE). Copyright (c) 2026 Michael Weiss.
