unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43071: Enable WebKit sandboxing
@ 2020-08-27 13:14 Paul Eggert
  2020-08-27 13:41 ` Stefan Kangas
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Paul Eggert @ 2020-08-27 13:14 UTC (permalink / raw)
  To: 43071
  Cc: Robert Pluim, Jimmy Aguilar Mena, Jaesup Kwak, Qiantan Hong,
	Sungbin Jo

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

Qiantan Hong suggested that Emacs should enable sandboxing in WebKit, for all 
the usual security reasons. (Thanks, Qiantan!)

Attached is a proposed patch to implement that suggestion; it's a bit fancier 
than what Qiantan originally proposed in 
<https://lists.gnu.org/r/emacs-devel/2020-08/msg00896.html> because it checks 
that WebKit 2.26 or later is in use, and it avoids a duplicate call to 
webkit_web_context_get_default. I'm cc'ing this to Qiantan and to other recent 
committers to xwidget.c, to get their opinions.

[-- Attachment #2: 0001-Use-WebKit-sandboxing.patch --]
[-- Type: text/x-patch, Size: 1550 bytes --]

From 1ca9d47923813e536753c18aa15194f15f39ab3d Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 27 Aug 2020 06:00:52 -0700
Subject: [PATCH] Use WebKit sandboxing

* src/xwidget.c (Fmake_xwidget): Enable sandboxing if WebKit 2.26
or later.  Do this early, as required for sandboxing.
Co-authored-by: Qiantan Hong <qhong@mit.edu>
Copyright-paperwork-exempt: yes
---
 src/xwidget.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/xwidget.c b/src/xwidget.c
index 154b3e9c82..851f96952c 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -114,6 +114,13 @@ DEFUN ("make-xwidget",
   if (EQ (xw->type, Qwebkit))
     {
       block_input ();
+      WebKitWebContext *webkit_context = webkit_web_context_get_default ();
+
+# if WEBKIT_CHECK_VERSION (2, 26, 0)
+      if (!webkit_web_context_get_sandbox_enabled (webkit_context))
+	webkit_web_context_set_sandbox_enabled (webkit_context, TRUE);
+# endif
+
       xw->widgetwindow_osr = gtk_offscreen_window_new ();
       gtk_window_resize (GTK_WINDOW (xw->widgetwindow_osr), xw->width,
                          xw->height);
@@ -152,7 +159,7 @@ DEFUN ("make-xwidget",
                             "load-changed",
                             G_CALLBACK (webkit_view_load_changed_cb), xw);
 
-          g_signal_connect (G_OBJECT (webkit_web_context_get_default ()),
+          g_signal_connect (G_OBJECT (webkit_context),
                             "download-started",
                             G_CALLBACK (webkit_download_cb), xw);
 
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#43071: Enable WebKit sandboxing
  2020-08-27 13:14 bug#43071: Enable WebKit sandboxing Paul Eggert
@ 2020-08-27 13:41 ` Stefan Kangas
  2020-08-27 18:24   ` Paul Eggert
  2020-10-25  0:27   ` Paul Eggert
  2020-08-27 18:14 ` Jimmy Aguilar Mena
  2020-09-29 16:22 ` Qiantan Hong
  2 siblings, 2 replies; 6+ messages in thread
From: Stefan Kangas @ 2020-08-27 13:41 UTC (permalink / raw)
  To: Paul Eggert, 43071
  Cc: Robert Pluim, Jimmy Aguilar Mena, Jaesup Kwak, Qiantan Hong,
	Sungbin Jo

Paul Eggert <eggert@cs.ucla.edu> writes:

> Qiantan Hong suggested that Emacs should enable sandboxing in WebKit, for all
> the usual security reasons. (Thanks, Qiantan!)
>
> Attached is a proposed patch to implement that suggestion; it's a bit fancier
> than what Qiantan originally proposed in
> <https://lists.gnu.org/r/emacs-devel/2020-08/msg00896.html> because it checks
> that WebKit 2.26 or later is in use, and it avoids a duplicate call to
> webkit_web_context_get_default. I'm cc'ing this to Qiantan and to other recent
> committers to xwidget.c, to get their opinions.

Thanks Qiantan Hong and Paul Eggert.

