Skip to content
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

Add Spec: Enhanced Security Mode #4647

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tdanielles
Copy link

No description provided.

@tdanielles tdanielles changed the title Create EnhancedSecurityMode.md Add Spec: Enhanced Security Mode Jun 25, 2024
@tdanielles tdanielles added the API Proposal Review WebView2 API Proposal for review. label Jun 25, 2024
specs/EnhancedSecurityMode.md Outdated Show resolved Hide resolved
specs/EnhancedSecurityMode.md Outdated Show resolved Hide resolved
/// be set to Strict.
///
///
HRESULT GetEnhancedSecurityModeEnforceList(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would normally use Get/Set methods like this to represent an array. It would probably be easier (at least in .NET / WinRT) to use a vector/collection here instead. That should be the mutable collection pattern (see the WebView2 API Patterns doc). In COM that's get_EnhancedSecurityModeEnforceList([out] ICoreWebView2StringCollection** value) - a getter only that returns a mutable collection of strings. In WinRT/MIDL3 this should be Vector EnhancedSecurityModeEnforceList { get; } and in .NET a string collection property.

specs/EnhancedSecurityMode.md Outdated Show resolved Hide resolved
specs/EnhancedSecurityMode.md Outdated Show resolved Hide resolved
if (options.As(&optionsStaging9) == S_OK)
{
CHECK_FAILURE(optionsStaging9->put_IsEnhancedSecurityModeEnabled(
m_EnhancedSecurityModeEnabled ? TRUE : FALSE));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The C# & C++ sample code needs to match in logic. The C# always sets the IsESMEnabled to a constant while this does not.

{
CoreWebView2EnvironmentOptions options = new CoreWebView2EnvironmentOptions();
// Disable IsEnhancedSecurityModeEnabled by default to reduce impact on performance
options.IsEnhancedSecurityModeEnabled = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to show sample code setting a property to its already default value because it implies that the default is the 'true' here even though its not.

}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sample code should show the end dev how to perform a real scenario they may want to do in their app and in the way we imagine the feature should be used. In this sample code it looks like you let the end user edit everything which makes it hard to tell how to use the feature especially hard to tell what the form is of the strings added to the ESM lists.

I would guess that one scenario for the feature is the feature is turned on, its set to strict, and a URI filter for some things that are trusted and known to have perf issues are added. I would think that's the sort of common / recommended case for this feature? If so, then a sample should do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Proposal Review WebView2 API Proposal for review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants