Skip to content

Make pre-push protection safe when chained after stdin-consuming hooks #32

Description

@CodeDeficient

Problem

.githooks/pre-push reads Git's pre-push ref-update records from standard input. The setup script refuses to replace an existing pre-push hook and tells users to manually chain KarpeSlop from it.

If the existing hook consumes stdin before invoking .githooks/pre-push, KarpeSlop receives EOF, checks no refs, and exits successfully. A push targeting main or master can then bypass this local guard.

Desired behavior

Manual chaining must preserve the Git ref-update stream for the KarpeSlop hook, or the installer must provide a supported wrapper/chaining mechanism that guarantees the guard runs with the original stdin.

Scope

  • Reproduce with an existing stdin-consuming pre-push hook.
  • Define a supported chaining contract.
  • Add regression coverage for multi-ref input and consumed-stdin scenarios.
  • Keep server-side protected-branch enforcement documented as the authoritative safeguard.

Relationship

Follow-up from PR #31: #31

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions