fix(security): anchor plugin file access on rust-side consent
This commit is contained in:
1 parent
5c8c7e0192
commit
3db93307d0
5 files changed
+247
-28
No files matched your search
@@ -5383,6 +5383,14 @@ export async function openPluginLocalFile(_pluginId: string, _path: string, _wri
|
||||
throw new Error("Plugin local file access is not available in the web backend");
|
||||
}
|
||||
|
||||
export async function pickPluginLocalFiles(_pluginId: string, _multiple: boolean): Promise<PluginLocalFileHandle[]> {
|
||||
throw new Error("Plugin local file access is not available in the web backend");
|
||||
}
|
||||
|
||||
export async function savePluginLocalFileAs(_pluginId: string, _defaultFileName: string): Promise<PluginLocalFileHandle | null> {
|
||||
throw new Error("Plugin local file access is not available in the web backend");
|
||||
}
|
||||
|
||||
export async function readPluginLocalFileChunk(_pluginId: string, _handleId: string, _offset: number, _length?: number): Promise<PluginLocalFileChunk> {
|
||||
throw new Error("Plugin local file access is not available in the web backend");
|
||||
}
|
||||
|
||||
@@ -2724,6 +2724,18 @@ export async function openPluginLocalFile(pluginId: string, path: string, write:
|
||||
return invoke("plugin_file_open", { pluginId, path, write });
|
||||
}
|
||||
|
||||
// The native open/save dialogs run on the Rust side: the host never passes
|
||||
// paths into the plugin-file registry, it only receives handles for what the
|
||||
// user picked. Only the OS drop flow still goes through openPluginLocalFile,
|
||||
// and the Rust command accepts exactly the paths its own drop pipeline granted.
|
||||
export async function pickPluginLocalFiles(pluginId: string, multiple: boolean): Promise<PluginLocalFileHandle[]> {
|
||||
return invoke("plugin_file_pick_files", { pluginId, multiple });
|
||||
}
|
||||
|
||||
export async function savePluginLocalFileAs(pluginId: string, defaultFileName: string): Promise<PluginLocalFileHandle | null> {
|
||||
return invoke("plugin_file_save_as", { pluginId, defaultFileName });
|
||||
}
|
||||
|
||||
export async function readPluginLocalFileChunk(pluginId: string, handleId: string, offset: number, length?: number): Promise<PluginLocalFileChunk> {
|
||||
return invoke("plugin_file_read", { pluginId, handleId, offset, length });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user