Skip to content

fix: file system operation endpoints /ov/fs/ls and /... in app.py#647

Merged
qin-ctx merged 1 commit intovolcengine:mainfrom
orbisai0security:fix-v009-path-traversal-fs-endpoints
Mar 16, 2026
Merged

fix: file system operation endpoints /ov/fs/ls and /... in app.py#647
qin-ctx merged 1 commit intovolcengine:mainfrom
orbisai0security:fix-v009-path-traversal-fs-endpoints

Conversation

@orbisai0security
Copy link
Copy Markdown
Contributor

Summary

Fix high severity security issue in openviking/console/app.py.

Vulnerability

Field Value
ID V-009
Severity HIGH
Scanner multi_agent_ai
Rule V-009
File openviking/console/app.py:173

Description: 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.py

Verification

  • Build passes
  • Scanner re-scan confirms fix
  • Code review passed

Automated security fix by OrbisAI Security

File system operation endpoints /ov/fs/ls and /ov/fs/tree accept user-provided path parameters without sanitization or validation
Resolves V-009
return invalid
return await _forward_request(request, "/api/v1/fs/tree")

@router.get("/ov/fs/stat")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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",
    )

@qin-ctx qin-ctx merged commit 58538c3 into volcengine:main Mar 16, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants