After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 684245 - Disable 3rd-party browser plugins
Disable 3rd-party browser plugins
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Mailer
3.6.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2012-09-17 20:14 UTC by Mathieu Trudel-Lapierre
Modified: 2013-05-07 07:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Disable installed 3rd party plugins in WK (1.04 KB, patch)
2013-03-21 11:45 UTC, Tomas Popela
none Details | Review
Proposed patch (1.04 KB, patch)
2013-03-21 12:04 UTC, Tomas Popela
committed Details | Review

Description Mathieu Trudel-Lapierre 2012-09-17 20:14:55 UTC
From downstream bug report at https://bugs.launchpad.net/ubuntu/+source/evolution/+bug/1037669

Evolution now uses webkit for html mail. On launch, it tries to access the google-talkplugin. When looking at a certain messages in preview mode (a google calendar invite), it tries to launch /usr/lib/x86_64-linux-gnu/gstreamer0.10/gstreamer-0.10/gst-plugin-scanner. Interestingly, this is happening even though I have 'Only ever show plain text' configured in Preferences/Mail Preferences/HTML Messages (I do have 'Show suppressed HTML parts as attachments' selected).

This suggests that evolution:
 - would gladly use plugins
 - that javascript is possibly enabled (for the plugin finder)
 - that the WebKit HTML renderer is being invoked even though 'Only ever show plain text' is selected

Webkit is an immensely powerful renderer and it is being used to render completely untrusted input from anyone who can send an email. We need to make sure that plugins and javascript are disabled and that the renderer is not being used at all when 'Only ever show plain text' is enabled (it could be used to deliver text/plain, but it seems that it is processing the HTML then discarding it). This would bring it in line with Thunderbird's policies.

I noticed this because I use AppArmor to confine evolution. Unfortunately in my situation, evolution hung on the message that invoked the plugin finder because the plugin finder failed to launch. I have rules now that will prevent the hang, but evolution isn't handling this error condition gracefully either.

This should be considered an important security regression.
Comment 1 André Klapper 2012-09-18 10:26:41 UTC
(In reply to comment #0)
> On launch, it tries to access the google-talkplugin. 

Would be great if you could provide some pointers (AppArmor log or such).

> When looking at a certain messages in preview mode (a google
> calendar invite), it tries to launch
> /usr/lib/x86_64-linux-gnu/gstreamer0.10/gstreamer-0.10/gst-plugin-scanner.
> Interestingly, this is happening even though I have 'Only ever show plain text'
> configured in Preferences/Mail Preferences/HTML Messages (I do have 'Show
> suppressed HTML parts as attachments' selected).

I don't see the relation between calendar invitations and having HTML enabled or not.

> Webkit is an immensely powerful renderer and it is being used to render
> completely untrusted input from anyone who can send an email. We need to make
> sure that plugins and javascript are disabled

JavaScript is disabled in EWebView: http://git.gnome.org/browse/evolution/commit/?id=967b238b77c1912c33e1a508781d9124b9e351a7
Comment 2 André Klapper 2012-09-20 10:38:43 UTC
Correct, plugins are enabled according to https://mail.gnome.org/archives/evolution-list/2012-September/msg00055.html
Comment 3 Mathieu Trudel-Lapierre 2012-09-21 19:20:56 UTC
Should it not be possible to limit the use of plugins to only the one(?) that is needed to render the attachment bar?
Comment 4 Milan Crha 2013-03-21 10:02:18 UTC
Tomas is working on a fix which will disable all 3rd-party plugins.
Comment 5 Tomas Popela 2013-03-21 11:45:24 UTC
Created attachment 239457 [details] [review]
Disable installed 3rd party plugins in WK
Comment 6 Tomas Popela 2013-03-21 12:04:01 UTC
Created attachment 239459 [details] [review]
Proposed patch

Same patch as previous, but with some code style changes. Actually WebKit will be still loading all installed plugins, but it won't be using them.
Comment 7 Milan Crha 2013-03-21 13:17:47 UTC
Review of attachment 239459 [details] [review]:

Looks good, please commit to master and gnome-3-8 branches, after the hard code freeze.
Comment 9 Antoine Jacoutot 2013-04-15 13:16:49 UTC
Hi.

This commit introduced a double-free for me:
evolution in free(): error: chunk is already free 0x18a65dd62880

(gdb) bt full
  • #0 kill
    at <stdin> line 2
  • #1 abort
    at /usr/src/lib/libc/stdlib/abort.c line 70
  • #2 wrterror
    at /usr/src/lib/libc/stdlib/malloc.c line 273
  • #3 free
    at /usr/src/lib/libc/stdlib/malloc.c line 1252
  • #4 webkit_web_plugin_finalize
    from /usr/local/lib/libwebkitgtk-3.0.so.5.0
  • #5 g_object_unref
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #6 webkit_web_plugin_database_plugins_list_free
    from /usr/local/lib/libwebkitgtk-3.0.so.5.0
  • #7 web_view_disable_webkit_3rd_party_plugins
    at e-web-view.c line 1355
  • #8 g_once_impl
    from /usr/local/lib/libglib-2.0.so.3600.0
  • #9 e_web_view_init
    at e-web-view.c line 1599
  • #10 g_type_create_instance
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #11 g_object_constructor
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #12 g_object_newv
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #13 g_object_new_valist
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #14 g_object_new
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #15 mail_paned_view_constructed
    at e-mail-paned-view.c line 639
  • #16 g_object_newv
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #17 g_object_new_valist
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #18 g_object_new
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #19 e_mail_paned_view_new
    at e-mail-paned-view.c line 1066
  • #20 mail_shell_content_constructed
    at e-mail-shell-content.c line 204
  • #21 g_object_newv
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #22 g_object_new_valist
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #23 g_object_new
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #24 e_mail_shell_content_new
    at e-mail-shell-content.c line 492
  • #25 shell_view_constructed
    at e-shell-view.c line 603
  • #26 mail_shell_view_constructed
    at e-mail-shell-view.c line 232
  • #27 g_object_newv
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #28 g_object_new_valist
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #29 g_object_new
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #30 shell_window_create_shell_view
    at e-shell-window.c line 702
  • #31 e_shell_window_get_shell_view
    at e-shell-window.c line 1107
  • #32 e_shell_window_set_active_view
    at e-shell-window.c line 1349
  • #33 shell_window_set_property
    at e-shell-window.c line 253
  • #34 g_object_set_property
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #35 g_settings_binding_key_changed
    from /usr/local/lib/libgio-2.0.so.3600.0
  • #36 g_settings_bind_with_mapping
    from /usr/local/lib/libgio-2.0.so.3600.0
  • #37 g_settings_bind
    from /usr/local/lib/libgio-2.0.so.3600.0
  • #38 e_shell_window_private_constructed
    at e-shell-window-private.c line 415
  • #39 shell_window_constructed
    at e-shell-window.c line 398
  • #40 g_object_newv
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #41 g_object_new_valist
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #42 g_object_new
    from /usr/local/lib/libgobject-2.0.so.3600.0
  • #43 e_shell_window_new
    at e-shell-window.c line 1049
  • #44 e_shell_create_shell_window
    at e-shell.c line 1522
  • #45 idle_cb
    at main.c line 250
  • #46 g_main_context_dispatch
    from /usr/local/lib/libglib-2.0.so.3600.0
  • #47 g_main_context_iterate
    from /usr/local/lib/libglib-2.0.so.3600.0
  • #48 g_main_loop_run
    from /usr/local/lib/libglib-2.0.so.3600.0
  • #49 gtk_main
    from /usr/local/lib/libgtk-3.so.800.0
  • #50 main
    at main.c line 707

Comment 10 Milan Crha 2013-04-15 14:33:06 UTC
(In reply to comment #9)
> This commit introduced a double-free for me:
> evolution in free(): error: chunk is already free 0x18a65dd62880

That's weird, because the code change is all correct, according to the documentation, unless your webkit version changes API semantic in some way. What is your webkitgtk3 version, by the way?
Comment 11 Antoine Jacoutot 2013-04-15 14:36:25 UTC
(In reply to comment #10)
> What is your webkitgtk3 version, by the way?

Bah sorry, I forgot to mention the obvious indeed :)
webkit 2.0.0
Comment 12 Matthew Barnes 2013-04-15 15:21:25 UTC
I did change this slightly from Tomas' original commit.

Details are in my commit message:
https://git.gnome.org/browse/evolution/commit/?id=eb6ecc6fb5d1b6859fab949ba20865d2ca784306

But I'm not seeing any problems here.  Maybe it's a misbehaving WebKit plugin?
Comment 13 Antoine Jacoutot 2013-04-15 15:59:19 UTC
libgnome-shell-browser-plugin.so
> But I'm not seeing any problems here.  Maybe it's a misbehaving WebKit plugin?

The only plugins I had were the ones from gnome-shell and rhythmbox:
libgnome-shell-browser-plugin.so
librhythmbox-itms-detection-plugin.so

I removed them, but same thing... Hmm.
Comment 14 Milan Crha 2013-04-16 10:47:32 UTC
I suspect the misbehaving webkitgtk3 too, or some misplaced unref. Tomas is using the same version as you, with no problem (as far as I know). Could you try to install run evolution under valgrind, whether it'll show where the pointer was removed? You can do that with a command like this:
  $ G_SLICE=always-malloc valgrind --num-callers=50 --track-origins=yes \
       evolution

Either the valgrind will crash and print info about the memory (where it was freed), or it'll identify the issue and will run evolution (in a veeery slow mode, dure to all the memory checking).
Comment 15 Antoine Jacoutot 2013-04-16 11:35:37 UTC
(In reply to comment #14)
> I suspect the misbehaving webkitgtk3 too, or some misplaced unref. Tomas is
> using the same version as you, with no problem (as far as I know). Could you
> try to install run evolution under valgrind, whether it'll show where the

Unfortunately, valgrind is not available on OpenBSD :-/
I'll try and dig up a bit more so that I can provide you guys with more information.
Thanks.
Comment 16 Milan Crha 2013-04-16 11:55:19 UTC
OK, thanks. I would try g_object_weak_ref() on each object of the GSList, but it'll not work, if the plugin is already released.
Comment 17 Matthew Barnes 2013-04-16 12:58:21 UTC
The only free() call in webkit_web_plugin_finalize() is for the priv->path string.   Perhaps the private struct is not zero-filled on initialization, and the path string is never set.  The address being freed could be garbage.

Instance initialization looks like:

    plugin->priv = new WebKitWebPluginPrivate();
    plugin->priv->mimeTypes = 0;

But "plugin->priv->path = 0" is conspicuously absent.

If I'm right, Tomas can submit a one-line fix for WebKitWebPlugin.
Comment 18 Matthew Barnes 2013-04-16 15:17:55 UTC
As long as we're talking WebKitGTK+ patches, an even better option would be to disable the WebKitWebPluginDatabase itself, such that it would refuse to load plugins and yield empty results for its lookup functions.  That would require new APIs though.

It's kinda silly to load all the WebKit plugins only to disable them all.  Better to just not load them.
Comment 19 Matthew Barnes 2013-04-16 15:20:18 UTC
(In reply to comment #18)
> Better to just not load them.

Or rather, prevent WebKit from loading them.
Comment 20 Antoine Jacoutot 2013-05-02 13:48:51 UTC
(In reply to comment #17)
> The only free() call in webkit_web_plugin_finalize() is for the priv->path
> string.   Perhaps the private struct is not zero-filled on initialization, and
> the path string is never set.  The address being freed could be garbage.
> 
> Instance initialization looks like:
> 
>     plugin->priv = new WebKitWebPluginPrivate();
>     plugin->priv->mimeTypes = 0;
> 
> But "plugin->priv->path = 0" is conspicuously absent.
> 
> If I'm right, Tomas can submit a one-line fix for WebKitWebPlugin.

Hi Matthew.

Good catch, adding this line in the initialization fixed the issue for me.
I still have some double frees from time to time but they are unrelated to WebKit.

Can you contact the WebKit devs regarding this, or should I post a bug report myself?
Thank you.
Comment 21 Matthew Barnes 2013-05-02 14:11:36 UTC
Cool.  I'll defer to Tomas to get this upstreamed.
Comment 22 Tomas Popela 2013-05-07 07:41:50 UTC
Pushed into WebKit - https://bugs.webkit.org/show_bug.cgi?id=115624