service: managed service keeps the auth password in plaintext in service.json - no passwordFile/env-only mode · Issue #57772 · anomalyco/opencode · GitHub
Skip to content

service: managed service keeps the auth password in plaintext in service.json - no passwordFile/env-only mode #57772

Open

Description

@dcsci

Summary

The managed background service (opencode service) stores its auth password in plaintext inside service.json by design, and there is no passwordFile or env-only mode for the managed service — so the service credential cannot be kept out of a config file on disk. OPENCODE_SERVER_PASSWORD is documented for serve/web standalone mode but does not remove the plaintext from the managed service's private configuration.

Environment

  • opencode version: v2.0.32
  • OS: Windows_NT 10.0.26300 (win32 x64)
  • Terminal: Unavailable (headless/agent context; terminal variables not set)
  • Shell: cmd.exe (ComSpec), agents run under PowerShell 7
  • Install/channel: latest
  • Active plugins: -opencode.browser, openchamber-agent-tool

Reproduction

  1. Set up the managed service and set its password: opencode service set password <secret>.
  2. Inspect ~/.config/opencode/service.json.
  3. The password field holds the secret in plaintext.

Expected Behavior

The managed service should support at least one of:

  • a passwordFile key in the service configuration, pointing at a separate (permission-restricted) file holding the secret, or
  • env-based resolution for the managed service (honoring OPENCODE_SERVER_PASSWORD in managed mode the way standalone serve does), or
  • a documented mode where service.json never contains the plaintext.

Actual Behavior

The plaintext password is stored inside service.json (documented as "the private service configuration"). There is no passwordFile/env-only mode for the managed service: setting the env var and a managed-service env block does not stop the plaintext from being written into the file by opencode service set password.

Additional Context

Workarounds we applied (all verified working, none removes the plaintext from the file):

  • rotated the password after a partial disclosure;
  • ACL-restricted service.json to the user account (NTFS);
  • stored the secret in a separate user-only-ACL file plus the user environment variable for defense in depth;
  • added the env var to the managed service's env block.

This is a hardening/feature request, not a security incident report: the request is a supported way to run the managed service without the plaintext password inside service.json.

Activity

  1. opencode-agent commented on Oct 21, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed write-up. I think this is a duplicate of #52156. That issue asks for file-based password input (OPENCODE_PASSWORD_FILE) and also for opencode service set password_file, matching the service's existing password key. That is the passwordFile option you describe for the managed service.

    Related issues, ordered from most to least likely to match:

    For context: in v2 the managed service (serve --service) is designed to take its password from service.json. OPENCODE_PASSWORD/OPENCODE_SERVER_PASSWORD only apply to standalone servers, which is why setting them doesn't change what opencode service set password writes.

    Please add your use case (Windows, NTFS ACLs, wanting no plaintext in service.json) to #52156. The bot will close this issue as a duplicate in 1 day unless you reply explaining how your request is different.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions