Skip to content

bug: block-env-files and protect-env-vars false-positive on quoted string content #49

@yashexosphere

Description

@yashexosphere

Problem

block-env-files and protect-env-vars incorrectly block legitimate commands that mention .env or export inside quoted argument values:

  • gh pr create --body "don't commit .env files" → incorrectly blocked
  • git commit -m "export PATH changes" → incorrectly blocked
  • echo "copy .env.example to .env" → incorrectly blocked
  • Read .env.example (committed template) → incorrectly blocked

The regexes matched the full command string including quoted content.

Image

Root cause

No quote stripping before regex matching. Policy sees the full string including argument values.

Affected policies

  • block-env-files
  • protect-env-vars

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions