Skip to content

Commit

Permalink
fix: crash in sandbox on linux when getting execPath (#15701)
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Nov 15, 2018
1 parent c8860d0 commit 0642be2
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 12 deletions.
8 changes: 0 additions & 8 deletions atom/renderer/atom_sandboxed_renderer_client.cc
Expand Up @@ -80,12 +80,6 @@ v8::Local<v8::Value> GetBinding(v8::Isolate* isolate,
return exports;
}

base::FilePath::StringType GetExecPath() {
base::FilePath path;
base::PathService::Get(base::FILE_EXE, &path);
return path.value();
}

v8::Local<v8::Value> CreatePreloadScript(v8::Isolate* isolate,
v8::Local<v8::String> preloadSrc) {
auto script = v8::Script::Compile(preloadSrc);
Expand Down Expand Up @@ -157,9 +151,7 @@ void AtomSandboxedRendererClient::InitializeBindings(
process.SetMethod("getIOCounters", &AtomBindings::GetIOCounters);

process.Set("argv", base::CommandLine::ForCurrentProcess()->argv());
process.Set("execPath", GetExecPath());
process.SetReadOnly("pid", base::GetCurrentProcId());
process.Set("resourcesPath", NodeBindings::GetHelperResourcesPath());
process.SetReadOnly("sandboxed", true);
process.SetReadOnly("type", "renderer");

Expand Down
1 change: 0 additions & 1 deletion docs/api/process.md
Expand Up @@ -23,7 +23,6 @@ In sandboxed renderers the `process` object contains only a subset of the APIs:
- `pid`
- `arch`
- `platform`
- `resourcesPath`
- `sandboxed`
- `type`
- `version`
Expand Down
3 changes: 2 additions & 1 deletion lib/browser/rpc-server.js
Expand Up @@ -540,7 +540,8 @@ ipcMain.on('ELECTRON_BROWSER_SANDBOX_LOAD', function (event) {
platform: process.platform,
env: process.env,
version: process.version,
versions: process.versions
versions: process.versions,
execPath: process.helperExecPath
}
}
})
1 change: 0 additions & 1 deletion spec/api-browser-window-spec.js
Expand Up @@ -1830,7 +1830,6 @@ describe('BrowserWindow module', () => {
assert.strictEqual(test.platform, remote.process.platform)
assert.deepStrictEqual(...resolveGetters(test.env, remote.process.env))
assert.strictEqual(test.execPath, remote.process.helperExecPath)
assert.strictEqual(test.resourcesPath, remote.process.resourcesPath)
assert.strictEqual(test.sandboxed, true)
assert.strictEqual(test.type, 'renderer')
assert.strictEqual(test.version, remote.process.version)
Expand Down
1 change: 0 additions & 1 deletion spec/fixtures/module/preload-sandbox.js
Expand Up @@ -14,7 +14,6 @@
pid: process.pid,
arch: process.arch,
platform: process.platform,
resourcesPath: process.resourcesPath,
sandboxed: process.sandboxed,
type: process.type,
version: process.version,
Expand Down

0 comments on commit 0642be2

Please sign in to comment.