Skip to content

mcpx e2e: env allowlist + registry guard + TestMain backstop (#1992 follow-up) - #4804

Open
dezren39 wants to merge 2 commits into
mainfrom
queue/3284-1992-e2e-env-allowlist
Open

dezren39 wants to merge 2 commits into
mainfrom
queue/3284-1992-e2e-env-allowlist

Conversation

@dezren39

@dezren39 dezren39 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Follow-up for #1992 (task 3284).

What changed

  • pkgs/mcpx/internal/testsupport/childenv.go (new): ChildEnv allowlist builder -- parent contributes PATH, TMPDIR, LANG/LC_, TERM, SYSTEMROOT and explicit runtime-cache passthroughs (DENO_DIR, BUN_INSTALL_CACHE_DIR, NPM_CONFIG_CACHE) only; XDG_CONFIG_HOME/XDG_DATA_HOME/XDG_STATE_HOME/XDG_CACHE_HOME/XDG_RUNTIME_DIR resolve under the test dir. Everything else (all MCPX_, XDG_, OPENCODE_, proxies, NODE_OPTIONS, credentials) is dropped. Unit tests are in childenv_test.go.
  • pkgs/mcpx/internal/e2e/e2e_test.go: newEnv builds on ChildEnv (replaces withoutMCPXVars); new TestMain backstop fails fast if MCPX_DAEMON_ENDPOINT/MCPX_SOCKET would reach a child and fails if the caller's real daemon set (info records in the parent-resolved state dir) differs at suite end.
  • pkgs/mcpx/internal/e2e/envguard_test.go (new): registry-derived guard -- every settings EnvName()/EnvAliases entry (231 names) is classified harness-set (52) or safe-under-inherit-nothing (179); the behavior test plants canaries for every name plus XDG/OPENCODE/proxy/NODE_OPTIONS/HOME and checks isolation; hostile-parent doctor/settings/recipes regression test.

Verification status

  • gofmt and git diff --check: pass. No Go build/test was run locally (task requires CI verification only).
  • The PR's only GitHub check is basic: production line limit (2500) (pass); it does not test Go.
  • The mcpx test and mcpx workflows are disabled_manually. Manual dispatch of mcpx-test.yml on this branch was rejected by GitHub (HTTP 422, workflow disabled), so the e2e and go test ./... CI evidence, and empirical guard fail-on-main/pass-on-fix evidence, are still blocked. Do not close mcpx testing: e2e inherits the caller's environment -- build it from an allowlist so tests never reach the user's daemon #1992 until an enabled Actions path runs and its result is recorded here.

…in backstop (#1992)

Replace the inherit-minus-MCPX_* harness environment with a true
allowlist builder in internal/testsupport (ChildEnv): the parent
contributes PATH, TMPDIR, LANG/LC_*, TERM, SYSTEMROOT and the
runtime-cache passthroughs only; XDG_* resolve under the test dir and
everything else -- MCPX_*, XDG_*, OPENCODE_*, proxies, NODE_OPTIONS --
is dropped. newEnv builds on it.

Add the registry-derived guard: every settings EnvName()/EnvAliases
entry is classified as harness-set or safe-under-inherit-nothing, with
a behaviour half proving the drop for each one, plus the
hostile-parent doctor/settings/recipes regression test.

Add the TestMain backstop: fail fast if MCPX_DAEMON_ENDPOINT or
MCPX_SOCKET would reach a child, and fail if the caller's real daemon
set differs at suite end.
@dezren39
dezren39 requested a review from a team as a code owner November 3, 2026 08:34
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 19d865bc-b501-4489-84f7-09b2ca5907c4
Commits

Reviewing files that changed from the base of the PR and between f0fd3dd and 181ee47.

Files selected for processing: 4
  • pkgs/mcpx/internal/e2e/e2e_test.go
  • pkgs/mcpx/internal/e2e/envguard_test.go
  • pkgs/mcpx/internal/testsupport/childenv.go
  • pkgs/mcpx/internal/testsupport/childenv_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-03T08:34:27.423428Z
We couldn’t complete this review. Comment @codex review to try again.
63432a4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

This branch has not been deployed

No deployments
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.

mcpx testing: e2e inherits the caller's environment -- build it from an allowlist so tests never reach the user's daemon

1 participant