From 59f2b228f7a04dcca46bb4d7016833936362592b Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sun, 29 Mar 2026 18:02:11 -0700 Subject: [PATCH] fix(paths): respect HERMES_HOME for protected .env write-deny path (#3840) The write-deny list in file_operations.py hardcoded ~/.hermes/.env, which misses the actual .env in custom HERMES_HOME or profile setups. Use get_hermes_home() for profile-safe path resolution. Salvaged from PR #3232 by @erhnysr. Co-authored-by: Erhnysr --- tools/file_operations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/file_operations.py b/tools/file_operations.py index ebd4d601d..96bdc2d53 100644 --- a/tools/file_operations.py +++ b/tools/file_operations.py @@ -32,6 +32,7 @@ from abc import ABC, abstractmethod from dataclasses import dataclass, field from typing import Optional, List, Dict, Any from pathlib import Path +from hermes_constants import get_hermes_home # --------------------------------------------------------------------------- @@ -46,7 +47,7 @@ WRITE_DENIED_PATHS = { os.path.join(_HOME, ".ssh", "id_rsa"), os.path.join(_HOME, ".ssh", "id_ed25519"), os.path.join(_HOME, ".ssh", "config"), - os.path.join(_HOME, ".hermes", ".env"), + str(get_hermes_home() / ".env"), os.path.join(_HOME, ".bashrc"), os.path.join(_HOME, ".zshrc"), os.path.join(_HOME, ".profile"),