wip fixing regressions, removing hardcoded paths
This commit is contained in:
@@ -105,14 +105,24 @@ def _is_allowed(path: Path) -> bool:
|
||||
|
||||
CRITICAL: Blacklisted files (history) are NEVER allowed.
|
||||
"""
|
||||
# Blacklist check
|
||||
name = path.name.lower()
|
||||
if name in ("history.toml", "config.toml", "credentials.toml") or name.endswith("_history.toml"):
|
||||
return False
|
||||
from src.paths import get_config_path
|
||||
from src.ai_client import get_credentials_path
|
||||
|
||||
try:
|
||||
rp = path.resolve(strict=True)
|
||||
except (OSError, ValueError):
|
||||
rp = path.resolve()
|
||||
|
||||
# Blacklist check by resolved path
|
||||
if rp == get_config_path().resolve():
|
||||
return False
|
||||
if rp == get_credentials_path().resolve():
|
||||
return False
|
||||
|
||||
name = path.name.lower()
|
||||
if name == "history.toml" or name.endswith("_history.toml"):
|
||||
return False
|
||||
|
||||
if rp in _allowed_paths:
|
||||
return True
|
||||
# Allow current working directory and subpaths by default if no base_dirs
|
||||
|
||||
Reference in New Issue
Block a user