Skip to main content

Local-first git commit guardrails: block secrets, forbidden files, and disallowed git identities before they are committed.

Project description

Coditation Sentinel

Local-first git commit guardrails. Sentinel installs a global git hook that runs on every git commit, in every repository on the machine, and blocks the commit before anything leaves the laptop when it finds:

  • 🔑 Secrets — API keys, tokens, private keys (via gitleaks)
  • 📄 Forbidden files.env, *.pem, *.key, keystores, dumps, …
  • 🧑‍💻 Disallowed git identity — commits authored with a personal email

It is built for a services company: developers commit to customer repositories whose remotes and CI we may not control, so enforcement lives on the developer's machine and never writes anything into the customer's repo.

How it works

git commit
   │  git runs the global hook → sentinel scan --staged
   ▼  (scans only the staged diff, so commits stay fast)
 secrets? · forbidden file? · git identity?
   │
 clean → commit proceeds      problem → friendly message + fix, commit aborted

The hook is wired via git config --global core.hooksPath, so a single install covers every repo automatically — nothing per-project, nothing added to customer code.

Git identity — three tiers

Identity Example Behavior
Company you@coditation.com ✅ silent pass
Customer / corporate you@acme-client.com ⚠️ allowed — shown once per repo, recorded locally
Personal @gmail.com, @outlook.com, … ❌ always blocked

We don't allow-list customer domains (impossible to maintain). Instead policy.yaml keeps a deny-list of personal providers; the company domain passes, personal is blocked, and everything else is treated as a legitimate customer identity.

Install

Quick install (recommended) — one-shot scripts

Hand a developer the script for their OS from runner/. It ensures Python 3.11, installs Sentinel into an isolated virtualenv, installs gitleaks, and wires the global git hook — no manual steps.

OS Run
macOS bash runner/run-macos.sh
Ubuntu / Debian bash runner/run-ubuntu.sh
Windows powershell -ExecutionPolicy Bypass -File runner/run-windows.ps1

Open a new terminal afterwards so the PATH change applies. Override the install source or versions via SENTINEL_PACKAGE, PYTHON_VERSION, GITLEAKS_VERSION (see runner/README.md). Prerequisite: git, plus a package manager (Homebrew / apt / winget) so Python 3.11 can be installed if missing.

Manual install

pip install coditation-sentinel      # (or: pip install -e . from a checkout)
sentinel install                     # sets global core.hooksPath + writes default policy
brew install gitleaks                # required for secret scanning (macOS)
sentinel status                      # verify enforcement + gitleaks

Commands

Command Purpose
sentinel install [--force] Install the global hook and default policy
sentinel scan --staged Scan staged changes (this is what the hook calls)
sentinel status Show enforcement status, policy source, gitleaks version
sentinel uninstall Remove the hook and revert core.hooksPath

Configuration

Policy lives at ~/.coditation-sentinel/policy.yaml (a copy of the packaged default). Edit it to adjust company domains, the personal-provider deny-list, and forbidden-file patterns. gitleaks rules live alongside it in gitleaks.toml.

A metadata-only log of non-Coditation identities used is kept at ~/.coditation-sentinel/identity-usage.log (timestamp, repo, email — never code).

Scope (Phase 1)

In: secrets, forbidden files, three-tier identity, global hook, CLI. Out (later): dependency/IaC scanning, PII detection, MDM/device enforcement, central dashboards. The local hook is the guarantee; server-side CI is intentionally not relied on.

Development

python3 -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coditation_sentinel-0.1.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coditation_sentinel-0.1.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file coditation_sentinel-0.1.0.tar.gz.

File metadata

  • Download URL: coditation_sentinel-0.1.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for coditation_sentinel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1d5d3970ebc266404e53c8e118c62fbfbadd90ebb86fd427b21d0de4444bba63
MD5 ff0bd24a4a4d93e4ac03ed6901e9524e
BLAKE2b-256 c485bd2186a805479ab8ff9552e03d62f161d39e47da84ad1807b54d26d4a243

See more details on using hashes here.

File details

Details for the file coditation_sentinel-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for coditation_sentinel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b060968a695083e37f4cd9f5691930889137c47b47226fcf4fe8d19f0589e5d3
MD5 a3db41ae1cd6859df5617f8d72bc4de5
BLAKE2b-256 f9f361f73d52515cf085c39e630c35713f2c8625f075093d6cb045adc7c7aaac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page