Skip to content

fix(security): gate plugin assets + extend write denylist - #24886

Closed
fr33d3m0n wants to merge 1 commit into
NousResearch:mainfrom
fr33d3m0n:fr33d3m0n/fix-plugin-xss-auth
Closed

fr33d3m0n wants to merge 1 commit into
NousResearch:mainfrom
fr33d3m0n:fr33d3m0n/fix-plugin-xss-auth

Conversation

@fr33d3m0n

@fr33d3m0n fr33d3m0n commented May 13, 2026

Copy link
Copy Markdown

Summary

Two security hardening improvements for the dashboard and file write safety layer:

  1. Plugin assets authentication — The /dashboard-plugins/{name}/{path} route now requires a valid session token. Previously, this route was outside the /api/ prefix and therefore not covered by the auth middleware. After this change, plugin static assets follow the same authentication rules as all other dashboard endpoints.

  2. Write denylist extensionbuild_write_denied_paths() now includes four additional Hermes-internal state files: config.yaml, auth.json, cron/jobs.json, and shell-hooks-allowlist.json. These files control agent behavior and credentials, so they should not be writable by the agent's file tools — consistent with the existing protection for .env and SSH keys.

Changes

File Lines What
hermes_cli/web_server.py +4/-1 Add _require_token(request) to serve_plugin_asset()
agent/file_safety.py +4 Add 4 paths to build_write_denied_paths()
tests/tools/test_file_write_safety.py +34 5 new tests in TestHermesInternalStateDenyList

How to test

# Run the targeted test suite (21 tests, all pass):
scripts/run_tests.sh tests/tools/test_file_write_safety.py

# Manual verification for plugin assets:
# 1. Start dashboard: hermes --dashboard
# 2. Visit http://127.0.0.1:8765/dashboard-plugins/kanban/index.html
#    WITHOUT the session token → should return 401
# 3. WITH token → should serve normally

Test results

21 passed in 4.06s

All 16 existing tests pass (no regressions) + 5 new tests:

  • test_config_yaml_is_denied
  • test_auth_json_is_denied
  • test_cron_jobs_json_is_denied
  • test_shell_hooks_allowlist_is_denied
  • test_env_still_denied ✅ (regression guard)

Platform

Tested on Linux (Ubuntu 24.04). Changes use _hermes_home_path() and os.path.realpath() — cross-platform compatible.

Related

… denylist

Two complementary security hardening changes:

1. Dashboard plugin static assets (`/dashboard-plugins/{name}/{path}`)
   now require a valid session token. The route is outside `/api/` so
   the auth middleware did not cover it — an unauthenticated user could
   load arbitrary HTML/JS from plugin directories (stored XSS surface).
   Fix: add `_require_token(request)` inline.

2. Extend `build_write_denied_paths()` with four Hermes-internal state
   files that an LLM-driven agent must never overwrite:
   - `config.yaml`  (disables approval system via `approvals.mode: yolo`)
   - `auth.json`    (OAuth token theft)
   - `cron/jobs.json` (malicious cron persistence)
   - `shell-hooks-allowlist.json` (hook injection)

   Without these entries, a single `write_file` tool call can cascade
   from prompt injection to full system compromise (AC-001 attack chain).

Includes 5 new tests in TestHermesInternalStateDenyList (21/21 pass).

Refs: Issue #17873, GHSA-w5p2-4rpw-49c7, GHSA-rf7m-jmc6-g894
@alt-glitch alt-glitch added type/security Security vulnerability or hardening comp/cli CLI entry point, hermes_cli/, setup wizard comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists labels May 13, 2026
@alt-glitch alt-glitch added comp/dashboard Web dashboard / control panel UI (dashboard/, landing) area/auth Authentication, OAuth, credential pools sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data and removed comp/cli CLI entry point, hermes_cli/, setup wizard labels Jun 26, 2026
@fr33d3m0n fr33d3m0n closed this by deleting the head repository Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/dashboard Web dashboard / control panel UI (dashboard/, landing) P2 Medium — degraded but workaround exists sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/security Security vulnerability or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants