Language: Python
Label: safe
CWE: CWE-269 \u2014 Improper Privilege Management
The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.

Code:
    def open_url(self, url):
        """Open the given URL in a new browser window.

        Display an error dialog if everything fails.
        """
        (r, w) = os.pipe()
        if os.fork() > 0:
            os.close(w)
            status = os.wait()[1]
            if status:
                title = _("Unable to start web browser")
                error = _("Unable to start web browser to open %s." % url)
                message = os.fdopen(r).readline()
                if message:
                    error += "\n" + message
                self.ui_error_message(title, error)
            try:
                os.close(r)
            except OSError:
                pass
            return

        os.setsid()
        os.close(r)

        try:
            try:
                run_as_real_user(["xdg-open", url], get_user_env=True)
            except OSError:
                # fall back to webbrowser
                webbrowser.open(url, new=True, autoraise=True)
                sys.exit(0)
        except Exception as error:  # pylint: disable=broad-except
            os.write(w, str(error))
            sys.exit(1)
        os._exit(0)  # pylint: disable=protected-access