Skip to content

Commit

Permalink
sandbox - configure crash reporter with process type (#174927)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero authored Feb 21, 2023
1 parent 784bbda commit 4d252ac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
21 changes: 15 additions & 6 deletions src/bootstrap-fork.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,22 @@ function terminateWhenParentTerminates() {
function configureCrashReporter() {
const crashReporterSandboxedHint = process.env['VSCODE_CRASH_REPORTER_SANDBOXED_HINT'];
if (crashReporterSandboxedHint) {
try {
if (process['crashReporter'] && typeof process['crashReporter'].addExtraParameter === 'function' /* Electron only */) {
process['crashReporter'].addExtraParameter('_sandboxed', 'true');
}
} catch (error) {
console.error(error);
addCrashReporterParameter('_sandboxed', 'true');
}

const crashReporterProcessType = process.env['VSCODE_CRASH_REPORTER_PROCESS_TYPE'];
if (crashReporterProcessType) {
addCrashReporterParameter('processType', crashReporterProcessType);
}
}

function addCrashReporterParameter(key, value) {
try {
if (process['crashReporter'] && typeof process['crashReporter'].addExtraParameter === 'function' /* Electron only */) {
process['crashReporter'].addExtraParameter(key, value);
}
} catch (error) {
console.error(error);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,9 @@ export class UtilityProcess extends Disposable {
env['VSCODE_PARENT_PID'] = String(configuration.parentLifecycleBound);
}
if (isWindowSandboxed) {
env['VSCODE_CRASH_REPORTER_SANDBOXED_HINT'] = '1';
env['VSCODE_CRASH_REPORTER_SANDBOXED_HINT'] = '1'; // TODO@bpasero remove me once sandbox is final
}
env['VSCODE_CRASH_REPORTER_PROCESS_TYPE'] = configuration.type;

// Remove any environment variables that are not allowed
removeDangerousEnvVariables(env);
Expand Down

0 comments on commit 4d252ac

Please sign in to comment.