-
Notifications
You must be signed in to change notification settings - Fork 64
Add SmartScreen as origin feature to TrustedOriginSetting spec #5596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
GittyHarsha
wants to merge
3
commits into
main
Choose a base branch
from
user/harshanp/origin-settings-add-smartscreen
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+28
−2
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,7 @@ This specification introduces the following interfaces: | |
|
|
||
| - AccentColor | ||
| - EnhancedSecurityMode | ||
| - SmartScreen | ||
|
|
||
| # Example | ||
|
|
||
|
|
@@ -88,10 +89,17 @@ void SetOriginFeatures() | |
| COREWEBVIEW2_ORIGIN_FEATURE_STATE_ENABLED, | ||
| &enhancedSecuritySetting)); | ||
|
|
||
| wil::com_ptr<ICoreWebView2StagingOriginFeatureSetting> smartScreenSetting; | ||
| CHECK_FAILURE(stagingProfile3->CreateOriginFeatureSetting( | ||
| COREWEBVIEW2_ORIGIN_FEATURE_SMART_SCREEN, | ||
| COREWEBVIEW2_ORIGIN_FEATURE_STATE_DISABLED, | ||
| &smartScreenSetting)); | ||
|
|
||
| // Set features for origin patterns | ||
| ICoreWebView2StagingOriginFeatureSetting* features[] = { | ||
| accentColorSetting.get(), | ||
| enhancedSecuritySetting.get() | ||
| enhancedSecuritySetting.get(), | ||
| smartScreenSetting.get() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May as well leave the trailing comma on this line so the next update will be easier. |
||
| }; | ||
|
|
||
| LPCWSTR origins[] = { L"https://*.contoso.com" }; | ||
|
|
@@ -154,6 +162,7 @@ public void SetOriginFeatures() | |
| { | ||
| { CoreWebView2OriginFeature.AccentColor, CoreWebView2OriginFeatureState.Enabled }, | ||
| { CoreWebView2OriginFeature.EnhancedSecurityMode, CoreWebView2OriginFeatureState.Enabled }, | ||
| { CoreWebView2OriginFeature.SmartScreen, CoreWebView2OriginFeatureState.Disabled }, | ||
| }; | ||
|
|
||
| // Set features for origin patterns | ||
|
|
@@ -203,6 +212,22 @@ typedef enum COREWEBVIEW2_ORIGIN_FEATURE { | |
| /// For more information about Enhanced Security Mode, see: | ||
| /// https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/security | ||
| COREWEBVIEW2_ORIGIN_FEATURE_ENHANCED_SECURITY_MODE, | ||
| /// Specifies SmartScreen reputation check settings for the origin. | ||
| /// SmartScreen protects users from phishing and malware by checking navigated | ||
| /// URLs and downloaded files against a cloud-based reputation service. | ||
| /// By default, SmartScreen is enabled for all origins. Setting this feature to | ||
| /// `Disabled` for an origin will skip SmartScreen reputation checks for | ||
| /// navigations and downloads from that origin, effectively allow-listing it. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good suggestion. |
||
| /// | ||
| /// Warning: Disabling SmartScreen for an origin bypasses phishing and malware | ||
| /// reputation checks. Only disable for fully trusted, app-controlled origins | ||
| /// where the content is known to be safe. | ||
| /// | ||
| /// This per-origin configuration only takes effect when SmartScreen is | ||
| /// enabled. If SmartScreen is disabled via | ||
| /// [IsReputationCheckingRequired](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2settings.isreputationcheckingrequired), | ||
| /// this setting has no effect. | ||
| COREWEBVIEW2_ORIGIN_FEATURE_SMART_SCREEN, | ||
| } COREWEBVIEW2_ORIGIN_FEATURE; | ||
|
|
||
| /// Specifies the state of the origin feature. | ||
|
|
@@ -234,7 +259,7 @@ interface ICoreWebView2StagingProfile3 : IUnknown { | |
| /// Configures one or more feature settings for the specified origins. | ||
| /// | ||
| /// This method applies feature configurations—such as accent color support, | ||
| /// or enhanced security mode—to origins. Origins | ||
| /// enhanced security mode, or SmartScreen reputation checking—to origins. Origins | ||
| /// may be provided as exact origin strings or as wildcard patterns. | ||
| /// | ||
| /// The origin pattern can be an exact origin string or a wildcard pattern. | ||
|
|
@@ -336,6 +361,7 @@ namespace Microsoft.Web.WebView2.Core | |
| { | ||
| AccentColor = 0, | ||
| EnhancedSecurityMode = 1, | ||
| SmartScreen = 2, | ||
| }; | ||
|
|
||
| runtimeclass CoreWebView2OriginFeatureSetting | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, we try to avoid using marketing names in APIs, since marketing names tend to be fickle. E.g. "Drag Tray" changed to "Drop Tray"., "Microsoft Stream" changed to "Clipchamp", "Azure Active Directory" changed to "Entra", "Focus Assist" changed to "Focus Session".
Could this be called ReputationChecking?
This would also align with IsReputationCheckingRequired.