|
26 | 26 |
|
27 | 27 |
|
28 | 28 | (define (enhanced-security) |
29 | | - (require-any |
30 | | - (require-all |
31 | | - (require-not (require-entitlement "com.apple.security.cs.allow-jit")) |
32 | | - (require-not (require-entitlement "com.apple.private.verified-jit")) |
33 | | - (require-not (require-entitlement "com.apple.security.cs.single-jit")))) |
34 | | - (require-entitlement "com.apple.private.webkit.enhanced-security") |
35 | | - ) |
| 29 | + (equal? (param "WEBCONTENT_IS_ENHANCED_SECURITY") "YES")) |
36 | 30 |
|
37 | 31 | (define (lockdown-mode) |
38 | | - (require-all |
39 | | - (require-not (require-entitlement "com.apple.security.cs.allow-jit")) |
40 | | - (require-not (enhanced-security)))) |
| 32 | + (equal? (param "WEBCONTENT_IS_LOCKDOWN_MODE") "YES")) |
41 | 33 |
|
42 | 34 | #define FALSE #f |
43 | 35 |
|
|
51 | 43 |
|
52 | 44 | #if USE(SANDBOX_VERSION_3) |
53 | 45 | (allow dynamic-code-generation) |
54 | | -(with-filter (lockdown-mode) |
| 46 | +(when (lockdown-mode) |
55 | 47 | (deny dynamic-code-generation)) |
56 | | -(with-filter (enhanced-security) |
| 48 | +(when (enhanced-security) |
57 | 49 | (deny dynamic-code-generation)) |
58 | 50 |
|
59 | 51 | (with-filter (mac-policy-name "Sandbox") |
|
1117 | 1109 |
|
1118 | 1110 | ; Needed for [CAContext remoteContextWithOptions] |
1119 | 1111 | #if HAVE(SANDBOX_STATE_FLAGS) && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000 |
1120 | | -(with-filter |
1121 | | - (require-all |
1122 | | - (require-not (lockdown-mode)) |
| 1112 | +(when (not (lockdown-mode)) |
| 1113 | + (with-filter |
1123 | 1114 | (require-any |
1124 | 1115 | (require-not (state-flag "UnifiedPDFEnabled")) |
1125 | | - (require-not (state-flag "BlockIOKitInWebContentSandbox")))) |
1126 | | - (allow mach-lookup |
1127 | | - (require-all |
1128 | | - (extension "com.apple.webkit.extension.mach") |
1129 | | - (global-name "com.apple.CARenderServer")))) |
| 1116 | + (require-not (state-flag "BlockIOKitInWebContentSandbox"))) |
| 1117 | + (allow mach-lookup |
| 1118 | + (require-all |
| 1119 | + (extension "com.apple.webkit.extension.mach") |
| 1120 | + (global-name "com.apple.CARenderServer"))))) |
1130 | 1121 | #else |
1131 | 1122 | (allow mach-lookup (global-name "com.apple.CARenderServer")) |
1132 | 1123 | #endif |
|
1627 | 1618 | #endif |
1628 | 1619 | (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox")) |
1629 | 1620 | (allow syscall-unix (syscall-unix-downlevels))) |
1630 | | -(with-filter (require-all (require-not (lockdown-mode)) (require-not (state-flag "BlockIOKitInWebContentSandbox"))) |
1631 | | - (allow syscall-unix (syscall-unix-downlevels-blocked-in-lockdown-mode))) |
| 1621 | +(when (not (lockdown-mode)) |
| 1622 | + (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox")) |
| 1623 | + (allow syscall-unix (syscall-unix-downlevels-blocked-in-lockdown-mode)))) |
1632 | 1624 | #else |
1633 | 1625 | (allow syscall-unix |
1634 | 1626 | (syscall-unix-only-in-use-before-launch) |
|
1643 | 1635 |
|
1644 | 1636 | #if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED <= 140000 |
1645 | 1637 | (allow syscall-unix (syscall-unix-downlevels)) |
1646 | | -(with-filter (require-not (lockdown-mode)) |
| 1638 | +(when (not (lockdown-mode)) |
1647 | 1639 | (allow syscall-unix (syscall-unix-downlevels-blocked-in-lockdown-mode))) |
1648 | 1640 | #endif |
1649 | 1641 |
|
1650 | | -(with-filter (require-not (lockdown-mode)) |
| 1642 | +(when (not (lockdown-mode)) |
1651 | 1643 | (allow syscall-unix (syscall-unix-blocked-in-lockdown-mode)) |
1652 | 1644 | (when (equal? (param "CPU") "arm64") |
1653 | 1645 | (allow syscall-unix (syscall-unix-apple-silicon))) |
|
1666 | 1658 | (allow syscall-unix (syscall-number SYS_quotactl))) |
1667 | 1659 | #endif |
1668 | 1660 |
|
1669 | | -(with-filter (lockdown-mode) |
| 1661 | +(when (lockdown-mode) |
1670 | 1662 | (deny syscall-unix (with telemetry) (syscall-unix-blocked-in-lockdown-mode)) |
1671 | 1663 | (deny syscall-unix (with telemetry) (syscalls-rarely-used-blocked-in-lockdown-mode)) |
1672 | 1664 | (when (equal? (param "CPU") "arm64") |
|
1793 | 1785 |
|
1794 | 1786 | (when (defined? 'syscall-mig) |
1795 | 1787 | (deny syscall-mig) |
1796 | | - (with-filter (require-not (lockdown-mode)) |
| 1788 | + (when (not (lockdown-mode)) |
1797 | 1789 | (allow-mach-exceptions syscall-mig) |
1798 | 1790 | (allow syscall-mig (kernel-mig-routines-blocked-in-lockdown-mode))) |
1799 | | - (with-filter (lockdown-mode) |
| 1791 | + (when (lockdown-mode) |
1800 | 1792 | (deny syscall-mig (with telemetry) (kernel-mig-routines-blocked-in-lockdown-mode))) |
1801 | 1793 | (allow syscall-mig (kernel-mig-routines-in-use)) |
1802 | 1794 | #if HAVE(MACH_RANGE_CREATE) |
|
1810 | 1802 | (allow syscall-mig (kernel-mig-routines-iokit-service))) |
1811 | 1803 | (with-filter (state-flag "BlockIOKitInWebContentSandbox") |
1812 | 1804 | (deny syscall-mig (with no-report) (kernel-mig-routines-iokit-service))) |
1813 | | - (with-filter (require-all (require-not (lockdown-mode)) (require-not (state-flag "BlockIOKitInWebContentSandbox"))) |
1814 | | - (allow syscall-mig (kernel-mig-routines-downlevels-blocked-in-lockdown-mode)))) |
| 1805 | + (when (not (lockdown-mode)) |
| 1806 | + (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox")) |
| 1807 | + (allow syscall-mig (kernel-mig-routines-downlevels-blocked-in-lockdown-mode))))) |
1815 | 1808 |
|
1816 | 1809 | (if (and (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES") (and (defined? 'mach-kernel-endpoint) (not (defined? 'syscall-mig)))) |
1817 | 1810 | (allow mach-kernel-endpoint |
1818 | 1811 | (apply-message-filter |
1819 | 1812 | (deny mach-message-send) |
1820 | | - (with-filter (require-not (lockdown-mode)) |
| 1813 | + (when (not (lockdown-mode)) |
1821 | 1814 | (allow mach-message-send (kernel-mig-routines-blocked-in-lockdown-mode))) |
1822 | | - (with-filter (lockdown-mode) |
| 1815 | + (when (lockdown-mode) |
1823 | 1816 | (deny mach-message-send (with telemetry) (kernel-mig-routines-blocked-in-lockdown-mode))) |
1824 | | - (with-filter (require-not (lockdown-mode)) |
| 1817 | + (when (not (lockdown-mode)) |
1825 | 1818 | (allow-mach-exceptions mach-message-send)) |
1826 | 1819 |
|
1827 | 1820 | (allow mach-message-send (kernel-mig-routines-in-use)) |
1828 | 1821 | #if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED <= 140000 |
1829 | 1822 | (allow mach-message-send (kernel-mig-routines-downlevels)) |
1830 | | - (with-filter (require-not (lockdown-mode)) |
| 1823 | + (when (not (lockdown-mode)) |
1831 | 1824 | (allow mach-message-send (kernel-mig-routines-downlevels-blocked-in-lockdown-mode))) |
1832 | 1825 | #endif |
1833 | 1826 | #if HAVE(SANDBOX_STATE_FLAGS) |
|
1842 | 1835 | (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox")) |
1843 | 1836 | (allow mach-message-send (kernel-mig-routines-downlevels)) |
1844 | 1837 | (allow mach-message-send (kernel-mig-routines-iokit))) |
1845 | | - (with-filter (require-all (require-not (lockdown-mode)) (require-not (state-flag "BlockIOKitInWebContentSandbox"))) |
1846 | | - (allow mach-message-send (kernel-mig-routines-downlevels-blocked-in-lockdown-mode))) |
| 1838 | + (when (not (lockdown-mode)) |
| 1839 | + (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox")) |
| 1840 | + (allow mach-message-send (kernel-mig-routines-downlevels-blocked-in-lockdown-mode)))) |
1847 | 1841 | #else |
1848 | 1842 | (allow mach-message-send (kernel-mig-routines-iokit)) |
1849 | 1843 | (allow mach-message-send (kernel-mig-routines-iokit-service)) |
|
1910 | 1904 | #if HAVE(SANDBOX_STATE_FLAGS) |
1911 | 1905 | (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox")) |
1912 | 1906 | (allow syscall-mach (syscall-mach-downlevels))) |
1913 | | - (with-filter (require-all (require-not (lockdown-mode)) (require-not (state-flag "BlockIOKitInWebContentSandbox"))) |
1914 | | - (allow syscall-mach (syscall-mach-downlevels-blocked-in-lockdown-mode))) |
| 1907 | + (when (not (lockdown-mode)) |
| 1908 | + (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox")) |
| 1909 | + (allow syscall-mach (syscall-mach-downlevels-blocked-in-lockdown-mode)))) |
1915 | 1910 | #endif |
1916 | 1911 | #if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED <= 140000 |
1917 | 1912 | (allow syscall-mach (syscall-mach-downlevels)) |
1918 | | - (with-filter (require-not (lockdown-mode)) |
| 1913 | + (when (not (lockdown-mode)) |
1919 | 1914 | (allow syscall-mach (syscall-mach-downlevels-blocked-in-lockdown-mode))) |
1920 | 1915 | #endif |
1921 | | - (with-filter (require-not (lockdown-mode)) |
| 1916 | + (when (not (lockdown-mode)) |
1922 | 1917 | (allow syscall-mach (syscall-mach-blocked-in-lockdown-mode))) |
1923 | | - (with-filter (lockdown-mode) |
| 1918 | + (when (lockdown-mode) |
1924 | 1919 | (deny syscall-mach (with telemetry) (syscall-mach-blocked-in-lockdown-mode))) |
1925 | 1920 | (when (defined? 'MSC_mach_msg2_trap) |
1926 | 1921 | (allow syscall-mach (machtrap-number MSC_mach_msg2_trap)))) |
|
0 commit comments