Skip to content

feat(allowlist): cover per-environment .env.* files in secret-path protection #1265

Description

@hyy321

Problem Statement

#1240 adds built-in secret-path protection for .env, .env.local, and .env.*.local, but common per-environment files such as .env.production, .env.staging, and .env.development are still not covered.

These files are commonly used for environment-specific configuration and may contain real secrets, so they should receive the same protection as the existing .env patterns.

This was identified as a non-blocking follow-up during review of #1262.

Proposed Solution

Extend the built-in secret-path matching to cover .env.*, while keeping common committed template files reviewable.

For example:

  • Exclude .env.production
  • Exclude .env.staging
  • Exclude .env.development
  • Keep .env.example reviewable
  • Keep .env.sample reviewable
  • Keep .env.template reviewable

The existing secret-path behavior should stay the same:

  • Matches are reported as secret_exclude.
  • User include rules cannot override the protection.
  • The change remains limited to review/scan selection.
  • Agent runtime tools and content-based secret detection remain out of scope.

Alternatives Considered

Matching .env.* without exceptions would also exclude committed template files such as .env.example, .env.sample, and .env.template. Keeping the current patterns unchanged avoids those false positives but leaves common .env.<environment> files unprotected.

Affected Area

Review Rules

Additional Context

No response

Activity

  1. added
    enhancement
    on Sep 15, 2026
  2. added theissue type on Sep 15, 2026
  3. hyy321 commented on Sep 15, 2026

    @hyy321
    ContributorAuthor

    Hi @lizhengfeng101, now that #1262 has been merged, I’d be happy to take this follow-up if the direction above looks good.
    My plan is to extend the built-in .env.* matching while explicitly keeping .env.example, .env.sample, and .env.template reviewable. I’ll keep the existing secret_exclude precedence and review/scan scope unchanged, and add focused tests for both protected per-environment files and the template exceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions