Skip to content

fix(env): safely quote ~/ subpaths in wrapped cd commands - #15394

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-ded575e1
Apr 24, 2026
Merged

fix(env): safely quote ~/ subpaths in wrapped cd commands#15394
teknium1 merged 1 commit into
mainfrom
hermes/hermes-ded575e1

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #15098 by @Yukipukii1 onto current main.

Summary

BaseEnvironment._wrap_command() left ~/... paths unquoted to preserve bash ~ expansion. Worked for bare ~, but ~/my repo emitted builtin cd ~/my repo || exit 126 — bash split it into two args and cd failed.

Changes

  • tools/environments/base.py: new _quote_cwd_for_cd() helper. Bare ~ kept as-is; ~/$HOME; ~/X$HOME/'X' (shlex-quoted suffix).
  • tests/tools/test_base_environment.py: regression coverage for ~/my repo and ~/.

Validation

scripts/run_tests.sh tests/tools/test_base_environment.py — 17/17 passing. Reproduced the bug on main, confirmed the fix works in real bash.

Closes #15098.

@teknium1
teknium1 merged commit fd10463 into main Apr 24, 2026
7 of 11 checks passed
@teknium1
teknium1 deleted the hermes/hermes-ded575e1 branch April 24, 2026 22:25
@github-actions

Copy link
Copy Markdown
Contributor

🚨 CRITICAL Supply Chain Risk Detected

This PR contains a pattern that has been used in real supply chain attacks. A maintainer must review the flagged code carefully before merging.

🚨 CRITICAL: Install-hook file added or modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py

Scanner only fires on high-signal indicators: .pth files, base64+exec/eval combos, subprocess with encoded commands, or install-hook files. Low-signal warnings were removed intentionally — if you're seeing this comment, the finding is worth inspecting.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ npm lockfile hash out of date

Checked against commit 2950ce7 (PR head at check time).

The hash = "sha256-..." line in these nix files no longer matches the committed package-lock.json:

Apply the fix

  • Apply lockfile fix — tick to push a commit with the correct hashes to this PR branch
  • Or run the Nix Lockfile Fix workflow manually (pass PR #15394)
  • Or locally: nix run .#fix-lockfiles -- --apply and commit the diff

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint labels Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants