Skip to content

[Tech] Enable sandboxing for ipcRenderer Processes #1783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1d7a8ad
Refactored all ipcRenderer calls into preload script
BrettCleary Sep 3, 2022
a2f465f
preload script working, context isolation enabled
BrettCleary Sep 6, 2022
b98c4a7
Cleaning up code, adding comments documenting design decisions
BrettCleary Sep 7, 2022
91068c8
preload path in vite.config plugin, checks if legendary folder exists…
BrettCleary Sep 7, 2022
c9a4d41
Merge branch 'main' of github.com:Heroic-Games-Launcher/HeroicGamesLa…
flavioislima Sep 7, 2022
7c0049f
[Fix] Check if Legendary's `metadata` folder exists before trying to …
CommandMC Sep 7, 2022
335a88e
Merge branch 'beta' into enableSandboxing
BrettCleary Sep 7, 2022
66d7657
refactor ipcRenderer calls in Tools component
BrettCleary Sep 9, 2022
1cc2224
fixing yarn codecheck issues with window.api calls
BrettCleary Sep 12, 2022
e96e7b2
fixed type issues window api install and rm wine
BrettCleary Sep 12, 2022
d8bf7b8
Merge remote-tracking branch 'upstream/beta' into enableSandboxing
BrettCleary Sep 12, 2022
67f0319
changed frontend error call to logError, removed superfluous comments
BrettCleary Sep 12, 2022
e41bdcd
installParams type now used in library api, library will refresh inst…
BrettCleary Sep 15, 2022
c60b240
Merge branch 'beta' into enableSandboxing
BrettCleary Sep 15, 2022
2ddd9d0
cleaning up after resolving conflicts with beta
BrettCleary Sep 15, 2022
2d2e15b
removing multiple imports
BrettCleary Sep 15, 2022
4268d3a
fixing wine progress issue, rm isDefault
BrettCleary Sep 16, 2022
7d96511
renaming handleProgressOf to handleProgressOfWineManager
BrettCleary Sep 16, 2022
906edaa
wine manager download progress fixes
BrettCleary Sep 18, 2022
c069fbd
typing wine api methods
BrettCleary Sep 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/backend/api/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ export const handleSetGameStatus = (callback: any) => {
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// export const setGameStatusRemoveListener = (onGameStatusUpdate: any) => {
// ipcRenderer.removeListener('setGameStatus', onGameStatusUpdate)
// }
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const handleProgressOf = (version: string, callback: any) =>
ipcRenderer.on('progressOf' + version, callback)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const handleLaunchGame = (callback: any) =>
ipcRenderer.on('launchGame', callback)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
2 changes: 0 additions & 2 deletions src/backend/api/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export const authGOG = async (token: string) =>
export const logoutGOG = async () => ipcRenderer.invoke('logoutGOG')
export const checkGameUpdates = async () =>
ipcRenderer.invoke('checkGameUpdates')
export const refreshWineVersionInfo = async (fetch?: boolean) =>
ipcRenderer.invoke('refreshWineVersionInfo', fetch)
export const refreshLibrary = async (
fullRefresh?: boolean,
library?: Runner | 'all'
Expand Down
2 changes: 0 additions & 2 deletions src/backend/api/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ export const showErrorBox = async (args: [title: string, message: string]) =>
ipcRenderer.invoke('showErrorBox', args)

export const showLogFileInFolder = (args: {
isDefault: boolean
appName: string
defaultLast?: boolean
}) => ipcRenderer.send('showLogFileInFolder', args)
export const getLogContent = async (args: {
isDefault: boolean
appName: string
defaultLast?: boolean
}) => ipcRenderer.invoke('getLogContent', args)
6 changes: 6 additions & 0 deletions src/backend/api/wine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export const installWineVersion = async (release: WineVersionInfo) =>
ipcRenderer.invoke('installWineVersion', release)
export const removeWineVersion = async (release: WineVersionInfo) =>
ipcRenderer.invoke('removeWineVersion', release)
export const refreshWineVersionInfo = async (fetch?: boolean) =>
ipcRenderer.invoke('refreshWineVersionInfo', fetch)

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const handleProgressOfWinetricks = (onProgress: any) =>
Expand All @@ -29,3 +31,7 @@ export const handleProgressOfWinetricks = (onProgress: any) =>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const progressOfWinetricksRemoveListener = (onProgress: any) =>
ipcRenderer.removeListener('progressOfWinetricks', onProgress)

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const handleProgressOfWineManager = (version: string, callback: any) =>
ipcRenderer.on('progressOfWineManager' + version, callback)
5 changes: 4 additions & 1 deletion src/backend/wine/manager/ipc_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ ipcMain.handle('installWineVersion', async (e, release: WineVersionInfo) => {
abortControllers.set(release.version, abortController)

const onProgress = (state: State, progress?: ProgressInfo) => {
e.sender.send('progressOf' + release.version, { state, progress })
e.sender.send('progressOfWineManager' + release.version, {
state,
progress
})
}
const result = await installWineVersion(
release,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export default function LogSettings({ isDefault, appName }: LogSettingsProps) {
const getLogContent = () => {
window.api
.getLogContent({
isDefault,
appName: isDefault ? '' : appName,
defaultLast
})
Expand Down Expand Up @@ -103,7 +102,6 @@ export default function LogSettings({ isDefault, appName }: LogSettingsProps) {

function showLogFileInFolder() {
window.api.showLogFileInFolder({
isDefault,
appName: isDefault ? '' : appName,
defaultLast
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const WineItem = ({
}>({ state: 'idle', progress: { percentage: 0, avgSpeed: 0, eta: Infinity } })

if (version) {
window.api.handleProgressOf(
'progressOf' + version,
window.api.handleProgressOfWineManager(
version,
(
e: Electron.IpcRendererEvent,
progress: {
Expand Down