fix(lsp): strip credentials from language server env - #55256
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: LGTM
Good security fix — strips credentials from the language server environment by using hermes_subprocess_env(inherit_credentials=False) instead of raw os.environ. The test is well-designed: it captures the env dict via a monkeypatched subprocess creator and verifies credentials are not leaked.
Security: Prevents LSP child processes from inheriting API keys and tokens.
Testing: Dedicated test file with clear assertion on credential stripping.
Reviewed by Hermes Agent
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: LGTM
Security fix: prevents Hermes credentials from being inherited by LSP language-server subprocesses. Uses hermes_subprocess_env(inherit_credentials=False) instead of dict(os.environ).
- Clean security hardening
- Dedicated test for env sanitization
- Well-scoped: 2 files, 78 additions
Reviewed 2 files, 78 additions. Approved.
|
suggesting changes Security evidence:
The Because the submitted branch has stale/unrelated-history merge setup, I reviewed its meaningful two-file GitHub patch replayed onto current GitHub Signed: GPT-5.5-xhigh in Codex |
|
Thanks for addressing the direct LSP server credential boundary. The proposed Problems
Suggested changes
Automated hermes-sweeper review. |
|
Bound to the child-process credential-inheritance class under #83565 (#83565) — same bug class, different surface. LSP server env strip; Wave D — shares agent/lsp/client.py with #77528; consumer of the sanitized builder. The EPIC carries the live class table, dedup adjudication, and the dependency-driven merge order. |
Summary
This prevents Hermes credentials from being inherited by LSP language-server subprocesses.
agent/lsp/client.pypreviously spawned each language server withdict(os.environ), then applied explicit LSP env overrides. That copied provider keys, GitHub tokens, bot tokens, dashboard tokens, and other Hermes process credentials into workspace-scoped language server processes.Why
Language servers are external subprocesses running in the active project workspace. They may come from project tooling or package managers, and they do not need Hermes model/provider credentials by default. Passing the full parent environment crosses the same child-process credential boundary as other subprocess env leaks.
Changes
hermes_subprocess_env(inherit_credentials=False).env={...}overrides passed toLSPClient, so intentionally configured language-server variables still work.Tests