Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9a2bcc01a9a8b84bf10d7d994562ced6343c596c
https://github.com/WebKit/WebKit/commit/9a2bcc01a9a8b84bf10d7d994562ced6343c596c
Author: Basuke Suzuki <[email protected]>
Date: 2026-08-20 (Thu, 20 Aug 2026)
Changed paths:
M Source/WebKit/SourcesCocoa.txt
M Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
M Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h
A Source/WebKit/UIProcess/Cocoa/SecurityFlagsControllerCocoa.mm
M Source/WebKit/UIProcess/SecurityFlagsController.cpp
M Source/WebKit/UIProcess/SecurityFlagsController.h
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SecurityFlags.mm
Log Message:
-----------
[SecurityFlags] Allow disabling security flags locally through a user default
https://bugs.webkit.org/show_bug.cgi?id=322074
rdar://185262053
Reviewed by Chris Dumez.
There is no way to flip a security flag on a running build yet: the server-side
list delivery
does not exist, and the only entry point is a testing SPI that has to be called
from code. Add a
user default the UIProcess reads at startup, so someone who has built WebKit
can turn a flag off
without recompiling:
defaults write -g WebKitDebugDisabledSecurityFlags -array radar184485266
Read in the SecurityFlagsController constructor. Every path that launches a
privileged child
process reads the singleton, so the default always lands before the first
creation parameters,
and nothing has launched yet for the constructor to propagate to. Reading goes
through
NSUserDefaults like every other user default in the UIProcess; its search list
covers the
application domain and the global domain, so one key serves per-app and
device-wide testing. A
bare string is accepted as well as an array, because writing the default
without -array is the
easiest mistake to make.
The names are sticky: flagsWithNamesDisabled() unions them into every value the
controller
computes, so a flag named by the default stays disabled whatever list arrives
later, including
the future server list. setDisabledFlagsNamedForTesting() is the one exception.
Without it a
developer with the default set could not run the existing API tests, which
reset the flags
through the SPI and then assert they are enforced, and the carve-out only ever
leaves fewer
flags disabled. The sticky names are logged at construction, since a flag that
cannot be
enforced again at runtime is something someone will have to explain from a log
later.
Only read when ENGINEERING_BUILD is set, matching the SPI, so it does not exist
on a customer
build. QE reaches the same flags through the IDS Server Bag once that lands, so
this only has to
serve someone who has built WebKit.
Tests: SecurityFlagsUserDefaultTest.DisablesFlagAtStartup
SecurityFlagsUserDefaultTest.TestingSPIIgnoresTheUserDefault
SecurityFlagsUserDefaultTest is separate because SecurityFlagsTest's SetUp
calls the SPI, which
would clear the flag before the test body ran. Each API test runs in its own
process, so writing
the default in SetUp happens before anything constructs the controller.
* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/UIProcess/Cocoa/SecurityFlagsControllerCocoa.mm: Added.
(WebKit::SecurityFlagsController::platformPersistentlyDisabledFlagNames):
* Source/WebKit/UIProcess/SecurityFlagsController.h:
* Source/WebKit/UIProcess/SecurityFlagsController.cpp:
(WebKit::SecurityFlagsController::SecurityFlagsController):
(WebKit::SecurityFlagsController::flagsWithNamesDisabled):
(WebKit::SecurityFlagsController::setDisabledFlagsNamed):
(WebKit::SecurityFlagsController::setDisabledFlagsNamedForTesting):
(WebKit::SecurityFlagsController::apply):
(WebKit::SecurityFlagsController::platformPersistentlyDisabledFlagNames):
* Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(+[WKWebsiteDataStore _setDisabledSecurityFlagsForTesting:]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SecurityFlags.mm:
(TestWebKitAPI::TEST_F(SecurityFlagsUserDefaultTest, DisablesFlagAtStartup)):
(TestWebKitAPI::TEST_F(SecurityFlagsUserDefaultTest,
TestingSPIIgnoresTheUserDefault)):
Canonical link: https://commits.webkit.org/319525@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications