Tag Archives: security

PoW-Hook: Zero-Trust Security for your Git Hooks

In the world of Git, client-side hooks are a delicate line of defense. We rely on them for linting, security scans, and unit tests, yet they are notoriously easy to bypass with a simple --no-verify flag. For security-conscious teams, this isn’t just a loophole; it’s a liability.

Enter PoW-Hook, an autonomous “Proof of Work” validation system for Git. PoW-Hook brings cryptographic enforcement to your development workflow, ensuring that no commit reaches your remote repository unless it has legitimately passed your local checks.

The Architecture of Trust

PoW-Hook operates on a Zero-Trust model. It treats the developer’s machine as an untrusted environment until a cryptographic signature proves compliance. The system is divided into three distinct layers:

  • The Laborer (Local Hooks): When a developer prepares a commit, PoW-Hook runs the mandatory local checks (configured via POW_CHECKS_CMD). On success, it generates a session UUID and records an attestation.
  • The Notary (Signing): The commit-msg hook signs a tri-factor payload – consisting of the Git tree hash, the session ID, and the passing status – using the developer’s local SSH private key. This signature is then bundled into a single, clean PoW-Checks Git trailer.
  • The Gatekeeper (Remote Verification): Upon pushing, a GitHub Action (or pre-receive hook) extracts the signature. It fetches the developer’s registered public keys directly from the GitHub API and verifies the signature. It also cross-references the session ID against a remote ledger to prevent “man-in-the-middle” signature forgery.

    Automated Incident Response

    One of the most powerful features of PoW-Hook is its aggressive incident response. If a commit is pushed without a valid signature:

    • Instant Obliteration: The validator force-reverts the branch to the last known-good state.
    • PR Quarantine: Any associated Pull Requests are automatically closed, and administrators are notified.
    • Support-Level Cleanup: Since GitHub’s API doesn’t allow for hard-deleting PR metadata, PoW-Hook provides direct links for admins to file a support ticket for complete history scrubbing.

    Why PoW-Hook?

    • Key Agnostic: Supports all SSH key types registered on GitHub (Ed25519, RSA, ECDSA).
    • Zero-Bypass: Even malicious insiders cannot bypass the server-side gatekeeper without the required cryptographic proof.
    • Low Overhead: Uses standard GitHub API calls and Action runner minutes, making it a cost-effective alternative to enterprise-only solutions.

    Get Started

    Getting started with PoW-Hook is a two-step process:

    1. Repo Admin: Run admin_install.py to scaffold the verification workflows.
    2. Developer: Run install.sh to configure local signing.

    For more details on the implementation, visit the PoW-Hook Architecture in the repository.