fix: integrate hardened APT security boundary

This commit is contained in:
2026-08-19 21:36:24 +00:00
parent b6df6f1a66
commit 2f492b662d
14 changed files with 1113 additions and 1730 deletions
+22 -34
View File
@@ -1,38 +1,26 @@
'use strict';
const { contextBridge, ipcRenderer } = require('electron');
// Expose protected methods that allow the renderer process to use
// the ipcRenderer without exposing the entire object
contextBridge.exposeInMainWorld('electronAPI', {
getDevices: (params) => ipcRenderer.invoke('api-get-devices', params),
getDeviceSites: (params) => ipcRenderer.invoke('api-get-device-sites', params),
getAuthInfo: (params) => ipcRenderer.invoke('api-get-auth-info', params),
function onConnectionStateChanged(callback) {
if (typeof callback !== 'function') return () => {};
const listener = (_event, state) => callback(state);
ipcRenderer.on('connection-state-changed', listener);
return () => ipcRenderer.removeListener('connection-state-changed', listener);
}
// Camera proxy functionality
launchCookieCameraProxy: (params) => ipcRenderer.invoke('camera-proxy-cookie-launch', params),
stopCameraProxy: (processId) => ipcRenderer.invoke('camera-proxy-stop', { processId }),
// Extension cookie bridge (push from main process)
onExtensionCookie: (callback) => {
ipcRenderer.on('extension-cookie-received', (event, data) => {
try {
callback(data);
} catch (error) {
console.error('Extension cookie handler error:', error);
}
});
},
// Self-update functionality
contextBridge.exposeInMainWorld('electronAPI', Object.freeze({
getDevices: () => ipcRenderer.invoke('get-devices'),
getDeviceSites: () => ipcRenderer.invoke('get-device-sites'),
getAuthInfo: () => ipcRenderer.invoke('get-auth-info'),
launchProxy: (deviceId) => ipcRenderer.invoke('launch-proxy', deviceId),
stopProxy: (key) => ipcRenderer.invoke('stop-proxy', key),
disconnect: () => ipcRenderer.invoke('disconnect'),
getConnectionState: () => ipcRenderer.invoke('get-connection-state'),
checkForUpdates: () => ipcRenderer.invoke('check-for-updates'),
downloadAndInstallUpdate: (params) => ipcRenderer.invoke('download-and-install-update', params),
getCurrentVersion: () => ipcRenderer.invoke('get-current-version'),
onUpdateDownloadProgress: (callback) => {
ipcRenderer.on('update-download-progress', (event, data) => {
try {
callback(data);
} catch (error) {
console.error('Update download progress handler error:', error);
}
});
}
});
openFixedReleasesPage: () => ipcRenderer.invoke('open-fixed-releases-page'),
rotatePairing: () => ipcRenderer.invoke('rotate-pairing'),
revokePairing: () => ipcRenderer.invoke('revoke-pairing'),
getPairingStatus: () => ipcRenderer.invoke('get-pairing-status'),
onConnectionStateChanged,
}));