In: awesomium| programming
31 Jul 2009A nifty new security feature will be coming in the next release of Awesomium– you now have complete control over what resources can be accessed by a WebView via the new URL Filtering API!
Two modes of operation are supported: a blacklist and a whitelist. Under the blacklist mode, all resource requests and page navigations are allowed except those that match the URLs you describe. For the whitelist mode, it’s the opposite: all requests and navigations are denied except those that match the URLs you describe.
To describe a URL or set of URLs, you may specify one or more strings with wildcards. So, for example, to describe all URLs with the domain “princeofcode.com”, you would specify “http://princeofcode.com/*”.
As a convenience, you may also use “local://” in your URL filter strings to describe the base directory (set via WebCore::setBaseDirectory).
This features makes it really easy to sandbox a WebView so that it may only access local resources:
myWebView->setURLFilteringMode(UFM_WHITELIST);
myWebView->addURLFilter("local://*");
Or, maybe you wish to block users from accessing some specific video sites:
myWebView->setURLFilteringMode(UFM_BLACKLIST);
myWebView->addURLFilter("http://youtube.com/*");
myWebView->addURLFilter("http://vimeo.com/*");
myWebView->addURLFilter("http://metacafe.com/*");
What’s more, the URL filtering system is extremely flexible– these modes and filters can be applied to each WebView independently and you may also modify/remove modes and filters at runtime.
Hope yall find this new feature useful, this is just one of the new security enhancements that will be coming in the next release! I’ll be revealing some new features next week, so stay tuned to this blog!
Hey there, I’m Adam Simmons and this is my blog. I generally use this space to write about software (usually my own), games, emerging web technology, 3D stuff, and other nifty things as well as post photos and videos that are relevant to my life.
5 Responses to New Awesomium Feature: URL Filtering System
Klaim
July 31st, 2009 at 3:31 pm
As always, it’s perfect
Just to be sure : if we set the whitelist mode with only local html pages and an image inside has an external adress, then the image will not be loaded?
adam
July 31st, 2009 at 3:52 pm
Yup!
The URL filtering applies to both navigations (when you click on links) and on resource requests (such as images or scripts).
blubb
August 1st, 2009 at 2:21 am
I really hate to be such a nuisance … but could you please tell me anything about the next Hikari/Akarui updates? If there are any, that is.
adam
August 4th, 2009 at 1:31 pm
@ blubb:
Akarui/Hikari is going to be on the backburner for a bit until I finish the new release of Awesomium. I’ll try to have some updates for you in September.
blubb
August 5th, 2009 at 1:30 am
Cool … that’s all I wanted to know. Will come back then.