Skip to content

Stop /processes returning command lines; cache the matched key check - #12

Merged
alexeybe1kin merged 1 commit into
mainfrom
fix/systemgate-quiet-outputs
Oct 31, 2026
Merged

alexeybe1kin merged 1 commit into
mainfrom
fix/systemgate-quiet-outputs

Conversation

@alexeybe1kin

Copy link
Copy Markdown
Collaborator

From the overnight security review (security-systemgate-1, S1, S2, S6).

  • S1 /processes returned up to 100 host command lines (/host/proc), which carry passwords and keys. It now returns the same metadata as /runtime: pid, name, user, CPU and memory, picked by an explicit field list so extra psutil fields never pass through. Nothing calls /processes today (ToolGate reads /runtime).
  • S2 every admin request ran 200,000 PBKDF2 rounds, even for a wrong key. After the first match (primed at startup from SYSTEMGATE_ADMIN_KEY), a constant-time SHA-256 compare decides; a new key file misses the cache and is checked in full.
  • S6 journal and package output loses terminal control codes (C0 except tab and newline, DEL, C1: the same rule as Pi), and a failed command reports only its exception class.

Not changed here: S3 (root user and uts: host; needs an image release and a server change), S5 (/backups re-hashing; needs a cache design). S4 (open /docs) is how every gate serves its contract.

Evidence: pytest tests 45 passed / 8 skipped; ruff clean; file sizes ok. Ten mutants, each caught by its test: cmdline requested again, proc.info passed through, control codes kept, str(exc) in either place, no cache, cache accepts anything, cache ignores the key file, cache stores a wrong key, no startup prime.

🤖 Generated with Claude Code

/processes listed each host process's command line (through /host/proc), and command
lines carry passwords and keys; /runtime already collects none. Every admin request
ran 200k rounds of PBKDF2 even for a wrong key, so any caller reaching the port could
starve the single worker. After the first match, primed at startup from the configured
key, a constant-time SHA-256 compare decides; a new key file is checked in full.
Journal and package output loses terminal control codes, and a failed command reports
only its exception class.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alexeybe1kin
alexeybe1kin merged commit 4e0eb43 into main Oct 31, 2026
3 checks passed
@alexeybe1kin
alexeybe1kin deleted the fix/systemgate-quiet-outputs branch October 31, 2026 09:10
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