Conversation
dawNotPoi
marked this pull request as ready for review
September 24, 2026 04:52
Contributor
Author
|
@xintaofei Ready for review: this removes the per-launch CodeG MCP broker capability token from process arguments and passes it through CODEG_MCP_TOKEN in the companion environment. A Linux subprocess check confirmed that the token is absent from ps and /proc/PID/cmdline; all seven CI checks passed. The change does not protect against same-user environment inspection, and the main app and companion must be upgraded together. Would appreciate your review. |
dawNotPoi
force-pushed
the
fix/mcp-capability-token-env
branch
from
September 28, 2026 07:05
644e847 to
822025b
Compare
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.
Summary
codeg-mcpbroker capability token through the companion's dedicated ACP stdio server environment instead of its process arguments.CODEG_MCP_TOKENin the companion; reject the old--tokenargument. Keep token registration, broker validation, revocation, feature flags, and other startup arguments intact.Fixes #156. The exposed value is CodeG's per-launch broker capability token, not a model provider API key.
Verification
cargo test --no-default-features --lib injected_companion_keeps_capability_token_out_of_process_args --config profile.test.package.codeg.debug=0— passed (1 test).cargo test --no-default-features --bin codeg-mcp capability_token_must_come_from_nonempty_environment --config profile.test.package.codeg.debug=0— passed (1 test).cargo clippy --no-default-features --bin codeg-mcp -- -D warnings— passed.codeg-mcpbinary and launched it as a real subprocess: MCPinitializesucceeded, the synthetic token was absent frompsand/proc/<pid>/cmdline, and it was present in the child environment. Unset and empty token values exited with code 2.envinto the MCP configuration.Scope and limits
This removes the token from ordinary process listings on Linux. It does not prevent a process with the same user identity from reading the companion's environment. Token authentication remains necessary for the broker, including the Windows named-pipe path. The main program and
codeg-mcpcompanion must be upgraded together; aCODEG_MCP_BINoverride must point to the matching version because older companions require--token. I did not run a full CodeG-to-Claude live session or Windows end-to-end test from this WSL checkout.