[iOS] Deny mach lookup access to content filter service in the WebContent sandbox
[WebKit.git] / Source / WebKit / Shared / WebProcessCreationParameters.h
1 /*
2  * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #pragma once
27
28 #include "CacheModel.h"
29 #include "SandboxExtension.h"
30 #include "TextCheckerState.h"
31 #include "UserData.h"
32 #include "WebProcessDataStoreParameters.h"
33 #include <wtf/HashMap.h>
34 #include <wtf/ProcessID.h>
35 #include <wtf/RetainPtr.h>
36 #include <wtf/Vector.h>
37 #include <wtf/text/StringHash.h>
38 #include <wtf/text/WTFString.h>
39
40 #if PLATFORM(COCOA)
41 #include <wtf/MachSendRight.h>
42 #endif
43
44 #if PLATFORM(MAC)
45 #include <WebCore/PlatformScreen.h>
46 #include <WebCore/ScreenProperties.h>
47 #endif
48
49 #if USE(SOUP)
50 #include "HTTPCookieAcceptPolicy.h"
51 #include <WebCore/SoupNetworkProxySettings.h>
52 #endif
53
54 namespace API {
55 class Data;
56 }
57
58 namespace IPC {
59 class Decoder;
60 class Encoder;
61 }
62
63 namespace WebKit {
64
65 struct WebProcessCreationParameters {
66     WebProcessCreationParameters();
67     ~WebProcessCreationParameters();
68     WebProcessCreationParameters(WebProcessCreationParameters&&);
69     WebProcessCreationParameters& operator=(WebProcessCreationParameters&&);
70
71     void encode(IPC::Encoder&) const;
72     static bool decode(IPC::Decoder&, WebProcessCreationParameters&);
73
74     String injectedBundlePath;
75     SandboxExtension::Handle injectedBundlePathExtensionHandle;
76     SandboxExtension::HandleArray additionalSandboxExtensionHandles;
77
78     UserData initializationUserData;
79
80 #if PLATFORM(IOS_FAMILY)
81     SandboxExtension::Handle cookieStorageDirectoryExtensionHandle;
82     SandboxExtension::Handle containerCachesDirectoryExtensionHandle;
83     SandboxExtension::Handle containerTemporaryDirectoryExtensionHandle;
84 #endif
85 #if ENABLE(MEDIA_STREAM)
86     SandboxExtension::Handle audioCaptureExtensionHandle;
87     bool shouldCaptureAudioInUIProcess { false };
88     bool shouldCaptureAudioInGPUProcess { false };
89     bool shouldCaptureVideoInUIProcess { false };
90     bool shouldCaptureDisplayInUIProcess { false };
91 #endif
92
93     String webCoreLoggingChannels;
94     String webKitLoggingChannels;
95
96     Vector<String> urlSchemesRegisteredAsEmptyDocument;
97     Vector<String> urlSchemesRegisteredAsSecure;
98     Vector<String> urlSchemesRegisteredAsBypassingContentSecurityPolicy;
99     Vector<String> urlSchemesForWhichDomainRelaxationIsForbidden;
100     Vector<String> urlSchemesRegisteredAsLocal;
101     Vector<String> urlSchemesRegisteredAsNoAccess;
102     Vector<String> urlSchemesRegisteredAsDisplayIsolated;
103     Vector<String> urlSchemesRegisteredAsCORSEnabled;
104     Vector<String> urlSchemesRegisteredAsAlwaysRevalidated;
105     Vector<String> urlSchemesRegisteredAsCachePartitioned;
106     Vector<String> urlSchemesServiceWorkersCanHandle;
107     Vector<String> urlSchemesRegisteredAsCanDisplayOnlyIfCanRequest;
108
109     Vector<String> fontWhitelist;
110     Vector<String> languages;
111 #if USE(GSTREAMER)
112     Vector<String> gstreamerOptions;
113 #endif
114
115     CacheModel cacheModel;
116
117     double defaultRequestTimeoutInterval { INT_MAX };
118     unsigned backForwardCacheCapacity { 0 };
119
120     bool shouldAlwaysUseComplexTextCodePath { false };
121     bool shouldEnableMemoryPressureReliefLogging { false };
122     bool shouldSuppressMemoryPressureHandler { false };
123     bool shouldUseFontSmoothing { true };
124     bool fullKeyboardAccessEnabled { false };
125     bool memoryCacheDisabled { false };
126     bool attrStyleEnabled { false };
127
128 #if ENABLE(SERVICE_CONTROLS)
129     bool hasImageServices { false };
130     bool hasSelectionServices { false };
131     bool hasRichContentServices { false };
132 #endif
133
134     Seconds terminationTimeout;
135
136     TextCheckerState textCheckerState;
137
138 #if PLATFORM(COCOA)
139     String uiProcessBundleIdentifier;
140     uint32_t uiProcessSDKVersion { 0 };
141 #endif
142
143     ProcessID presentingApplicationPID { 0 };
144
145 #if PLATFORM(COCOA)
146     WTF::MachSendRight acceleratedCompositingPort;
147
148     String uiProcessBundleResourcePath;
149     SandboxExtension::Handle uiProcessBundleResourcePathExtensionHandle;
150
151     bool shouldEnableJIT { false };
152     bool shouldEnableFTLJIT { false };
153     bool accessibilityEnhancedUserInterfaceEnabled { false };
154     
155     RefPtr<API::Data> bundleParameterData;
156 #endif // PLATFORM(COCOA)
157
158 #if ENABLE(NOTIFICATIONS)
159     HashMap<String, bool> notificationPermissions;
160 #endif
161
162     Vector<String> plugInAutoStartOrigins;
163
164 #if ENABLE(NETSCAPE_PLUGIN_API)
165     HashMap<String, HashMap<String, HashMap<String, uint8_t>>> pluginLoadClientPolicies;
166 #endif
167
168 #if PLATFORM(COCOA)
169     RetainPtr<CFDataRef> networkATSContext;
170 #endif
171
172 #if PLATFORM(WAYLAND)
173     String waylandCompositorDisplayName;
174 #endif
175
176 #if USE(SOUP)
177     WebCore::SoupNetworkProxySettings proxySettings;
178 #endif
179
180 #if PLATFORM(COCOA)
181     Vector<String> mediaMIMETypes;
182 #endif
183
184 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
185     bool shouldLogUserInteraction { false };
186 #endif
187
188 #if PLATFORM(MAC)
189     WebCore::ScreenProperties screenProperties;
190     bool useOverlayScrollbars { true };
191 #endif
192
193 #if USE(WPE_RENDERER)
194     bool isServiceWorkerProcess { false };
195     IPC::Attachment hostClientFileDescriptor;
196     CString implementationLibraryName;
197 #endif
198
199     Optional<WebProcessDataStoreParameters> websiteDataStoreParameters;
200     
201 #if PLATFORM(IOS)
202     Optional<SandboxExtension::Handle> compilerServiceExtensionHandle;
203     Optional<SandboxExtension::Handle> contentFilterExtensionHandle;
204 #endif
205
206 #if PLATFORM(COCOA)
207     Optional<SandboxExtension::Handle> neHelperExtensionHandle;
208     Optional<SandboxExtension::Handle> neSessionManagerExtensionHandle;
209 #endif
210 };
211
212 } // namespace WebKit