summaryrefslogtreecommitdiffstats
path: root/dom/plugins
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-05-04 09:09:10 +0200
committerGitHub <noreply@github.com>2018-05-04 09:09:10 +0200
commit4a2aeb152e48c44efa57c140660e99792f4dd350 (patch)
tree7b786de2b175122814a53232268b1147a8bd0bfb /dom/plugins
parent20532e13937ab5fc8efcb2bfc4c0070dace40cd1 (diff)
parentf265784e8cabaff17f4554cf2bd2c30217b6ec0f (diff)
downloadUXP-4a2aeb152e48c44efa57c140660e99792f4dd350.tar
UXP-4a2aeb152e48c44efa57c140660e99792f4dd350.tar.gz
UXP-4a2aeb152e48c44efa57c140660e99792f4dd350.tar.lz
UXP-4a2aeb152e48c44efa57c140660e99792f4dd350.tar.xz
UXP-4a2aeb152e48c44efa57c140660e99792f4dd350.zip
Merge pull request #323 from MoonchildProductions/nuke-sandbox
Nuke sandbox
Diffstat (limited to 'dom/plugins')
-rw-r--r--dom/plugins/base/nsPluginTags.cpp25
-rw-r--r--dom/plugins/base/nsPluginTags.h1
-rw-r--r--dom/plugins/ipc/PluginProcessChild.cpp10
-rw-r--r--dom/plugins/ipc/PluginProcessParent.cpp85
-rw-r--r--dom/plugins/ipc/moz.build6
5 files changed, 0 insertions, 127 deletions
diff --git a/dom/plugins/base/nsPluginTags.cpp b/dom/plugins/base/nsPluginTags.cpp
index ddc3968fd..a794c416c 100644
--- a/dom/plugins/base/nsPluginTags.cpp
+++ b/dom/plugins/base/nsPluginTags.cpp
@@ -248,7 +248,6 @@ nsPluginTag::nsPluginTag(nsPluginInfo* aPluginInfo,
aPluginInfo->fMimeDescriptionArray,
aPluginInfo->fExtensionArray,
aPluginInfo->fVariantCount);
- InitSandboxLevel();
EnsureMembersAreUTF8();
FixupVersion();
}
@@ -283,7 +282,6 @@ nsPluginTag::nsPluginTag(const char* aName,
{
InitMime(aMimeTypes, aMimeDescriptions, aExtensions,
static_cast<uint32_t>(aVariants));
- InitSandboxLevel();
if (!aArgsAreUTF8)
EnsureMembersAreUTF8();
FixupVersion();
@@ -424,29 +422,6 @@ void nsPluginTag::InitMime(const char* const* aMimeTypes,
}
}
-void
-nsPluginTag::InitSandboxLevel()
-{
-#if defined(XP_WIN) && defined(MOZ_SANDBOX)
- nsAutoCString sandboxPref("dom.ipc.plugins.sandbox-level.");
- sandboxPref.Append(GetNiceFileName());
- if (NS_FAILED(Preferences::GetInt(sandboxPref.get(), &mSandboxLevel))) {
- mSandboxLevel = Preferences::GetInt("dom.ipc.plugins.sandbox-level.default"
-);
- }
-
-#if defined(_AMD64_)
- // As level 2 is now the default NPAPI sandbox level for 64-bit flash, we
- // don't want to allow a lower setting unless this environment variable is
- // set. This should be changed if the firefox.js pref file is changed.
- if (mIsFlashPlugin &&
- !PR_GetEnv("MOZ_ALLOW_WEAKER_SANDBOX") && mSandboxLevel < 2) {
- mSandboxLevel = 2;
- }
-#endif
-#endif
-}
-
#if !defined(XP_WIN) && !defined(XP_MACOSX)
static nsresult ConvertToUTF8(nsIUnicodeDecoder *aUnicodeDecoder,
nsAFlatCString& aString)
diff --git a/dom/plugins/base/nsPluginTags.h b/dom/plugins/base/nsPluginTags.h
index f1f03169b..9686d7e7a 100644
--- a/dom/plugins/base/nsPluginTags.h
+++ b/dom/plugins/base/nsPluginTags.h
@@ -190,7 +190,6 @@ private:
const char* const* aMimeDescriptions,
const char* const* aExtensions,
uint32_t aVariantCount);
- void InitSandboxLevel();
nsresult EnsureMembersAreUTF8();
void FixupVersion();
diff --git a/dom/plugins/ipc/PluginProcessChild.cpp b/dom/plugins/ipc/PluginProcessChild.cpp
index eb698e8af..32bf06215 100644
--- a/dom/plugins/ipc/PluginProcessChild.cpp
+++ b/dom/plugins/ipc/PluginProcessChild.cpp
@@ -22,10 +22,6 @@ extern "C" CGError CGSSetDebugOptions(int options);
#ifdef XP_WIN
bool ShouldProtectPluginCurrentDirectory(char16ptr_t pluginFilePath);
-#if defined(MOZ_SANDBOX)
-#define TARGET_SANDBOX_EXPORTS
-#include "mozilla/sandboxTarget.h"
-#endif
#endif
using mozilla::ipc::IOThreadChild;
@@ -107,12 +103,6 @@ PluginProcessChild::Init()
pluginFilename = WideToUTF8(values[0]);
-#if defined(MOZ_SANDBOX)
- // This is probably the earliest we would want to start the sandbox.
- // As we attempt to tighten the sandbox, we may need to consider moving this
- // to later in the plugin initialization.
- mozilla::SandboxTarget::Instance()->StartSandbox();
-#endif
#else
# error Sorry
#endif
diff --git a/dom/plugins/ipc/PluginProcessParent.cpp b/dom/plugins/ipc/PluginProcessParent.cpp
index 2a73bce51..fb0e18246 100644
--- a/dom/plugins/ipc/PluginProcessParent.cpp
+++ b/dom/plugins/ipc/PluginProcessParent.cpp
@@ -14,10 +14,6 @@
#include "mozilla/Telemetry.h"
#include "nsThreadUtils.h"
-#if defined(XP_WIN) && defined(MOZ_SANDBOX)
-#include "nsDirectoryServiceDefs.h"
-#endif
-
using std::vector;
using std::string;
@@ -40,95 +36,14 @@ PluginProcessParent::~PluginProcessParent()
{
}
-#if defined(XP_WIN) && defined(MOZ_SANDBOX)
-static void
-AddSandboxAllowedFile(vector<std::wstring>& aAllowedFiles, nsIProperties* aDirSvc,
- const char* aDir, const nsAString& aSuffix = EmptyString())
-{
- nsCOMPtr<nsIFile> userDir;
- nsresult rv = aDirSvc->Get(aDir, NS_GET_IID(nsIFile), getter_AddRefs(userDir));
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return;
- }
-
- nsAutoString userDirPath;
- rv = userDir->GetPath(userDirPath);
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return;
- }
-
- if (!aSuffix.IsEmpty()) {
- userDirPath.Append(aSuffix);
- }
- aAllowedFiles.push_back(std::wstring(userDirPath.get()));
- return;
-}
-
-static void
-AddSandboxAllowedFiles(int32_t aSandboxLevel,
- vector<std::wstring>& aAllowedFilesRead,
- vector<std::wstring>& aAllowedFilesReadWrite,
- vector<std::wstring>& aAllowedDirectories)
-{
- if (aSandboxLevel < 2) {
- return;
- }
-
- nsresult rv;
- nsCOMPtr<nsIProperties> dirSvc =
- do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return;
- }
-
- // Higher than level 2 currently removes the users own rights.
- if (aSandboxLevel > 2) {
- AddSandboxAllowedFile(aAllowedFilesRead, dirSvc, NS_WIN_HOME_DIR);
- AddSandboxAllowedFile(aAllowedFilesRead, dirSvc, NS_WIN_HOME_DIR,
- NS_LITERAL_STRING("\\*"));
- }
-
- // Level 2 and above is now using low integrity, so we need to give write
- // access to the Flash directories.
- // This should be made Flash specific (Bug 1171396).
- AddSandboxAllowedFile(aAllowedFilesReadWrite, dirSvc, NS_WIN_APPDATA_DIR,
- NS_LITERAL_STRING("\\Macromedia\\Flash Player\\*"));
- AddSandboxAllowedFile(aAllowedFilesReadWrite, dirSvc, NS_WIN_LOCAL_APPDATA_DIR,
- NS_LITERAL_STRING("\\Macromedia\\Flash Player\\*"));
- AddSandboxAllowedFile(aAllowedFilesReadWrite, dirSvc, NS_WIN_APPDATA_DIR,
- NS_LITERAL_STRING("\\Adobe\\Flash Player\\*"));
-
- // Access also has to be given to create the parent directories as they may
- // not exist.
- AddSandboxAllowedFile(aAllowedDirectories, dirSvc, NS_WIN_APPDATA_DIR,
- NS_LITERAL_STRING("\\Macromedia"));
- AddSandboxAllowedFile(aAllowedDirectories, dirSvc, NS_WIN_APPDATA_DIR,
- NS_LITERAL_STRING("\\Macromedia\\Flash Player"));
- AddSandboxAllowedFile(aAllowedDirectories, dirSvc, NS_WIN_LOCAL_APPDATA_DIR,
- NS_LITERAL_STRING("\\Macromedia"));
- AddSandboxAllowedFile(aAllowedDirectories, dirSvc, NS_WIN_LOCAL_APPDATA_DIR,
- NS_LITERAL_STRING("\\Macromedia\\Flash Player"));
- AddSandboxAllowedFile(aAllowedDirectories, dirSvc, NS_WIN_APPDATA_DIR,
- NS_LITERAL_STRING("\\Adobe"));
- AddSandboxAllowedFile(aAllowedDirectories, dirSvc, NS_WIN_APPDATA_DIR,
- NS_LITERAL_STRING("\\Adobe\\Flash Player"));
-}
-#endif
-
bool
PluginProcessParent::Launch(mozilla::UniquePtr<LaunchCompleteTask> aLaunchCompleteTask,
int32_t aSandboxLevel)
{
-#if defined(XP_WIN) && defined(MOZ_SANDBOX)
- mSandboxLevel = aSandboxLevel;
- AddSandboxAllowedFiles(mSandboxLevel, mAllowedFilesRead,
- mAllowedFilesReadWrite, mAllowedDirectories);
-#else
if (aSandboxLevel != 0) {
MOZ_ASSERT(false,
"Can't enable an NPAPI process sandbox for platform/build.");
}
-#endif
ProcessArchitecture currentArchitecture = base::GetCurrentProcessArchitecture();
uint32_t containerArchitectures = GetSupportedArchitecturesForProcessType(GeckoProcessType_Plugin);
diff --git a/dom/plugins/ipc/moz.build b/dom/plugins/ipc/moz.build
index b569aeb4c..15ed6410d 100644
--- a/dom/plugins/ipc/moz.build
+++ b/dom/plugins/ipc/moz.build
@@ -125,12 +125,6 @@ LOCAL_INCLUDES += [
'/xpcom/base/',
]
-if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
- LOCAL_INCLUDES += [
- '/security/sandbox/chromium',
- '/security/sandbox/chromium-shim',
- ]
-
DEFINES['FORCE_PR_LOG'] = True
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gtk3':