mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-16 08:14:32 +00:00
Validate configs on the existing-connection path; MCP policy fails closed
- Creating a tool from an existing connection validates its config too; the connection supplies the secrets the request leaves out. - When the connector policies cannot be read, the MCP test and save routes answer 503 instead of contacting the server.
This commit is contained in:
1 parent
473e8ec15c
commit
324d54ea67
5 files changed
+48
-8
No files matched your search
@@ -445,12 +445,14 @@ def _create_connected_tool(user, data, definition, tool_instance):
|
||||
config_requirements = tool_instance.get_config_requirements()
|
||||
public, secrets = connection_service.split_secrets(data.get("config") or {}, config_requirements)
|
||||
connection_id = data.get("connection_id")
|
||||
if not connection_id:
|
||||
validation_errors = _validate_config(data.get("config") or {}, config_requirements)
|
||||
if validation_errors:
|
||||
return make_response(
|
||||
jsonify({"success": False, "message": "Validation failed", "errors": validation_errors}), 400,
|
||||
)
|
||||
# An existing connection supplies the secrets the request leaves out.
|
||||
validation_errors = _validate_config(
|
||||
data.get("config") or {}, config_requirements, has_existing_secrets=bool(connection_id),
|
||||
)
|
||||
if validation_errors:
|
||||
return make_response(
|
||||
jsonify({"success": False, "message": "Validation failed", "errors": validation_errors}), 400,
|
||||
)
|
||||
try:
|
||||
with db_session() as conn:
|
||||
if connection_id:
|
||||
|
||||
Reference in new issue
Block a user