You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Session accessing .env file without asking the user. Curious what is the default behavior to prevent reading .env files and the likes of it. #4308
I was testing OpenCode on a test LibreChat project, and I noticed that it reads the project's .env file without any warning, nor asking the user to allow it.
OpenCode is in Plan mode (Plan Agent).
.env is in LibreChat's .gitignore as well, so what happened?
Curious what is the default behavior for the likes of .env files? By default, the agent should never read those files unless explicitly allowed, right?
Feel free to ignore if none of these address your specific case.
Cool! However, it is concerning that a tool like OpenCode needs a third-party plugin to have a critical functionality like this — such as preventing a known secret store such as .env files from being accessed entirely by OpenCode.
OpenCode already supports.ignore files, but it's not blocking, for example, the read tool or grep tool from reading from those files. You can check this plugin, https://github.com/lgladysz/opencode-ignore which extends some blocking functionalities for those tools except the bash tool, so, for example, Agent can read a file through the cat command. Gemini CLI is not blocking that, though.
Curious about the deeper decisions behind leaving this functionality unimplemented within OpenCode.
Hi team,
I've built a plugin to support excluding sensitive content from the agent's reach: https://github.com/pjmartos/opencode-leak-proof
It honours .aiexclude files at various locations as well as project-root .gitignore files (.gitignore files in subfolders are still not supported).
It's still in kind of an experimental phase, but early results are encouraging.
I would greatly appreciate any feedback you may have.
Cheers.
Activity
github-actions commentedon Nov 13, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
raymelon commentedon Nov 13, 2025
Cool! However, it is concerning that a tool like OpenCode needs a third-party plugin to have a critical functionality like this — such as preventing a known secret store such as
.envfiles from being accessed entirely by OpenCode.From #539 (comment):
Curious about the deeper decisions behind leaving this functionality unimplemented within OpenCode.
rekram1-node commentedon Nov 14, 2025
i brought this up before i joined the team a while ago
im making it deny reads to .envs going forward it makes more sense
redtux commentedon Nov 14, 2025
It doesn't just read it, it also overwrites it, cries when realizing its mistake, and kindly apologizes. 🤭 Had the same issue yesterday.
rekram1-node commentedon Nov 14, 2025
fixed in next release: 4c2e888
pjmartos commentedon Dec 2, 2025
Hi team,
I've built a plugin to support excluding sensitive content from the agent's reach: https://github.com/pjmartos/opencode-leak-proof
It honours
.aiexcludefiles at various locations as well as project-root.gitignorefiles (.gitignorefiles in subfolders are still not supported).It's still in kind of an experimental phase, but early results are encouraging.
I would greatly appreciate any feedback you may have.
Cheers.