Skip to content

Commit

Permalink
fix: disable app sandbox when --no-sandbox is present (#184897)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 committed Jun 12, 2023
1 parent b380da4 commit dd8ab49
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main.js
Expand Up @@ -27,8 +27,11 @@ const { getUNCHost, addUNCHostToAllowlist } = require('./vs/base/node/unc');
const product = require('../product.json');
const { app, protocol, crashReporter, Menu } = require('electron');

// Enable sandbox globally
app.enableSandbox();
// Enable sandbox globally unless disabled via `--no-sandbox` argument
const args = parseCLIArgs();
if (args['sandbox']) {
app.enableSandbox();
}

// Enable portable support
const portable = bootstrapNode.configurePortable(product);
Expand All @@ -37,7 +40,6 @@ const portable = bootstrapNode.configurePortable(product);
bootstrap.enableASARSupport();

// Set userData path before app 'ready' event
const args = parseCLIArgs();
const userDataPath = getUserDataPath(args, product.nameShort ?? 'code-oss-dev');
if (process.platform === 'win32') {
const userDataUNCHost = getUNCHost(userDataPath);
Expand Down Expand Up @@ -464,7 +466,13 @@ function parseCLIArgs() {
'locale',
'js-flags',
'crash-reporter-directory'
]
],
default: {
'sandbox': true
},
alias: {
'no-sandbox': 'sandbox'
}
});
}

Expand Down

0 comments on commit dd8ab49

Please sign in to comment.