Bug 1259601: Add content process sandbox level to about:support sandboxing information. r=jld, r=mossop

MozReview-Commit-ID: HFRiEbkEztp
This commit is contained in:
Bob Owen 2016-08-16 07:40:43 +01:00
parent 780f93ea66
commit 1bf3aae304
6 changed files with 37 additions and 16 deletions

View File

@ -560,7 +560,7 @@ var snapshotFormatters = {
},
sandbox: function sandbox(data) {
if (AppConstants.platform != "linux" || !AppConstants.MOZ_SANDBOX)
if (!AppConstants.MOZ_SANDBOX)
return;
let strings = stringBundle();

View File

@ -535,7 +535,7 @@
</table>
<!-- - - - - - - - - - - - - - - - - - - - - -->
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
#if defined(MOZ_SANDBOX)
<h2 class="major-section" id="sandbox">
&aboutSupport.sandboxTitle;
</h2>

View File

@ -96,6 +96,7 @@ hasUserNamespaces = User Namespaces
hasPrivilegedUserNamespaces = User Namespaces for privileged processes
canSandboxContent = Content Process Sandboxing
canSandboxMedia = Media Plugin Sandboxing
contentSandboxLevel = Content Process Sandbox Level
# LOCALIZATION NOTE %1$S and %2$S will be replaced with the number of remote and the total number
# of windows, respectively, while %3$S will be replaced with one of the status strings below,

View File

@ -88,6 +88,13 @@ this.AppConstants = Object.freeze({
false,
#endif
MOZ_CONTENT_SANDBOX:
#ifdef MOZ_CONTENT_SANDBOX
true,
#else
false,
#endif
MOZ_TELEMETRY_REPORTING:
#ifdef MOZ_TELEMETRY_REPORTING
true,

View File

@ -560,20 +560,28 @@ if (AppConstants.MOZ_CRASHREPORTER) {
}
}
if (AppConstants.platform == "linux" && AppConstants.MOZ_SANDBOX) {
if (AppConstants.MOZ_SANDBOX) {
dataProviders.sandbox = function sandbox(done) {
const keys = ["hasSeccompBPF", "hasSeccompTSync",
"hasPrivilegedUserNamespaces", "hasUserNamespaces",
"canSandboxContent", "canSandboxMedia"];
let sysInfo = Cc["@mozilla.org/system-info;1"].
getService(Ci.nsIPropertyBag2);
let data = {};
for (let key of keys) {
if (sysInfo.hasKey(key)) {
data[key] = sysInfo.getPropertyAsBool(key);
if (AppConstants.platform == "linux") {
const keys = ["hasSeccompBPF", "hasSeccompTSync",
"hasPrivilegedUserNamespaces", "hasUserNamespaces",
"canSandboxContent", "canSandboxMedia"];
let sysInfo = Cc["@mozilla.org/system-info;1"].
getService(Ci.nsIPropertyBag2);
for (let key of keys) {
if (sysInfo.hasKey(key)) {
data[key] = sysInfo.getPropertyAsBool(key);
}
}
}
if (AppConstants.MOZ_CONTENT_SANDBOX) {
data.contentSandboxLevel =
Services.prefs.getIntPref("security.sandbox.content.level");
}
done(data);
}
}

View File

@ -6,6 +6,7 @@
// that aren't initialized outside of a XUL app environment like AddonManager
// and the "@mozilla.org/xre/app-info;1" component.
Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/Troubleshoot.jsm");
@ -439,19 +440,19 @@ const SNAPSHOT_SCHEMA = {
type: "object",
properties: {
hasSeccompBPF: {
required: true,
required: AppConstants.platform == "linux",
type: "boolean"
},
hasSeccompTSync: {
required: true,
required: AppConstants.platform == "linux",
type: "boolean"
},
hasUserNamespaces: {
required: true,
required: AppConstants.platform == "linux",
type: "boolean"
},
hasPrivilegedUserNamespaces: {
required: true,
required: AppConstants.platform == "linux",
type: "boolean"
},
canSandboxContent: {
@ -462,6 +463,10 @@ const SNAPSHOT_SCHEMA = {
required: false,
type: "boolean"
},
contentSandboxLevel: {
required: AppConstants.MOZ_CONTENT_SANDBOX,
type: "number"
},
},
},
},