mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-12 05:02:31 +00:00
Add untrusted connection security infrastructure (v3)
Replace the v2 blacklist approach with a per-command flag system. Commands must opt in to being available for untrusted connections via flag_untrusted_safe (0x400), checked in call_command() which catches all execution paths including nested commands. Infrastructure changes: - Add flag_untrusted_safe to CommandMap - Add untrusted_error exception type for proper error codes - Enforce trust check in both call_command() overloads - Add catch blocks in xmlrpc_c, xmlrpc_tinyxml2, and jsonrpc handlers - Port SCGI trust state management from v2 (thread_local, header parsing) - Add _U macro variants in command_helpers.h for safe command registration - Add CMD2_VAR_*_U and CMD2_VAR_*_U_GET variants for variables
This commit is contained in:
+6
-3
@@ -133,9 +133,12 @@ jsonrpc_call_command(const std::string& method, const json& params) {
|
||||
|
||||
params_object_list.erase(params_object_list.begin());
|
||||
|
||||
const auto& result = rpc::commands.call_command(itr, params_object, target);
|
||||
|
||||
return object_to_json(result);
|
||||
try {
|
||||
const auto& result = rpc::commands.call_command(itr, params_object, target);
|
||||
return object_to_json(result);
|
||||
} catch (untrusted_error& e) {
|
||||
throw rpc_error(JSONRPC_METHOD_NOT_FOUND_ERROR, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
json
|
||||
|
||||
Reference in New Issue
Block a user