-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Javascript Binding - Add ability to limit access to JavaScript Bound objects to specific origins #5085
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
base: master
Are you sure you want to change the base?
Conversation
cefSharpObj->SetValue(kRenderProcessId, CefV8Value::CreateInt(processId), CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE); | ||
|
||
global->SetValue(_jsBindingPropertyName, cefSharpObj, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_READONLY); | ||
createObjects = false; |
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.
Extract this into a helper method would probably make this a lot cleaner
@@ -33,6 +35,24 @@ public bool JavascriptBindingApiEnabled | |||
} | |||
} | |||
|
|||
/// <summary> | |||
/// When <see cref="JavascriptBindingApiEnabled"/> is set to true, set a collection |
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.
Needs review
@@ -95,5 +115,17 @@ public bool AlwaysInterceptAsynchronously | |||
alwaysInterceptAsynchronously = value; | |||
} | |||
} | |||
|
|||
/// <summary> | |||
/// HasJavascriptBindingApiAllowOrigins |
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.
Needs review.
Could probably use some more tests, specifically for multiple origins in the list |
❌ Build CefSharp 135.0.170-CI5207 failed (commit bcf0a561b5 by @amaitland) |
❌ Build CefSharp 135.0.170-CI5209 failed (commit 8a395dfd16 by @amaitland) |
b98cfbe
to
218de9c
Compare
218de9c
to
60203e5
Compare
|
||
auto clrOrigin = StringUtils::ToClr(origin); | ||
|
||
auto originEqual = String::Compare(clrframeUrlOrigin, clrOrigin, StringComparison::InvariantCultureIgnoreCase); |
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.
Need to find a more efficient string comparison, ideally compare the native strings
✅ Build CefSharp 135.0.170-CI5213 completed (commit 0ac4c7d444 by @amaitland) |
Fixes:
#5001
Summary:
Changes:
How Has This Been Tested?
Types of changes
Checklist: