Skip to content

Commit 752b04c

Browse files
committed
rename property name and doc improvements
1 parent 4fd61f1 commit 752b04c

File tree

1 file changed

+36
-21
lines changed

1 file changed

+36
-21
lines changed
Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,60 @@
1-
EnhancedSecurityMode
1+
IsEnhancedSecurityModeEnabled
22
===
33

44
# Background
55

6-
Enhanced Security Mode (ESM) is a Microsoft Edge security feature that reduces the risk of memory-related vulnerabilities by disabling JavaScript Just-in-Time (JIT) compilation and enabling additional operating system protections.
6+
Enhanced Security Mode (ESM) is a Microsoft Edge security feature that reduces
7+
the risk of memory-related vulnerabilities by disabling JavaScript Just-in-Time
8+
(JIT) compilation and enabling additional operating system protections.
79

8-
In WebView2, ESM is off by default to avoid performance impact. Host applications can enable ESM for stricter security when rendering untrusted or sensitive content. While this improves security, it may reduce JavaScript performance.
10+
In WebView2, ESM is off by default to avoid performance impact. You can enable
11+
ESM for stricter security when rendering untrusted sites. While this improves
12+
security, it may reduce JavaScript performance.
913

1014
In Microsoft Edge, ESM offers two levels:
1115

12-
- Balanced – Enabled only for unfamiliar sites based on browser usage patterns.
13-
- Strict – Always enabled for all sites.
16+
- Balanced – Enhanced security is used for unfamiliar sites based on browser usage patterns.
17+
- Strict – Enhanced security is used for all sites.
1418

1519
![image](https://github.com/MicrosoftEdge/WebView2Feedback/assets/82386753/35977716-e46c-4257-82da-906b0c6f833e)
1620

17-
Unlike Edge browser, WebView2 does not support heuristic-based "Balanced" level. Only two options are available: Off and Strict.
21+
Unlike Microsoft Edge, WebView2 does not support the heuristic-based "Balanced"
22+
level; only Off and Strict are available.
1823

19-
Currently, ESM level can only be configured via the `--sdsm-state` browser flag([see for more details](https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/webview-features-flags?tabs=dotnetcsharp)) at environment creation, applying globally to all profiles. There is no flexibility to modify the level at runtime.
24+
Today, the ESM level in WebView2 can be set only at environment creation by using
25+
the `--sdsm-state` browser feature flag ([webview2 browser flag docs](https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/webview-features-flags?tabs=dotnetcsharp)).
26+
The setting applies globally to all profiles and cannot be changed at runtime.
2027

21-
This proposal introduces an API to enable or disable ESM and persist the configuration for a WebView2 profile within the user data folder.
28+
This proposal introduces an API to enable or disable ESM and persist the configuration
29+
for a WebView2 profile within the user data folder.
2230

23-
## CoreWebView2Profile.EnhancedSecurityMode
24-
Enables or disables Enhanced Security Mode (ESM) for all WebView2 instances sharing the same profile. This property value is persisted for a WebView2 profile in the user data folder. The default value is false.
31+
## CoreWebView2Profile.IsEnhancedSecurityModeEnabled
32+
Enables or disables Enhanced Security Mode (ESM) for all WebView2 instances
33+
sharing the same profile. This property value is persisted for a WebView2
34+
profile in the user data folder. The default value is false.
2535

26-
- true: ESM enabled in Strict level: disables JavaScript JIT and applies additional OS protections.
36+
- true: ESM enabled in Strict level: Enhanced security is used for all sites.
2737
- false: ESM level is Off.
2838

29-
Changes apply to future navigations; reload may be required. Enabling ESM improves security but can reduce JavaScript performance.
39+
> Changes apply to future navigations; reload may be required.
3040
3141
# Examples
3242

33-
## EnhancedSecurityMode
43+
## IsEnhancedSecurityModeEnabled
3444

3545
Enable Enhanced Security Mode for a profile.
3646

3747
```c#
3848
void EnableEnhancedSecurityMode()
3949
{
4050
var profile = webView2.CoreWebView2.Profile;
41-
profile.EnhancedSecurityMode = true;
42-
MessageBox.Show(this, "Enhanced security mode is enabled", "Enhanced Security Mode");
51+
if (!profile.IsEnhancedSecurityModeEnabled)
52+
{
53+
profile.IsEnhancedSecurityModeEnabled = true;
54+
MessageBox.Show(this,
55+
"Enhanced Security Mode (Strict) enabled for this profile. Reload pages to apply.",
56+
"Enhanced Security Mode");
57+
}
4358
}
4459
```
4560

@@ -57,9 +72,9 @@ void EnableEnhancedSecurityMode()
5772
auto profile12 = profile.try_query<ICoreWebView2Profile12>();
5873
if (profile12)
5974
{
60-
CHECK_FAILURE(profile12->put_EnhancedSecurityMode(TRUE));
61-
MessageBox(
62-
nullptr, L"Enhanced security mode is enabled",
75+
CHECK_FAILURE(profile12->put_IsEnhancedSecurityModeEnabled(TRUE));
76+
MessageBox(nullptr,
77+
L"Enhanced Security Mode (Strict) enabled. Reload pages to apply.",
6378
L"Enhanced Security Mode", MB_OK);
6479
}
6580
}
@@ -91,11 +106,11 @@ void EnableEnhancedSecurityMode()
91106
[uuid(d5b781db-0a75-5f9c-85b1-40fa814fcea7), object, pointer_default(unique)]
92107
interface ICoreWebView2Profile12 : IUnknown {
93108
/// Gets whether Enhanced Security Mode is enabled for this profile.
94-
[propget] HRESULT EnhancedSecurityMode([out, retval] BOOL* value);
109+
[propget] HRESULT IsEnhancedSecurityModeEnabled([out, retval] BOOL* value);
95110

96111
/// Enables or disables Enhanced Security Mode for this profile.
97112
/// See notes above for behavior and performance impact.
98-
[propput] HRESULT EnhancedSecurityMode([in] BOOL value);
113+
[propput] HRESULT IsEnhancedSecurityModeEnabled([in] BOOL value);
99114
}
100115
```
101116

@@ -108,7 +123,7 @@ namespace Microsoft.Web.WebView2.Core
108123
[interface_name("Microsoft.Web.WebView2.Core.ICoreWebView2Profile12")]
109124
{
110125
// ICoreWebView2Profile12 members
111-
Boolean EnhancedSecurityMode { get; set; };
126+
Boolean IsEnhancedSecurityModeEnabled { get; set; };
112127
}
113128
}
114129
}

0 commit comments

Comments
 (0)