mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
Merge branch 'main' of github.com:NousResearch/hermes-agent into feat/ink-refactor
This commit is contained in:
commit
72aebfbb24
21 changed files with 376 additions and 49 deletions
|
|
@ -148,9 +148,10 @@ def _check_all_guards(command: str, env_type: str) -> dict:
|
|||
|
||||
|
||||
# Allowlist: characters that can legitimately appear in directory paths.
|
||||
# Covers alphanumeric, path separators, tilde, dot, hyphen, underscore, space,
|
||||
# plus, at, equals, and comma. Everything else is rejected.
|
||||
_WORKDIR_SAFE_RE = re.compile(r'^[A-Za-z0-9/_\-.~ +@=,]+$')
|
||||
# Covers alphanumeric, path separators, Windows drive/UNC separators, tilde,
|
||||
# dot, hyphen, underscore, space, plus, at, equals, and comma. Everything
|
||||
# else is rejected.
|
||||
_WORKDIR_SAFE_RE = re.compile(r'^[A-Za-z0-9/\\:_\-.~ +@=,]+$')
|
||||
|
||||
|
||||
def _validate_workdir(workdir: str) -> str | None:
|
||||
|
|
|
|||
|
|
@ -360,7 +360,21 @@ def _install_tirith(*, log_failures: bool = True) -> tuple[str | None, str]:
|
|||
|
||||
src = os.path.join(tmpdir, "tirith")
|
||||
dest = os.path.join(_hermes_bin_dir(), "tirith")
|
||||
shutil.move(src, dest)
|
||||
try:
|
||||
shutil.move(src, dest)
|
||||
except OSError:
|
||||
# Cross-device move (common in Docker, NFS): shutil.move() falls
|
||||
# back to copy2 + unlink, but copy2's metadata step can raise
|
||||
# PermissionError. Use plain copy + manual chmod instead.
|
||||
try:
|
||||
shutil.copy(src, dest)
|
||||
except OSError:
|
||||
# Clean up partial dest to prevent a non-executable retry loop
|
||||
try:
|
||||
os.unlink(dest)
|
||||
except OSError:
|
||||
pass
|
||||
return None, "cross_device_copy_failed"
|
||||
os.chmod(dest, os.stat(dest).st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
|
||||
|
||||
verification = "cosign + SHA-256" if cosign_verified else "SHA-256 only"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue