Changeset 287276 in webkit
- Timestamp:
- Dec 20, 2021, 2:04:20 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r287275 r287276 1 2021-12-20 Alex Christensen <achristensen@webkit.org> 2 3 Prevent test functionality in AdAttributionDaemon when not running tests 4 https://bugs.webkit.org/show_bug.cgi?id=231258 5 <rdar://84168088> 6 7 Reviewed by Brady Eidson. 8 9 adattributiond already has a private entitlement check to make sure that only the network process has permission to connect to it. 10 This makes it so that the network process can't manipulate state only intended to be manipulated for tests when told to do so by 11 an application misusing SPI. 12 13 * NetworkProcess/NetworkProcess.cpp: 14 (WebKit::NetworkProcess::allowsPrivateClickMeasurementTestFunctionality const): 15 (WebKit::NetworkProcess::setPrivateClickMeasurementOverrideTimerForTesting): 16 (WebKit::NetworkProcess::simulateResourceLoadStatisticsSessionRestart): 17 (WebKit::NetworkProcess::markAttributedPrivateClickMeasurementsAsExpiredForTesting): 18 (WebKit::NetworkProcess::setPrivateClickMeasurementEphemeralMeasurementForTesting): 19 (WebKit::NetworkProcess::setPrivateClickMeasurementTokenPublicKeyURLForTesting): 20 (WebKit::NetworkProcess::setPrivateClickMeasurementTokenSignatureURLForTesting): 21 (WebKit::NetworkProcess::setPrivateClickMeasurementAttributionReportURLsForTesting): 22 (WebKit::NetworkProcess::markPrivateClickMeasurementsAsExpiredForTesting): 23 (WebKit::NetworkProcess::setPCMFraudPreventionValuesForTesting): 24 (WebKit::NetworkProcess::setPrivateClickMeasurementAppBundleIDForTesting): 25 * NetworkProcess/NetworkProcess.h: 26 1 27 2021-12-20 Alex Christensen <achristensen@webkit.org> 2 28 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r287229 r287276 105 105 #include "LaunchServicesDatabaseObserver.h" 106 106 #include "NetworkSessionCocoa.h" 107 #include <wtf/cocoa/Entitlements.h> 107 108 #endif 108 109 … … 2421 2422 } 2422 2423 2424 bool NetworkProcess::allowsPrivateClickMeasurementTestFunctionality() const 2425 { 2426 #if !PLATFORM(COCOA) || !USE(APPLE_INTERNAL_SDK) 2427 return true; 2428 #else 2429 auto auditToken = sourceApplicationAuditToken(); 2430 if (!auditToken) 2431 return false; 2432 return WTF::hasEntitlement(*auditToken, "com.apple.private.webkit.adattributiond.testing"); 2433 #endif 2434 } 2435 2423 2436 void NetworkProcess::setPrivateClickMeasurementOverrideTimerForTesting(PAL::SessionID sessionID, bool value, CompletionHandler<void()>&& completionHandler) 2424 2437 { 2438 if (!allowsPrivateClickMeasurementTestFunctionality()) 2439 return completionHandler(); 2440 2425 2441 if (auto* session = networkSession(sessionID)) 2426 2442 session->setPrivateClickMeasurementOverrideTimerForTesting(value); … … 2431 2447 void NetworkProcess::simulateResourceLoadStatisticsSessionRestart(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler) 2432 2448 { 2449 if (!allowsPrivateClickMeasurementTestFunctionality()) 2450 return completionHandler(); 2451 2433 2452 // FIXME: Rename this to simulatePrivateClickMeasurementSessionRestart. 2434 2453 if (auto* session = networkSession(sessionID)) { … … 2445 2464 void NetworkProcess::markAttributedPrivateClickMeasurementsAsExpiredForTesting(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler) 2446 2465 { 2466 if (!allowsPrivateClickMeasurementTestFunctionality()) 2467 return completionHandler(); 2468 2447 2469 if (auto* session = networkSession(sessionID)) { 2448 2470 session->markAttributedPrivateClickMeasurementsAsExpiredForTesting(WTFMove(completionHandler)); … … 2454 2476 void NetworkProcess::setPrivateClickMeasurementEphemeralMeasurementForTesting(PAL::SessionID sessionID, bool value, CompletionHandler<void()>&& completionHandler) 2455 2477 { 2478 if (!allowsPrivateClickMeasurementTestFunctionality()) 2479 return completionHandler(); 2480 2456 2481 if (auto* session = networkSession(sessionID)) 2457 2482 session->setPrivateClickMeasurementEphemeralMeasurementForTesting(value); … … 2463 2488 void NetworkProcess::setPrivateClickMeasurementTokenPublicKeyURLForTesting(PAL::SessionID sessionID, URL&& url, CompletionHandler<void()>&& completionHandler) 2464 2489 { 2490 if (!allowsPrivateClickMeasurementTestFunctionality()) 2491 return completionHandler(); 2492 2465 2493 if (auto* session = networkSession(sessionID)) 2466 2494 session->setPrivateClickMeasurementTokenPublicKeyURLForTesting(WTFMove(url)); … … 2471 2499 void NetworkProcess::setPrivateClickMeasurementTokenSignatureURLForTesting(PAL::SessionID sessionID, URL&& url, CompletionHandler<void()>&& completionHandler) 2472 2500 { 2501 if (!allowsPrivateClickMeasurementTestFunctionality()) 2502 return completionHandler(); 2503 2473 2504 if (auto* session = networkSession(sessionID)) 2474 2505 session->setPrivateClickMeasurementTokenSignatureURLForTesting(WTFMove(url)); … … 2479 2510 void NetworkProcess::setPrivateClickMeasurementAttributionReportURLsForTesting(PAL::SessionID sessionID, URL&& sourceURL, URL&& destinationURL, CompletionHandler<void()>&& completionHandler) 2480 2511 { 2512 if (!allowsPrivateClickMeasurementTestFunctionality()) 2513 return completionHandler(); 2514 2481 2515 if (auto* session = networkSession(sessionID)) 2482 2516 session->setPrivateClickMeasurementAttributionReportURLsForTesting(WTFMove(sourceURL), WTFMove(destinationURL)); … … 2487 2521 void NetworkProcess::markPrivateClickMeasurementsAsExpiredForTesting(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler) 2488 2522 { 2523 if (!allowsPrivateClickMeasurementTestFunctionality()) 2524 return completionHandler(); 2525 2489 2526 if (auto* session = networkSession(sessionID)) 2490 2527 session->markPrivateClickMeasurementsAsExpiredForTesting(); … … 2495 2532 void NetworkProcess::setPCMFraudPreventionValuesForTesting(PAL::SessionID sessionID, String&& unlinkableToken, String&& secretToken, String&& signature, String&& keyID, CompletionHandler<void()>&& completionHandler) 2496 2533 { 2534 if (!allowsPrivateClickMeasurementTestFunctionality()) 2535 return completionHandler(); 2536 2497 2537 if (auto* session = networkSession(sessionID)) 2498 2538 session->setPCMFraudPreventionValuesForTesting(WTFMove(unlinkableToken), WTFMove(secretToken), WTFMove(signature), WTFMove(keyID)); … … 2503 2543 void NetworkProcess::setPrivateClickMeasurementAppBundleIDForTesting(PAL::SessionID sessionID, String&& appBundleIDForTesting, CompletionHandler<void()>&& completionHandler) 2504 2544 { 2545 if (!allowsPrivateClickMeasurementTestFunctionality()) 2546 return completionHandler(); 2547 2505 2548 if (auto* session = networkSession(sessionID)) 2506 2549 session->setPrivateClickMeasurementAppBundleIDForTesting(WTFMove(appBundleIDForTesting)); -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r287229 r287276 314 314 void dumpPrivateClickMeasurement(PAL::SessionID, CompletionHandler<void(String)>&&); 315 315 void clearPrivateClickMeasurement(PAL::SessionID, CompletionHandler<void()>&&); 316 bool allowsPrivateClickMeasurementTestFunctionality() const; 316 317 void setPrivateClickMeasurementOverrideTimerForTesting(PAL::SessionID, bool value, CompletionHandler<void()>&&); 317 318 void markAttributedPrivateClickMeasurementsAsExpiredForTesting(PAL::SessionID, CompletionHandler<void()>&&); -
trunk/Tools/ChangeLog
r287275 r287276 1 2021-12-20 Alex Christensen <achristensen@webkit.org> 2 3 Prevent test functionality in AdAttributionDaemon when not running tests 4 https://bugs.webkit.org/show_bug.cgi?id=231258 5 6 Reviewed by Brady Eidson. 7 8 * TestWebKitAPI/Configurations/TestWebKitAPI-macOS-internal.entitlements: 9 * WebKitTestRunner/Configurations/WebKitTestRunner.entitlements: 10 1 11 2021-12-20 Alex Christensen <achristensen@webkit.org> 2 12 -
trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-iOS.entitlements
r286788 r287276 11 11 <key>com.apple.Pasteboard.paste-unchecked</key> 12 12 <true/> 13 <key>com.apple.private.webkit.adattributiond.testing</key> 14 <true/> 13 15 <key>com.apple.private.webkit.webpush</key> 14 16 <true/> -
trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-macOS-internal.entitlements
r287234 r287276 3 3 <plist version="1.0"> 4 4 <dict> 5 <key>com.apple.private.webkit.adattributiond.testing</key> 6 <true/> 5 7 <key>com.apple.private.webkit.webpush</key> 6 8 <true/> -
trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunner.entitlements
r270381 r287276 7 7 <string>com.apple.WebKitTestRunner</string> 8 8 </array> 9 <key>com.apple.private.webkit.adattributiond.testing</key> 10 <true/> 9 11 <key>com.apple.security.temporary-exception.sbpl</key> 10 12 <array> -
trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp-iOS.entitlements
r261972 r287276 11 11 <key>com.apple.Pasteboard.paste-unchecked</key> 12 12 <true/> 13 <key>com.apple.private.webkit.adattributiond.testing</key> 14 <true/> 13 15 </dict> 14 16 </plist>
Note:
See TracChangeset
for help on using the changeset viewer.