fix: file system operation endpoints /ov/fs/ls and /... in app.py#647
Merged
qin-ctx merged 1 commit intovolcengine:mainfrom Mar 16, 2026
Merged
Conversation
File system operation endpoints /ov/fs/ls and /ov/fs/tree accept user-provided path parameters without sanitization or validation Resolves V-009
MaojiaSheng
approved these changes
Mar 16, 2026
MaojiaSheng
approved these changes
Mar 16, 2026
qin-ctx
reviewed
Mar 16, 2026
| return invalid | ||
| return await _forward_request(request, "/api/v1/fs/tree") | ||
|
|
||
| @router.get("/ov/fs/stat") |
Collaborator
There was a problem hiding this comment.
[Bug] Incomplete fix: /ov/fs/stat and /ov/content/read are also file system operation endpoints that accept user-provided path parameters, but they are not protected by _validate_fs_path. They are vulnerable to the same path traversal attack this PR aims to fix.
Suggested fix — apply the same validation pattern:
@router.get("/ov/fs/stat")
async def fs_stat(request: Request):
path = request.query_params.get("path", "")
invalid = _validate_fs_path(path)
if invalid:
return invalid
return await _forward_request(request, "/api/v1/fs/stat")
@router.get("/ov/content/read")
async def content_read(request: Request):
path = request.query_params.get("path", "")
invalid = _validate_fs_path(path)
if invalid:
return invalid
return await _forward_request(request, "/api/v1/content/read")| ) | ||
|
|
||
| # Check for parent directory traversal | ||
| if ".." in path_str: |
Collaborator
There was a problem hiding this comment.
[Suggestion] ".." in path_str is a substring check that will reject legitimate filenames containing .. as a substring (e.g., foo..bar). A more precise approach is to split the path into segments and check for exact .. components:
import re
parts = re.split(r'[/\\]', path_str)
if '..' in parts:
return _error_response(
status_code=400,
code="INVALID_PATH",
message="Path traversal sequences (..) are not allowed",
)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Fix high severity security issue in
openviking/console/app.py.Vulnerability
V-009openviking/console/app.py:173Description: File system operation endpoints /ov/fs/ls and /ov/fs/tree accept user-provided path parameters without sanitization or validation. The endpoints do not check for path traversal sequences (../, ., ...
Changes
openviking/console/app.pyVerification
Automated security fix by OrbisAI Security