fix(security): scope managed path opening

This commit is contained in:
ZacharyZhang-NY committed 2026-05-15 00:26:20 -04:00
1 parent bde35c3518
commit 66e24b1060
9 files changed
+66 -30

No files matched your search

+6 -1
View File
@@ -135,7 +135,12 @@ export function useCompanyController() {
const openPathWithFeedback = useCallback(async (path: string) => {
const store = useAppStore.getState();
try { unwrap(await window.agentCompany.openPath(path)); store.setError(null); }
const companyId = store.snapshot?.currentCompanyId;
if (!companyId) {
store.setError("Select a company before opening a managed path.");
return;
}
try { unwrap(await window.agentCompany.openPath({ companyId, path })); store.setError(null); }
catch (err) { store.setError(describeDesktopError(err)); }
}, []);
@@ -159,12 +159,7 @@ export function OperationsSections({ section }: OperationsSectionsProps) {
}
}}
onOpenPath={async (path) => {
try {
unwrap(await window.agentCompany.openPath(path));
setError(null);
} catch (error) {
setError(describeDesktopError(error));
}
await openPathWithFeedback(path);
}}
onCancelAction={async (actionId) => {
if (!snapshot?.currentCompanyId) return;