Skip to content

guardrails: block credential-reading commands on a Bash|PowerShell PreToolUse matcher #5305

Closed

Description

@kyle-sexton

Found by the 2026-09-29 audit of the Cursor agent run (follow-up to #4244).

Incident (#4244): a researcher ran git credential fill and captured a live GitHub OAuth token into its transcript. plugins/guardrails/hooks/hooks.json registers secret-pattern-detection.sh only on Write|Edit|MultiEdit|NotebookEdit and the GitHub-MCP write matcher, so the Bash pool is unguarded, and that detector scans written content, not command shapes. Rung 3 of #4244 was deferred by PR #4745 to a closed issue with no tracker.

Acceptance:

  • A PreToolUse hook on Bash|PowerShell that denies the command shapes named in parent-contract.md "Credentials stay unread": git credential fill, gh auth token, printenv or echo of token-shaped variables, cat of .git-credentials, .netrc, .env.
  • One test per shape.
  • A documented false-positive escape.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: security

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions