[PR #6308] feat: add read_env permission to allow reading .env files #11831

Closed
opened 2026-02-16 18:16:46 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6308

State: closed
Merged: No


Summary

  • Adds a new read_env permission option that allows users to explicitly opt-in to letting agents read .env files
  • By default, .env files remain blocked (secure default)
  • Only supports "allow" or "deny" (no "ask" option for simplicity)

Usage

Add to opencode.json:

{
  "permission": {
    "read_env": "allow"
  }
}

Changes

  • packages/opencode/src/config/config.ts - Added read_env to permission schema
  • packages/opencode/src/agent/agent.ts - Added read_env to agent permission type and merge function
  • packages/opencode/src/tool/read.ts - Modified blocking logic to check permission
  • packages/opencode/test/tool/read.test.ts - Added tests for the new permission
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6308 **State:** closed **Merged:** No --- ## Summary - Adds a new `read_env` permission option that allows users to explicitly opt-in to letting agents read `.env` files - By default, `.env` files remain blocked (secure default) - Only supports `"allow"` or `"deny"` (no `"ask"` option for simplicity) ## Usage Add to `opencode.json`: ```json { "permission": { "read_env": "allow" } } ``` ## Changes - `packages/opencode/src/config/config.ts` - Added `read_env` to permission schema - `packages/opencode/src/agent/agent.ts` - Added `read_env` to agent permission type and merge function - `packages/opencode/src/tool/read.ts` - Modified blocking logic to check permission - `packages/opencode/test/tool/read.test.ts` - Added tests for the new permission
yindo added the pull-request label 2026-02-16 18:16:46 -05:00
yindo closed this issue 2026-02-16 18:16:46 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11831