Plan for the threats before you publish an endpoint.
An OpenCode server can read and change source files, execute commands, and invoke configured AI providers. Remote access therefore creates a privileged path into a development machine. HTTPS alone does not make that path safe.
Threats to plan for
- A public scanner discovers an exposed OpenCode endpoint.
- A weak or reused Basic-auth password is guessed or leaked.
- A lost phone retains a working server URL and credentials.
- A proxy forwards normal HTTP but breaks or exposes realtime and terminal traffic.
- A user approves a dangerous tool action without reviewing the active project or session.
- A temporary tunnel URL is pasted into a public issue, log, or screenshot.
Minimum controls
- Bind OpenCode to
127.0.0.1when using a VPN, tunnel, or local reverse proxy. - Configure a unique username and a strong password.
- Prefer a private Tailscale route over a public hostname when possible.
- If using Cloudflare Tunnel, keep OpenCode authentication enabled and protect the Cloudflare account.
- Restrict firewall rules and tailnet ACLs to the minimum required scope.
- Keep KKCode and the OpenCode server on current releases.
- Review permissions, questions, changed files, and the selected project before accepting completion.
Credential handling
KKCode persists connection values in the device keystore (iOS Keychain / Android Keystore-backed SecureStore) so it can reconnect. Treat the device as holding access to the development server. Use device encryption and a strong screen lock, and rotate the OpenCode password after a device is lost or transferred.
Do not reuse an AI-provider API key as the OpenCode server password. Provider authentication and server connection authentication protect different systems.
Incident response
If an endpoint or credential is exposed:
- Stop or disable the tunnel or proxy route.
- Rotate the OpenCode username and password.
- Review server, proxy, and provider logs for unexpected activity.
- Revoke affected provider credentials if tool or environment exposure is plausible.
- Update the connection in KKCode only after the route is secured again.
Report security-sensitive issues by email to the address in the footer of kkcode.app. Use the troubleshooting checklist for failures without security impact.