Skip to content

fix(cli): require auth for allow everything endpoint - #11887

Merged
marius-kilocode merged 6 commits into
mainfrom
mark/harden-allow-everything-auth
Jul 3, 2026
Merged

fix(cli): require auth for allow everything endpoint#11887
marius-kilocode merged 6 commits into
mainfrom
mark/harden-allow-everything-auth

Conversation

@markijbema

Copy link
Copy Markdown
Contributor

What

Require authentication for the high-risk /permission/allow-everything endpoint even when the rest of a standalone server is running without global auth.

Why

allow-everything persists wildcard permission approvals. Leaving it callable on unauthenticated localhost servers made it reachable by local scripts and browser-origin attempts that could discover the server port.

Notes

  • TUI-owned worker servers now get a generated password and pass auth headers through internal and external TUI transports.
  • Daemon auth now uses a generated password instead of the fixed kilo password, and legacy fixed-password daemons are restarted.
  • Standalone kilo serve remains otherwise optional-auth, but this endpoint fails closed without configured credentials.

@markijbema
markijbema marked this pull request as ready for review July 2, 2026 14:38
if (await KiloTuiThreadDaemon.attach({ args, cwd, input: () => input(args.prompt), start })) return
// kilocode_change end
// kilocode_change start - protect TUI-owned HTTP routes from unauthenticated local callers
const password = Flag.KILO_SERVER_PASSWORD ?? randomUUID()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Consider moving this auth-header logic into the Kilo mirror module

This block (password/username/header derivation, plus the KILO_SERVER_USERNAME/KILO_SERVER_PASSWORD env additions and the four scattered headers, insertions below in this same shared upstream file) touches packages/opencode/src/cli/cmd/tui/thread.ts in ~7 separate spots. Since this file already has a Kilo mirror (src/kilocode/cli/cmd/tui/thread.ts, imported above as KiloTuiThreadDaemon), the auth derivation could live there as a single helper (e.g. KiloTuiThreadDaemon.workerAuth()) and be called with one kilocode_change-marked line here, reducing the diff surface against upstream opencode.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Merge (minor suggestion)

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/opencode/src/cli/cmd/tui/thread.ts 186 Auth-header derivation could be extracted into the existing Kilo mirror module (src/kilocode/cli/cmd/tui/thread.ts) to reduce upstream diff surface

Verified the core security fix: /permission/allow-everything is now fail-closed via REQUIRED_AUTH_PATHS/guarded() in authorization.ts, and ServerAuth.authorized correctly returns false when no password is configured, so the endpoint denies access even on otherwise-optional-auth standalone servers. Confirmed this is the only route registration for the endpoint (no bypass via V2Authorization, PtyConnectAuthorization, or the legacy router middleware). The daemon password migration (Daemon.matches rejecting password === "kilo") and TUI worker auth wiring are consistent and well covered by real-implementation tests in daemon.test.ts, console.test.ts, and permission-allow-everything.test.ts.

Files Reviewed (8 files)
  • .changeset/harden-allow-everything-auth.md
  • packages/opencode/src/cli/cmd/tui/thread.ts - 1 issue
  • packages/opencode/src/kilocode/daemon/daemon.ts
  • packages/opencode/src/server/routes/instance/httpapi/middleware/authorization.ts
  • packages/opencode/test/kilocode/cli/cmd/console.test.ts
  • packages/opencode/test/kilocode/daemon.test.ts
  • packages/opencode/test/kilocode/server/httpapi-exercise-scenarios.ts
  • packages/opencode/test/kilocode/server/permission-allow-everything.test.ts

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-5-20260630 · Input: 110 · Output: 30.2K · Cached: 5.8M

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode enabled auto-merge (squash) July 3, 2026 13:57
@marius-kilocode
marius-kilocode disabled auto-merge July 3, 2026 14:12
@marius-kilocode
marius-kilocode merged commit 51e45d7 into main Jul 3, 2026
26 checks passed
@marius-kilocode
marius-kilocode deleted the mark/harden-allow-everything-auth branch July 3, 2026 14:58
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…rything-auth

fix(cli): require auth for allow everything endpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants