Skip to content

fix(read): narrow .env file blocking to not block .envrc - #5654

Merged
rekram1-node merged 1 commit into
anomalyco:devfrom
bukzor:fix/env-file-blocking
Dec 22, 2025
Merged

rekram1-node merged 1 commit into
anomalyco:devfrom
bukzor:fix/env-file-blocking

Conversation

@bukzor

@bukzor bukzor commented Dec 16, 2025

Copy link
Copy Markdown
Contributor

Summary

  • Fix overly broad .env file blocking that was catching .envrc (direnv) and other legitimate files
  • Changed from filepath.includes(".env") to basename-only regex /^\.env(\.|$)/
  • Added .env.example and .env.template to whitelist
  • Added test coverage for env file blocking behavior

Test plan

  • bun test test/tool/read.test.ts passes (7 tests)
  • Manual test: can now read .envrc files
  • Verify .env, .env.local, .env.production still blocked

Fixes #4969

🤖 Generated with Claude Code

The check `filepath.includes(".env")` was blocking any file with ".env"
anywhere in the path, including .envrc (direnv config) and source files
like environment.ts. Changed to basename-only regex that blocks .env,
.env.local, .env.production etc. but allows .envrc and unrelated files.

Fixes anomalyco#4969

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@rekram1-node
rekram1-node merged commit 60db171 into anomalyco:dev Dec 22, 2025
3 checks passed
rekram1-node pushed a commit that referenced this pull request Dec 27, 2025
Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request May 5, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request Jun 14, 2026
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 2026
meSingh pushed a commit to meSingh/opencode that referenced this pull request Sep 6, 2026
androidand pushed a commit to androidand/opencode-skein that referenced this pull request Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overly restrictive .env file blocking prevents reading legitimate files

2 participants