Skip to content

Test what dev-shell users of --inherit-env rely on (#101) - #124

Merged
cuihtlauac merged 1 commit into
mainfrom
test/inherit-env-user-coverage
Nov 29, 2026
Merged

cuihtlauac merged 1 commit into
mainfrom
test/inherit-env-user-coverage

Conversation

@cuihtlauac

Copy link
Copy Markdown
Member

The daemon side of --inherit-env is well tested. Four things a dev-shell user depends on (the setup reported in #101) were not, so a regression in any of them would ship without a failing test.

Tests added

  • sudo-proxy-mcp lets an unprivileged request to a remote host through. The delegate-to-Bash refusal moves into refuses_local_unprivileged (no behaviour change) and is unit-tested together with normalize_host. A remote host passes. localhost, user@localhost and 127.0.0.1 are refused.
  • execute(host=NAME) dials $XDG_RUNTIME_DIR/sudo-proxy-NAME.sock. A user's own ssh -R/-L tunnel must end at that path, so renaming it breaks them.
  • forward_agent with inheritance (tests/inherit.rs). An inheriting step gets the agent socket, plus the inherited PATH and variables. Inheritance never supplies SSH_AUTH_SOCK, even with --inherit-env='*'.
  • A chdir plan with inheritance (tests/inherit.rs). A tool found only on the inherited PATH runs in the plan's directory with the inherited variables. This is the request shape reported in Opt-in flag to run unprivileged commands with the daemon's environment and PATH #101.

Each test was checked against a deliberate break of the code it guards, and each break made its test fail:

  • dropping the agent socket when inheriting;
  • ignoring cwd when inheriting;
  • refusing every unprivileged request;
  • renaming the tunnel socket.

Doc fix

docs/usage.md gave /tmp/sudo-proxy-HOST.sock as the hand-made equivalent of --host, a path sudo-proxy-mcp never dials. It now gives $XDG_RUNTIME_DIR/sudo-proxy-HOST.sock, and the dev-shell section points there for ssh -R tunnels.

Checks

These pass locally:

  • cargo test --release --no-fail-fast. On the first run, the known flaky concurrency burst test failed; it passed on the rerun.
  • cargo clippy --all-targets -- -D warnings.
  • cargo fmt --check.
  • cargo build --no-default-features.

🤖 Generated with Claude Code

The daemon side of --inherit-env was covered; four things a dev-shell
user depends on were not, so a regression in any of them would ship
silently:

- sudo-proxy-mcp lets an unprivileged request to a remote host through
  (the delegate-to-Bash refusal is now a function, unit-tested);
- execute(host=NAME) dials $XDG_RUNTIME_DIR/sudo-proxy-NAME.sock, where
  a user's own ssh -R/-L tunnel must end;
- forward_agent still gives an inheriting step the agent socket, and
  inheritance never supplies one, even with '*';
- a chdir plan runs a tool from the inherited PATH in its directory.

Each test was checked against a mutation of the code it guards.

docs/usage.md gave /tmp/sudo-proxy-HOST.sock as the hand-made
equivalent of --host, which sudo-proxy-mcp never dials; it now gives
the real path, and the dev-shell section points there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Cuihtlauac ALVARADO <cuihtlauac@tarides.com>
@cuihtlauac
cuihtlauac merged commit be656fa into main Nov 29, 2026
16 checks passed
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