Split DANGEROUS_PATHS into two categories:
1. DANGEROUS_SYSTEM_PATHS: Block path AND all subdirectories
(e.g., /etc, /etc/passwd, /var/log/auth.log)
2. DANGEROUS_HOME_CONTAINERS: Block ONLY exact match
(e.g., /home is blocked but /home/user/project passes through)
This fixes the issue where /home/user/project was incorrectly blocked
by is_dangerous_path(). Subdirectory access control for home directories
is properly delegated to is_home_directory_root() in resolve_and_validate_path().
Addresses review feedback from @chatgpt-codex-connector about blocking
all home directory subpaths.
Replace string prefix matching with Path.is_relative_to() to correctly
handle Windows paths like "C:\" where trailing backslash caused double
separator issues (e.g., "C:\\" instead of "C:\").
Changes:
- Use Path.is_relative_to() for subdirectory detection (requires Python 3.9+)
- Add Windows path handling tests using PureWindowsPath
- Update test_utils.py to expect /etc/passwd to be blocked (security fix)
The is_dangerous_path() function only did exact string matching,
allowing attackers to bypass protection by accessing subdirectories:
- /etc was blocked but /etc/passwd was allowed
- C:\Windows was blocked but C:\Windows\System32\... was allowed
This minimal fix changes is_dangerous_path() to use PREFIX MATCHING:
- Now blocks dangerous directories AND all their subdirectories
- Paths like /etcbackup are still allowed (not under /etc)
- No changes to DANGEROUS_PATHS list
Security:
- Fixes CWE-22: Path Traversal vulnerability
- Reported by: Team off-course (K-Shield.Jr 15th)
Fixes#312Fixes#293
Problem: cleanup_providers() loops over dict.items(), so the loop
variable is a (ProviderType, ModelProvider) tuple and close() never runs.
Impact: Providers like DIAL keep httpx clients open, leaking sockets and
emitting unclosed-client warnings on shutdown.
Solution: Iterate registry._initialized_providers.values() so we close
real provider instances and release network resources.
Problem: pyproject excludes conf/cli_clients and clink prompts from the
wheel, so ClinkRegistry raises RegistryLoadError after pip install.
Impact: Clink integrations are entirely broken for packaged installs.
Solution: Add conf/cli_clients/*.json and systemprompts/clink/*.txt to
setuptools package-data so wheels ship required assets.
Fixes: pip install . will now include all clink configuration files