Giter VIP home page Giter VIP logo

Comments (7)

dfmuir avatar dfmuir commented on August 21, 2024

Interesting. I was able to recreate this on your URL as well as others. I will work on this one.

I am open to solution suggestions from others as well.

from kinwebbrowser.

dfmuir avatar dfmuir commented on August 21, 2024

I submitted this issue to StackOverflow here:

https://stackoverflow.com/questions/26501172/launching-phone-email-map-links-in-wkwebview

from kinwebbrowser.

ehlersd avatar ehlersd commented on August 21, 2024

I was able to get it to work for the Google Maps link (which appears to be related to the target="_blank") and for the tel: scheme by adding this function to your KINWebBrowserViewController.m

- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{
    if(webView != self.wkWebView) {
        decisionHandler(WKNavigationActionPolicyAllow);
        return;
    }

    UIApplication *app = [UIApplication sharedApplication];
    NSURL         *url = navigationAction.request.URL;

    if (!navigationAction.targetFrame) {
        if ([app canOpenURL:url]) {
            [app openURL:url];
            decisionHandler(WKNavigationActionPolicyCancel);
            return;
        }
    }
    if ([url.scheme isEqualToString:@"tel"])
    {
        if ([app canOpenURL:url])
        {
            [app openURL:url];
            decisionHandler(WKNavigationActionPolicyCancel);
            return;
        }
    }
    decisionHandler(WKNavigationActionPolicyAllow);
}

from kinwebbrowser.

dfmuir avatar dfmuir commented on August 21, 2024

I appreciate your solution. You are definitely on the right path. After some pretty extensive research on this issue, I discovered that the code above introduces a serious security flaw.

The way you are calling [app openURL:url]; enables the application to automatically open any other apps without prompting the user. This could cause the user to be tricked into placing a call or even a FaceTime call. This has serious security concerns, as users could be charged for these calls or have image of their face stolen.

See more information here: http://algorithm.dk/posts/rtfm-0day-in-ios-apps-g-gmail-fb-messenger-etc

I am actively working on a solution for this and will update soon.

from kinwebbrowser.

ehlersd avatar ehlersd commented on August 21, 2024

Awesome catch! Glad you found that one (and are working on a solution!) Let me know if there's anything I can do to help.

For the moment, our use-case is only displaying internal documents that we have full control over, so it's not a real security issue for us. But, in the near future, that my be extended and it may very well become an issue.

from kinwebbrowser.

dfmuir avatar dfmuir commented on August 21, 2024

I just pushed these changes onto: https://github.com/dfmuir/KINWebBrowser/tree/external_url_support

It enables both of the links on your page that were previously broken.

Let me know what you think. Basically, if the scheme of the URL is not http or https, and [[UIApplication sharedApplication] canOpenURL:URL]; then the user is prompted to open an external app.

Two weaknesses right now:

  1. When launching your Google Maps HTTP link, the website opens successfully, but the app is not launched. This doesn't seem ideal.
  2. There does not seem to be a way to determine which app will be opening the URL, so there is no way to present that information to the user when making the decision about the external app.

I am going to think a little bit more on this before merging with master.

from kinwebbrowser.

dfmuir avatar dfmuir commented on August 21, 2024

I believe this issue has been resolved in KINWebBrowser 1.2.0

from kinwebbrowser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.