Is this important enough to warrant backporting to emacs-26?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#43071: Enable WebKit sandboxing
  2020-08-27 13:14 bug#43071: Enable WebKit sandboxing Paul Eggert
  2020-08-27 13:41 ` Stefan Kangas
@ 2020-08-27 18:14 ` Jimmy Aguilar Mena
  2020-09-29 16:22 ` Qiantan Hong
  2 siblings, 0 replies; 6+ messages in thread
From: Jimmy Aguilar Mena @ 2020-08-27 18:14 UTC (permalink / raw)
  To: Paul Eggert; +Cc: pcr910303, qhong, veshboo, rpluim, 43071

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]

It looks fine for me.

Maybe it should be added as a security patch for the 27.* branch.

On Thu, 27 Aug 2020 at 15:14, Paul Eggert <eggert@cs.ucla.edu> wrote:

> Qiantan Hong suggested that Emacs should enable sandboxing in WebKit, for
> all
> the usual security reasons. (Thanks, Qiantan!)
>
> Attached is a proposed patch to implement that suggestion; it's a bit
> fancier
> than what Qiantan originally proposed in
> <https://lists.gnu.org/r/emacs-devel/2020-08/msg00896.html> because it
> checks
> that WebKit 2.26 or later is in use, and it avoids a duplicate call to
> webkit_web_context_get_default. I'm cc'ing this to Qiantan and to other
> recent
> committers to xwidget.c, to get their opinions.
>

[-- Attachment #2: Type: text/html, Size: 1158 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#43071: Enable WebKit sandboxing
  2020-08-27 13:41 ` Stefan Kangas
@ 2020-08-27 18:24   ` Paul Eggert
  2020-10-25  0:27   ` Paul Eggert
  1 sibling, 0 replies; 6+ messages in thread
From: Paul Eggert @ 2020-08-27 18:24 UTC (permalink / raw)
  To: Stefan Kangas, 43071
  Cc: Robert Pluim, Jimmy Aguilar Mena, Jaesup Kwak, Qiantan Hong,
	Sungbin Jo

On 8/27/20 6:41 AM, Stefan Kangas wrote:
> Is this important enough to warrant backporting to emacs-26?

I would think so, yes. It's security-relevant, and its effects should be limited 
to GNU/Linux distros that configure Emacs using --with-xwidgets.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#43071: Enable WebKit sandboxing
  2020-08-27 13:14 bug#43071: Enable WebKit sandboxing Paul Eggert
  2020-08-27 13:41 ` Stefan Kangas
  2020-08-27 18:14 ` Jimmy Aguilar Mena
@ 2020-09-29 16:22 ` Qiantan Hong
  2 siblings, 0 replies; 6+ messages in thread
From: Qiantan Hong @ 2020-09-29 16:22 UTC (permalink / raw)
  To: 43071@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 52 bytes --]

Just a follow up, what’s the status on this patch?

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 1858 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#43071: Enable WebKit sandboxing
  2020-08-27 13:41 ` Stefan Kangas
  2020-08-27 18:24   ` Paul Eggert
@ 2020-10-25  0:27   ` Paul Eggert
  1 sibling, 0 replies; 6+ messages in thread
From: Paul Eggert @ 2020-10-25  0:27 UTC (permalink / raw)
  To: Stefan Kangas, 43071-done
  Cc: 44204, Qiantan Hong, Jaesup Kwak, Robert Pluim,
	Jimmy Aguilar Mena, Sungbin Jo

No further comment, so I installed the WebKit sandboxing patch into the emacs-27 
branch on Savannah 
<https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-27&id=71661b287297f328c2c5ad67e180a760f80850cb>. 
After the next merge from emacs-27 to master, this patch should appear in the 
master branch. I am closing Bug#43071.

While testing the fix, I ran into a problem with xwidgets and filed Bug#44204 
"Emacs --with-xwidgets complains under Ubuntu 20.04" which you can see here:

https://bugs.gnu.org/44204

Has anyone had luck running Emacs --with-xwidgets under Ubuntu 20.04 or later? 
I'll cc. this to 44204@debbugs.gnu.org to try to move that part of the 
discussion there.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-25  0:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 13:14 bug#43071: Enable WebKit sandboxing Paul Eggert
2020-08-27 13:41 ` Stefan Kangas
2020-08-27 18:24   ` Paul Eggert
2020-10-25  0:27   ` Paul Eggert
2020-08-27 18:14 ` Jimmy Aguilar Mena
2020-09-29 16:22 ` Qiantan Hong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).