Harden DB-GPT service endpoints - #3098
Conversation
Remove ROOT_PATH from the file download allowlist and resolve relative agent download paths under PILOT_PATH/tmp. Add the same user dependency used by adjacent agent endpoints.
Validate plugin hub repository URLs with urlparse and only allow https://github.com hosts. Add the user dependency to the agent hub update endpoint.
|
The following issues still need to be resolved: Issue 1: The file_client.py behavior change will break downstream callers. The original FileClient.read_file(file_key) directly opens any path, while the new code restricts it to the conv_uid upload directory — if a downstream caller passes an absolute path outside conv_uid, it will throw ValueError at runtime. All callers must be verified for compatibility. Issue 2: The auth module default behavior is unclear. When API_KEYS is empty, do _validate_api_key and _require_user still allow all requests? If not, existing deployments without API key configuration will fail all authentication. The default behavior must be documented and backward compatibility ensured. Issue 3: This PR contains 10 unrelated commits with an oversized impact scope. 16 files / 10 commits cover file downloads, hub URL validation, SQL comment stripping, knowledge base auth, PDF title matching, Prompt API Key, global API Key, datasource SQL parameterization, file path scoping, and SSE parsing — these changes have no correlation with each other, and the impact spans core/serve/app packages. If any single fix introduces a bug, it cannot be individually reverted. |
Summary
This PR applies defensive hardening across several DB-GPT service endpoints and helpers:
Validation
Notes
This public PR intentionally keeps the description high level. It does not include vulnerability reproduction details.