mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
fix(security): prevent path traversal in memory content API
This commit is contained in:
@@ -1365,6 +1365,8 @@ class MemoryContentHandler:
|
||||
service = MemoryService(workspace_root)
|
||||
result = service.get_content(params.filename)
|
||||
return json.dumps({"status": "success", **result}, ensure_ascii=False)
|
||||
except ValueError:
|
||||
return json.dumps({"status": "error", "message": "invalid filename"})
|
||||
except FileNotFoundError:
|
||||
return json.dumps({"status": "error", "message": "file not found"})
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user