Repository navigation
Fix/own security review - #5
Merged
Merged
Conversation
The store, the agent token and the Models tab created their directories with mkdir's default mode, so under Ubuntu's umask 002 the state directory came out 0775: group-writable, and listable by anyone who can reach it. Everything in it is 0600, but a group member could rename or replace files there (dashboard.url, which the desktop app follows), and the operator's ~/.local/state is not always 0700. They are now made 0700.
A key saved from the Models tab, or the one api_key_env names, stayed in force when a later save moved the endpoint, so the next job sent it to the new host. Whoever held a dashboard credential on this machine (the per-launch token, or a session) could point the analyst at an https server of their own, start an analysis, and receive the operator's API key along with the redacted host data; the same for the judge's key and a local port. A save that moves a section's endpoint (the judge's url; the analyst's provider or base_url; a revert to config.toml included) must now give that section's key again or remove it. The environment's key is config.toml's, for config.toml's endpoint alone. Changing the model on the same endpoint keeps the key, as before.
The service printed the sign-in URL, token included, to stdout, on the reasoning that only the operator reads it. Under the documented user unit, stdout goes to the journal, and on Ubuntu the journal directory grants read to adm and systemd-journal: members of those groups, without being root, could read the token and use the dashboard (and, before the previous change, take the analyst's key through it). stdout now gets the token only on a terminal. Anywhere else it gets the URL without the token and the path of dashboard.url (0600), which the README's service steps already use. The token was never logged.
A user can create any number of files where a glob looks (/home/*/.ssh/authorized_keys*), and every match was an open as root, a path in the framed result and a record in the observation. 20000 empty files took 3.25 s of root reads, outside any deadline, and made a 5.4 MB event, so ssh.keys.home failed to publish and every home's keys went unread. glob.glob also built the whole list first. The glob is now walked lazily and stops after MAX_MATCHES (256), with truncated set and one warning; the same 20000 files take 0.02 s and a 70 KB event. The vanished-match test patched glob.glob, which no longer runs; it now patches iglob, so it exercises the branch again.
When a reply is not strict JSON, _unstray looks after each double quote to decide whether it ends a string. It copied the rest of the reply to do so (text[i + 1:].lstrip()), so a reply full of quotes cost time quadratic in its length, synchronously on the service loop: 240 KB took 0.44 s, and a reply may be 4 MiB (minutes). The backend controls the reply, the same path as the redaction review finding. The look-ahead is now in place; the mended result is unchanged.
The tools return the host's own text (log lines, commands, unit and job definitions, process names, issue evidence) and models' answers, which anyone who can write to the journal or install a unit can shape. The same server hands the agent acknowledge, snooze and LLM-job tools, so a crafted log line could ask an agent to silence an issue. The analyst's prompts already say this; the MCP server did not. initialize now carries instructions saying so, and docs/agent-api.md's guardrails say it too. Also corrects the comment on the TLS session cookie: the __Host- prefix keeps it off other host names, not other ports on the same one (RFC 6265 8.5), which the single-user model is what covers.
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.
No description provided.