Reduce script permissions to a single "run unrestricted" switch

Python scripts always run and follow the plugin permission checks; the switch in Preferences lets
them bypass the checks. Plugins call the tools and offer operations without a separate permission.
This commit is contained in:
SoftFever committed 2026-11-11 22:23:28 +08:00
1 parent 869d8a9b96
commit 636367d143
40 files changed
+288 -480

No files matched your search

+6
View File
@@ -27,6 +27,12 @@ bool PythonRunScope::owns_ui() const { return is_script_identity(m_identity); }
std::string PythonRunScope::ui_owner() const { return owns_ui() ? "script/" + std::to_string(m_id) : m_identity; }
void PythonRunScope::allow_folder_reads() const
{
if (is_script_identity(m_identity) && !m_file.empty())
PluginAuditManager::instance().add_scoped_allowed_root(m_file.parent_path(), /*allow_write=*/false);
}
nlohmann::json PythonRunScope::call_tool(const std::string& tool, const nlohmann::json& args)
{
ToolBridge* bridge = nullptr;