Skip to content

Security: orchestrator/memory bearer tokens persisted world-readable in kimi/grok user configs, never revoked #125

Closed

Description

@currentbits

Problem

The bearer tokens that protect the memory and orchestrator (coder-threads) servers are written into user-global CLI configs and left there forever:

  • electron/memory-sup.js:404 (ensureKimiMcpConfig) writes ~/.kimi-code/mcp.json with fs.writeFileSync(..., "utf8") and no mode, so a fresh file lands ~0644 containing headers.Authorization: Bearer <token> for both coder-memory and coder-threads.
  • electron/memory-sup.js:466-472 registers grok with grok mcp add <name> <url> -H "Authorization: Bearer <token>" -s user, persisting the token in ~/.grok/config.toml at user scope.
  • unregisterMcpServer (electron/memory-sup.js:129-141) only rewrites the claude config; the kimi/grok entries (with tokens) are never removed. They outlive the server, app updates, and uninstall.
  • Related: getCodexMcpArgs (electron/memory-sup.js:242-250) puts the token in a URL query param on the command line, so it is visible to any local process via ps for the lifetime of every codex run.

Impact

The coder-threads token drives thread_fork/thread_send → runner.startRun (electron/orchServer.js:262-313), i.e. arbitrary agent runs in any registered project. Any kimi/grok CLI session on the machine (outside Solenta, any cwd) silently carries this capability, and the tokens sit in world-readable files on multi-user machines. A leaked token is a full RCE primitive against every project open in Solenta while the app runs.

Fix direction

  • Write MCP config files with mode 0600.
  • Unregister kimi/grok MCP entries on shutdown/uninstall like the claude path does.
  • Prefer header/env-based auth for codex over a token in argv.
  • Consider rotating the token per app session so stale persisted entries stop working.

Activity

  1. added
    bug
    plan:todo
    plan:doing
    and removed
    plan:todo
    on Aug 16, 2026
  2. added a commit that references this issue on Aug 16, 2026
  3. added
    plan:done
    and removed
    plan:doing
    on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions