Address review: tighten untrusted safelist and remove set_trusted

This commit is contained in:
Xirvik
2026-03-03 16:56:33 +00:00
committed by Jari Sundell
parent d935e0ffe9
commit 9f6731b4e2
4 changed files with 4 additions and 50 deletions
+4 -10
View File
@@ -21,13 +21,6 @@ ExecFile execFile;
// CommandMap::call_command(), which catches all command execution
// including nested calls through argument expansion.
bool
RpcManager::set_trusted(bool trusted) {
bool prev = m_trusted;
m_trusted = trusted;
return prev;
}
bool
RpcManager::is_trusted() const {
return m_trusted;
@@ -146,14 +139,15 @@ RpcManager::process(RPCType type, const char* in_buffer, uint32_t length, slot_r
bool
RpcManager::process_untrusted(RPCType type, const char* in_buffer, uint32_t length, slot_response_callback callback) {
bool previous = set_trusted(false);
bool previous = m_trusted;
m_trusted = false;
try {
bool result = process(type, in_buffer, length, callback);
set_trusted(previous);
m_trusted = previous;
return result;
} catch (...) {
set_trusted(previous);
m_trusted = previous;
throw;
}
}
-1
View File
@@ -83,7 +83,6 @@ public:
// Trusted/untrusted XMLRPC connection model.
// When an SCGI request includes the UNTRUSTED_CONNECTION header,
// commands without flag_untrusted_safe are blocked.
bool set_trusted(bool trusted);
bool is_trusted() const;
static void object_to_target(const torrent::Object& obj, int callFlags, rpc::target_type* target, std::function<void()>* deleter);