You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(tui): prevent path traversal in MCP storage via server name sanitization
The server_path() function was vulnerable to path traversal attacks
where a malicious server name like '../../../etc/passwd' could escape
the mcps directory and access arbitrary files.
Changes:
- Add sanitize_server_name() function that replaces dangerous characters
- Add validate_server_name() for pre-validation of untrusted input
- Only alphanumeric, hyphen, and underscore characters are allowed
- Path separators and other special chars are replaced with underscores
- Add comprehensive unit tests for path traversal prevention
Security Impact:
Prevents directory traversal attacks that could lead to unauthorized
file access or manipulation outside the MCP storage directory.
Fixes: issue #5403
0 commit comments