security: fix token exposure, info disclosure, and path validation vulnerabilities #203
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Security audit and fixes for multiple vulnerabilities in the Strix runtime and tool server components.
Security Fixes
1. Token Exposure Prevention (CWE-214)
The tool server previously accepted authentication tokens via
--tokenCLI argument, which exposed tokens in process listings (ps aux).Fix: Token is now read from
TOOL_SERVER_TOKENenvironment variable. CLI argument remains as fallback but env var takes precedence.2. Health Endpoint Information Disclosure (CWE-200)
The
/healthendpoint exposed internal state including active agent IDs and count without authentication.Fix:
/healthnow returns only{"status": "healthy"}(for load balancer probes)/health/detailedendpoint requires Bearer token authentication3. Path Traversal Prevention (CWE-22)
_copy_local_directory_to_container()followed symlinks, enabling potential directory traversal attacks.Fix:
_validate_path_safety()to detect symlink escape attempts4. Port Allocation Race Condition (CWE-367)
_find_available_port()was vulnerable to TOCTOU race conditions.Fix: Added retry logic with
SO_REUSEADDRsocket option.5. TLS Verification Configuration
verify=Falsewas hardcoded with no documentation.Fix:
STRIX_VERIFY_TLSenvironment variablefalse(required for proxy interception in pen testing)Testing
tests/runtime/test_security.pyChecklist