Skip to content
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

fix: crash in sandbox on linux when getting execPath #15701

Merged
merged 4 commits into from Nov 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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