Security hardening: session secret, WS authorization, device secret - #35
Merged
Conversation
If SESSION_SECRET is unset or the known placeholder, a real (non-dev) server now generates a strong random secret and persists it in the settings table instead of signing cookies with a publicly known key that anyone could forge into an admin session. Set SESSION_SECRET in the env to control it explicitly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses security findings #1, #3, #5 (server side). The agent side of #2 (TLS cert pinning) and #5 (device-secret client) shipped to
leuffen-rmm-agentseparately.✅ #1 — Insecure default
SESSION_SECRET(committed here:auth.py)Cookies were signed with the public default
dev-insecure-secret-change-meifSESSION_SECRETwas unset — anyone could forge an admin session. Now a real (non-dev) server refuses the default and instead generates a strong random secret once, persisted in thesettingstable (stable across restarts). Best practice: still setSESSION_SECRETexplicitly in your compose.⏳ #3 + #5 (server) — patch for
server/app/main.pymain.pyis 2,600 lines — too large to push safely through the bot interface in one shot, so here is the exact,py_compile-verified patch (only these two hunks change). Apply withgit applyon this branch:#3 — WebSocket authorization: the screen/terminal sockets only checked that you were logged in, not that you had access to the target device's org → any authenticated user could control any device by id. Now they enforce
require_org.#5 — per-device secret (trust-on-first-use): reconnects trusted
device_idalone. Now the server issues a per-device secret to agents that support it and requires it thereafter (stored hashed insettings; no DB migration). Legacy agents keep working; setRMM_REQUIRE_DEVICE_SECRET=1to enforce once the fleet is updated.New env vars
SESSION_SECRETRMM_SERVER_FINGERPRINTRMM_REQUIRE_DEVICE_SECRET🤖 Generated with Claude Code
Generated by Claude Code