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 session storage via session_id sanitization
The session_dir() function was vulnerable to path traversal attacks
where a malicious session_id like '../../../etc/passwd' could escape
the sessions directory and access arbitrary files.
Changes:
- Add sanitize_session_id() function that replaces dangerous characters
- Add validate_session_id() 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 sessions directory.
Fixes: issue #5404
0 commit comments