Skip to content

fix(security): keep the dashboard token out of agents' reach - #191

Merged
hanthor merged 2 commits into
tuna/v6from
sec/v6-agent-secrets
Nov 17, 2026
Merged

hanthor merged 2 commits into
tuna/v6from
sec/v6-agent-secrets

Conversation

@hanthor

@hanthor hanthor commented Nov 17, 2026

Copy link
Copy Markdown
Member

Security fix: keep the dashboard token out of agents' reach. Details follow in the security advisory.

🤖 Generated with Claude Code

hanthor and others added 2 commits November 17, 2026 18:56
The dashboard token is the owner credential on the dashboard API
(X-Hive-Internal, Bearer, and the hub proxy proof). Agents run in the
same container under their own UIDs and could read it in three places:

- Each agent's tmux server was started with the hive's whole
  environment. The server keeps it in its global environment and in its
  own /proc/<pid>/environ, both owned by the agent; the session-level
  removal only hid values from new panes. Every process the hive starts
  as an agent's user (tmux server and clients, su-exec helpers) now gets
  agentExecEnv: an allowlist of process basics, proxy settings, backend
  model keys and non-secret HIVE_* settings. The removal list stays as a
  second layer and now names the hive's own credentials.
- ttyd's command line carried -c hive:<token>, readable by every user.
  ttyd now listens on a unix socket in a fresh 0700 directory owned by
  the hive user, without a credential; the Node proxy and the Go
  /terminal proxy connect to it. HIVE_TTYD_BIND keeps the old TCP mode.
- The browser terminal's tmux client ran as the agent with ttyd's
  environment for as long as the terminal was open. It now starts from
  env -i, before su-exec.

As a further layer the Go API and the Node proxy refuse the shared token
from a loopback peer whose socket an agent's user owns (UID map).

After deploying, restart every agent's tmux server and rotate the
dashboard token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: James Reilly <jreilly1821@gmail.com>
codex_home_nfs_safety_test pins that chownTreeAsRoot and removeTreeAsRoot
shell out to su-exec chown/rm (not an in-process walk) by parsing for an
exec.Command call. Keep that call in place and set agentExecEnv on it
directly instead of going through suExec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: James Reilly <jreilly1821@gmail.com>
@github-actions

Copy link
Copy Markdown

Open PR overlap check

Base branch: tuna/v6

Conflicts are checked with every PR merged onto the current tip of tuna/v6, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#179 🔀 sync: merge upstream hivecommons/hive v6 (dea69b3) into tuna/v6 same files src/crux/agent/manager_homes.go
src/crux/agent/manager_tmux.go
src/deploy/entrypoint.sh
src/pkg/dashboard/server.go
src/pkg/dashboard/terminal_proxy.go
src/proxy/package.json
src/proxy/server.js

@tuna-reef-hive

Copy link
Copy Markdown
c251445

ℹ️ Sentinel notice — informational; author is trusted (owner), merge is not blocked

Hive flagged this PR (author @hanthor, head c25144532c15) because it matches behaviors that can override security controls, escalate privileges or damage the codebase. This is a heuristic, not an accusation — a maintainer should confirm the change is intended before it merges.

  • sensitive_path — changes 4 sensitive path(s) (Touches a sensitive path (OWNERS, workflows, policies, hive config, security docs, …))
    • src/deploy/entrypoint.sh
    • src/deploy/test_ttyd_url_arg.sh
    • src/deploy/ttyd-tmux.sh
    • src/proxy/package.json

Hive did not add the sentinel-alert label because this author is trusted. The finding remains recorded for audit and the dashboard Security tab; set sentinel.trusted_authors_block: true to require the blocking label for trusted authors too.

@hanthor
hanthor merged commit b4c7ceb into tuna/v6 Nov 17, 2026
24 checks passed
@hanthor
hanthor deleted the sec/v6-agent-secrets branch November 17, 2026 19:29
@github-actions

Copy link
Copy Markdown

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

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.

1 participant