Skip to content

[SECURITY] allow ignoring files to prevent secrets being leaked from .env to LLM #539

@aspiers

Description

@aspiers

Forgive me if I've missed it, but I couldn't see any mechanism in the code for ignoring files like .env which very often contain API secrets and other credentials and sensitive data.

The closest I could see was this hard-coded list:

https://github.com/sst/opencode/blob/67480e5a1c71a0b65467a724a7b7afa828f93168/packages/opencode/src/tool/ls.ts#L7-L19

If I'm right, that means that currently it's possible for security-critical data to be leaked to the LLM, which would be a pretty significant security concern. Other agentic coding environments have gone through the same pain, e.g. there are many threads such as this one in the Cursor forums. So it would be great if opencode got this right from early on.

I think it's fairly simple to solve: just support an .opencodeignore file at the top of the repo (and perhaps honour .gitignore by default too).

(On a related but tangential note, ideally everyone would standardise on .ai-ignore, .ai-rules etc. rather than every agent having its own set of config files, but that's a battle for another day ...)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions