Skip to content

OpenCode should have better/safer defaults to be more security minded #5076

Closed as not planned

Description

@calper-ql

First: OpenCode is an awesome project.

However, in its current default configuration it behaves like a high-privilege remote control agent and poses a serious security risk.

Current behavior

On a standard, recommended install:

  1. Allow-by-default permissions
    OpenCode can freely read/write project files and run shell commands with no strong, unavoidable first-run warning.

  2. Auto-update enabled by default
    The tool silently updates itself on startup unless the user discovers and disables autoupdate. Code with file + shell access is replaced without explicit approval of each new version.

  3. Bash access from any model
    Any configured remote or local model can trigger shell commands with the same privileges as the user.

Combined, this is logically equivalent to installing an auto-updating remote access tool on a developer machine: if the update pipeline, binary distribution, or a model provider is compromised, an attacker gets a powerful foothold on every machine running OpenCode with defaults.

I am not saying OpenCode is malware or accusing the team of malicious intent. I am saying the current defaults create malware-class risk for users, especially given how widely the tool is now used.

On “we’ve thought about this a lot”

If the answer is “we discussed it and decided UX is better without prompts because most people turn them off”, I think that is not a sufficient bar for a tool this powerful.

In my view, once a project reaches this level of adoption and capability, there is an ethical responsibility to:

  • Treat safety as the default and “do anything automatically” as explicit opt-in.
  • Make the risks obvious to non-expert users, not hidden in config.

Having an MIT license or a power-user audience does not remove that responsibility.

Requested changes

  1. Secure defaults

    • permission.edit = "ask" by default
    • permission.bash = "ask" (or "deny") by default
  2. Auto-update as explicit opt-in

    • Default autoupdate to false or “notify only”.
  3. First-run security screen

    • Explain file access, shell execution, remote model control, and update behavior.
    • Let users explicitly choose between:
      • “Safe / ask before actions” (default)
      • “Permissive / allow edits and commands”.

Activity

  1. github-actions commented on Dec 4, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. thdxr commented on Dec 4, 2025

    @thdxr
    Member

    hey thanks for writing this up - we are looking at all the things you mentioned

    we're currently redesigning how permissions work so after that we're going to re-evaluate what our defaults look like

    for update we're going to have a prompt in app that you can say yes to when you want to update

    and a few other things i'm thinking about

    appreciate you bringing these up politely, we usually get messages assuming we're idiots or weird threats

  3. calper-ql commented on Dec 4, 2025

    @calper-ql
    Author

    Thanks for your work as well. This is an amazing tool and I really enjoy using it.

    Looking forward to how it will grow.

  4. changed the title [-]Opencode is a giant security risk: Malware like behavior[/-] [+]OpenCode should have better/safer defaults to be more security minded[/+] on Dec 4, 2025
  5. rekram1-node commented on Dec 4, 2025

    @rekram1-node
    Collaborator

    I updated the title a bit so we can track this better, if you feel like it isn't accurate feel free to reword it

  6. calper-ql commented on Dec 4, 2025

    @calper-ql
    Author

    I updated the title a bit so we can track this better, if you feel like it isn't accurate feel free to reword it

    I like it. Original sounded a bit too urgent as I thought it should be but given that the team is actively re-considering the issue the current title is fair.

  7. abumalick commented on Jan 4, 2026

    @abumalick

    A note on granular bash command permissions

    The best experience I've found for managing bash command permissions is in the Kilocode VS Code extension. When the LLM wants to execute a command, it prompts for approval and lets you choose the level of auto-approval that fits your workflow.

    For example, if the LLM runs:

    bun run test -- --files=tests/browser/scenarios/errors.spec.ts --tests="Invalid checkout URL shows error"
    

    You can choose to always approve at any granularity level:

    • bun — approve all bun commands
    • bun run — approve all bun run commands
    • bun run test — approve all test runs
    • The full command — approve only this exact invocation

    This approach strikes an excellent balance: it enforces meaningful permissions while letting users dial in exactly how much autonomy to grant, keeping productivity high without sacrificing control.

    Image
  8. jstasiak commented on Mar 13, 2026

    @jstasiak

    Still an issue, I was really surprised to see opencode just start running commands without confirmation.

  9. johnnykang commented on Mar 26, 2026

    @johnnykang

    just a update check.

    is this concern on the road map? OpenCode is very useful and my employer is not comfortable to approve me using the tool due to these concerns. it sounds too risky if something went south.

  10. Michael-Z-Freeman commented on Mar 27, 2026

    @Michael-Z-Freeman

    Whatever the devs decide is great. But there needs to be a warning on first run.

  11. mikolaj-wroblewski commented on Apr 14, 2026

    @mikolaj-wroblewski

    I want to add something on top of it, I am in favor of configuring safe operations like read / grep / explore out of the box with allow or at least asking the user when first time launching or even creating a new session if one wants to allow read operations out of the box (read file / read directory, etc.)

    While having more secure defaults is great, I also want to emphasize user experience. I know I can configure reads in the configuration with allow, but what if I want to have more controlled session from time to time?

  12. divinedev7777 commented on Apr 14, 2026

    @divinedev7777

    I fully support this, also I agree completely with @mikolaj-wroblewski take.

  13. github-actions commented on Jun 14, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  14. ony commented on Jul 12, 2026

    @ony

    That's so cool for this issue to be auto-closed as not planned by github-actions !

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions