2019-03-27 23:27:09 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_SandboxPolicyUtility_h
|
|
|
|
#define mozilla_SandboxPolicyUtility_h
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
static const char SandboxPolicyUtility[] = R"SANDBOX_LITERAL(
|
|
|
|
(version 1)
|
|
|
|
|
|
|
|
(define should-log (param "SHOULD_LOG"))
|
|
|
|
(define app-path (param "APP_PATH"))
|
2019-04-04 22:59:25 +03:00
|
|
|
(define crashPort (param "CRASH_PORT"))
|
2019-03-27 23:27:09 +03:00
|
|
|
|
|
|
|
(define (moz-deny feature)
|
|
|
|
(if (string=? should-log "TRUE")
|
|
|
|
(deny feature)
|
|
|
|
(deny feature (with no-log))))
|
|
|
|
|
|
|
|
(moz-deny default)
|
|
|
|
; These are not included in (deny default)
|
|
|
|
(moz-deny process-info*)
|
|
|
|
; This isn't available in some older macOS releases.
|
|
|
|
(if (defined? 'nvram*)
|
|
|
|
(moz-deny nvram*))
|
|
|
|
; This property requires macOS 10.10+
|
|
|
|
(if (defined? 'file-map-executable)
|
|
|
|
(moz-deny file-map-executable))
|
|
|
|
|
2019-07-24 17:48:41 +03:00
|
|
|
; Needed for things like getpriority()/setpriority()/pthread_setname()
|
|
|
|
(allow process-info-pidinfo process-info-setcontrol (target self))
|
|
|
|
|
2019-03-27 23:27:09 +03:00
|
|
|
(if (defined? 'file-map-executable)
|
|
|
|
(allow file-map-executable file-read*
|
2019-04-09 15:51:18 +03:00
|
|
|
(subpath "/System/Library")
|
2019-03-27 23:27:32 +03:00
|
|
|
(subpath "/usr/lib")
|
2019-03-27 23:27:09 +03:00
|
|
|
(subpath app-path))
|
|
|
|
(allow file-read*
|
2019-04-09 15:51:18 +03:00
|
|
|
(subpath "/System/Library")
|
2019-03-27 23:27:32 +03:00
|
|
|
(subpath "/usr/lib")
|
2019-03-27 23:27:09 +03:00
|
|
|
(subpath app-path)))
|
|
|
|
|
2019-04-04 22:59:25 +03:00
|
|
|
(if (string? crashPort)
|
|
|
|
(allow mach-lookup (global-name crashPort)))
|
|
|
|
|
2019-03-27 23:27:09 +03:00
|
|
|
(allow signal (target self))
|
|
|
|
(allow sysctl-read)
|
|
|
|
(allow file-read*
|
2019-03-27 23:27:32 +03:00
|
|
|
(literal "/dev/random")
|
|
|
|
(literal "/dev/urandom")
|
|
|
|
(subpath "/usr/share/icu"))
|
|
|
|
|
|
|
|
(allow mach-lookup
|
|
|
|
(global-name "com.apple.coreservices.launchservicesd"))
|
2019-03-27 23:27:09 +03:00
|
|
|
)SANDBOX_LITERAL";
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_SandboxPolicyUtility_h
|