Skip to content

Commit a6c9e08

Browse files
GittyHarshaCopilot
andcommitted
Add SmartScreen as origin feature to TrustedOriginSetting spec
Add COREWEBVIEW2_ORIGIN_FEATURE_SMART_SCREEN enum with documentation describing per-origin SmartScreen reputation check configuration. Update C++, .NET examples and MIDL3 enum to include SmartScreen. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bdbf825 commit a6c9e08

1 file changed

Lines changed: 27 additions & 4 deletions

File tree

specs/TrustedOriginSetting.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ This specification introduces the following interfaces:
6262

6363
- AccentColor
6464
- EnhancedSecurityMode
65+
- SmartScreen
6566

6667
# Example
6768

@@ -88,10 +89,17 @@ void SetOriginFeatures()
8889
COREWEBVIEW2_ORIGIN_FEATURE_STATE_ENABLED,
8990
&enhancedSecuritySetting));
9091

92+
wil::com_ptr<ICoreWebView2StagingOriginFeatureSetting> smartScreenSetting;
93+
CHECK_FAILURE(stagingProfile3->CreateOriginFeatureSetting(
94+
COREWEBVIEW2_ORIGIN_FEATURE_SMART_SCREEN,
95+
COREWEBVIEW2_ORIGIN_FEATURE_STATE_DISABLED,
96+
&smartScreenSetting));
97+
9198
// Set features for origin patterns
9299
ICoreWebView2StagingOriginFeatureSetting* features[] = {
93100
accentColorSetting.get(),
94-
enhancedSecuritySetting.get()
101+
enhancedSecuritySetting.get(),
102+
smartScreenSetting.get()
95103
};
96104

97105
LPCWSTR origins[] = { L"https://*.contoso.com" };
@@ -154,6 +162,7 @@ public void SetOriginFeatures()
154162
{
155163
{ CoreWebView2OriginFeature.AccentColor, CoreWebView2OriginFeatureState.Enabled },
156164
{ CoreWebView2OriginFeature.EnhancedSecurityMode, CoreWebView2OriginFeatureState.Enabled },
165+
{ CoreWebView2OriginFeature.SmartScreen, CoreWebView2OriginFeatureState.Disabled },
157166
};
158167

159168
// Set features for origin patterns
@@ -203,9 +212,22 @@ typedef enum COREWEBVIEW2_ORIGIN_FEATURE {
203212
/// For more information about Enhanced Security Mode, see:
204213
/// https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/security
205214
COREWEBVIEW2_ORIGIN_FEATURE_ENHANCED_SECURITY_MODE,
215+
/// Specifies SmartScreen reputation check settings for the origin.
216+
/// SmartScreen protects users from phishing and malware by checking navigated
217+
/// URLs and downloaded files against a cloud-based reputation service.
218+
/// By default, SmartScreen is enabled for all origins. Setting this feature to
219+
/// `Disabled` for an origin will skip SmartScreen reputation checks for
220+
/// navigations and downloads from that origin, effectively allow-listing it.
221+
///
222+
/// This configuration operates within the scope of the global SmartScreen toggle
223+
/// controlled by `ICoreWebView2Settings8.IsReputationCheckingRequired`.
224+
/// When `IsReputationCheckingRequired` is `false` (SmartScreen globally
225+
/// disabled), the SmartScreen check is not active and this
226+
/// per-origin configuration has no effect. When `IsReputationCheckingRequired`
227+
/// is `true` (the default), this per-origin configuration controls whether
228+
/// individual origins are exempt from SmartScreen reputation checks.
229+
COREWEBVIEW2_ORIGIN_FEATURE_SMART_SCREEN,
206230
} COREWEBVIEW2_ORIGIN_FEATURE;
207-
208-
/// Specifies the state of the origin feature.
209231
[v1_enum]
210232
typedef enum COREWEBVIEW2_ORIGIN_FEATURE_STATE {
211233
/// Sets the enabled state of the origin feature.
@@ -234,7 +256,7 @@ interface ICoreWebView2StagingProfile3 : IUnknown {
234256
/// Configures one or more feature settings for the specified origins.
235257
///
236258
/// This method applies feature configurations—such as accent color support,
237-
/// or enhanced security mode—to origins. Origins
259+
/// enhanced security mode, or SmartScreen reputation checking—to origins. Origins
238260
/// may be provided as exact origin strings or as wildcard patterns.
239261
///
240262
/// The origin pattern can be an exact origin string or a wildcard pattern.
@@ -336,6 +358,7 @@ namespace Microsoft.Web.WebView2.Core
336358
{
337359
AccentColor = 0,
338360
EnhancedSecurityMode = 1,
361+
SmartScreen = 2,
339362
};
340363

341364
runtimeclass CoreWebView2OriginFeatureSetting

0 commit comments

Comments
 (0)