Commit Graph

473 Commits (2f115c89af427aea2e2ab3b1b8fe6905f0223eae)
 

Author SHA1 Message Date
Alexander Larsson 2f115c89af document-portal: Actually respect WRITE permissions 2015-09-04 17:00:37 +02:00
Alexander Larsson 4be7bdc0f5 export-files: Allow specifying app permissions 2015-09-04 15:39:03 +02:00
Alexander Larsson 6cf4d24a09 document-portal: Use xdg_app_is_valid_name() to validate app names 2015-09-04 14:50:02 +02:00
Alexander Larsson 7ad47c74ea document-portals: Support unique documents
These document id will not be shared for multiple users. The main
difference is this this makes it safe for the creating app to delete
the document if he wants to (i.e. for temporary docs), and thus we can
grant this additional permission for the calling app.
2015-09-04 14:46:02 +02:00
Alexander Larsson 83201bd7e4 fuse: Always open files with O_NOFOLLOW
Following symlinks is risky as the sandbox may control them.
2015-09-04 14:16:45 +02:00
Alexander Larsson 0c07417d5f Add debug output for release 2015-09-03 22:17:00 +02:00
Alexander Larsson 1f81b81b1a Add xdg-app export-file to export files with the document portal 2015-09-03 22:17:00 +02:00
Alexander Larsson 04879fdea5 Store and verify parent dir dev/ino and pass O_PATH fds
In order to be robust against symlink attacks (i.e. make a document
for a path, then replace it with a symlink somewhere else and have the
portal read that instead) we store the parent dev/ino when we create
the document id and always verify that (atomically with the *at
syscalls) on each use.

Also, we pass O_PATH fds when creating documents, as it allows us
to be a bit safer. For instance we can verify that the fd is a O_PATH
fd before doing any ops on it, and it makes it possible to avoid other
symlink trickery.

Also, we drop the double add methods, and just use the O_PATH version.
2015-09-03 22:17:00 +02:00
Alexander Larsson c0e480df94 Add xdg_app_mkstempat
This is like g_mkstemp except it uses openat
2015-09-03 22:17:00 +02:00
Alexander Larsson 4a298aeec3 fuse: Make filesystem multithreaded
This allows us to handle multiple apps better.
2015-09-03 22:16:43 +02:00
Alexander Larsson 58fb2c4e50 Markup AUTOLOCK with unused to avoid warnings 2015-09-03 22:16:43 +02:00
Colin Walters 8bbe3b3e41 helper: Add perf and ptrace to seccomp blacklist
Note that I copied this xdg-app blacklist into linux-user-chroot:
https://git.gnome.org/browse/linux-user-chroot/commit/?id=8cee4ab7345f126d1dec55b7ca1f28e8090a58d3

We should figure out a better way down the line to share code - maybe
we can share a setup-seccomp.c?

Possibly in the long run we'll end up with diverging blacklists, as
linux-user-chroot can be a lot more aggressive, as its primary
audience is build side, not generic applications.  We'll see.

But in this patch I added a big comment on how we should share code,
and in particular credit sandstorm.io for some of these filters.
(Although they may have gotten some of them from Android or Chromium?)

Going back to the high level topic - let's add perf and ptrace to the
blacklist.  We expect profiling to be done from a non-sandboxed
terminal, or a less-restricted IDE type process which can look at the
namespace of other apps and the desktop/kernel.
2015-09-02 09:08:06 +02:00
Alexander Larsson 6775dc1002 Use g_auto(GStrv) instead of glnx_strfreev 2015-08-31 09:51:48 +02:00
Colin Walters bfeaccb822 Update libglnx, use its copy of backports
This fixes the build on GLib 2.42 at least - the conditionals for
g_strv_contains() weren't right.  I'm trying to have libglnx also be a
centralized "glib backports" area, so having g_strv_contains() there
is better.
2015-08-31 09:40:45 +02:00
Colin Walters 0a6d02ec78 autogen: Fix git submodules
We don't have bsdiff here.
2015-08-31 09:40:45 +02:00
Alexander Larsson f6657901c4 utils: Add AUTOLOCK macro 2015-08-27 19:42:15 +02:00
Alexander Larsson d442e9bb4c Fix const marking of string arrays. 2015-08-27 16:16:58 +02:00
Alexander Larsson 909aa7a762 Fix error check of policy parsing 2015-08-27 16:16:38 +02:00
Alexander Larsson cbdd412d71 Fix type of return 2015-08-27 16:16:02 +02:00
Alexander Larsson e5e5389bb3 dbus-proxy: Avoid clang warning 2015-08-27 16:15:35 +02:00
Alexander Larsson 53df418814 dbus-proxy: Fix incorrect check of name policy
It was checking against the wrong enum type
2015-08-27 16:14:48 +02:00
Alexander Larsson f5aba30ade dbus-proxy: Fix flags arg passed to g_socket_receive_message
This is an out param, not an in param
2015-08-27 16:13:49 +02:00
Alexander Larsson 52525f46fd Remove ununsed variables reported by clang 2015-08-27 16:13:15 +02:00
Alexander Larsson 42012a7d5a Drop the xdp specific errors and use the xdg-app ones 2015-08-27 10:40:58 +02:00
Alexander Larsson b6355e1acb Document portal: Store paths, not uris
There is no way to do this for generic uris anyway, lets not
pretend we're solving a larger problem.
2015-08-27 10:38:22 +02:00
Alexander Larsson 0c25376657 Switch document portal to use strings for document ids 2015-08-26 17:26:53 +02:00
Alexander Larsson 12fbd9ff95 Make document portal use the new permission store 2015-08-26 17:11:35 +02:00
Alexander Larsson a3f4342b5a Initial version of permission store
This is a generalized store for permissions, which also will
be used by the document portal.
2015-08-26 17:11:31 +02:00
Alexander Larsson c4e500db37 Add XdgAppError 2015-08-25 13:16:34 +02:00
Alexander Larsson de004081ef Initial tests of the db 2015-08-25 13:16:34 +02:00
Alexander Larsson d9f9080967 Initial version of XdgAppDb 2015-08-25 13:16:31 +02:00
Alexander Larsson 2d0866cac8 gvdb: Add gvdb_table_get_content
This is useful if you want to apply outstanding changes to
a table withough immediately persisting it to disk.
2015-08-25 09:27:35 +02:00
Alexander Larsson a9ffa4960d Move gvdb to lib/ 2015-08-25 09:27:35 +02:00
Alexander Larsson ffa1acea75 Rename dbus file to org.freedesktop.XdgApp 2015-08-25 09:27:35 +02:00
Alexander Larsson 2238cc44c3 Change dbus name of session helper to org.freedesktop.XdgApp 2015-08-18 13:33:03 +02:00
Alexander Larsson c465c15e51 Don't list empty names in opendir
This happened in my devel system by mistake and it broke readdir.
2015-08-04 12:05:21 +02:00
Alexander Larsson f76f6a39ef document-portal: *always* use the by-app location
This is better as you can't accidentally access another apps docs (although
you can still see the backing real files)
2015-07-11 10:48:53 +02:00
Alexander Larsson 08d05a30a3 Automatically start and mount document portal in sandbox 2015-07-10 17:49:59 +02:00
Alexander Larsson 4c4c66fc2d Add GetMountPoint method for document portal
This is both to get the mount path and to have a nice way
to activate the mount.
2015-07-10 17:02:38 +02:00
Alexander Larsson 929071ad10 Import xdg-document-portal from github repo
This pulls in the daemon code from:
     https://github.com/alexlarsson/xdg-document-portal/

We need this in xdg-app because we need to set up the mounts correctly.
2015-07-10 16:56:39 +02:00
Alexander Larsson b0e1124f02 Bump version to 0.3.6 2015-07-10 12:39:54 +02:00
Alexander Larsson 0040312b07 If home is accessible, make user-dirs.dir visible in custom config dir
This makes xdg user dirs work in the sandbox too.
2015-07-10 12:36:54 +02:00
Alexander Larsson 3e1d401c6d Add NEWS file 2015-07-10 12:23:42 +02:00
Alexander Larsson 302f88e69d Restructure directories and build
This moves a all source code into separate subdirs per binary. The
helper and the generic stuff goes into lib/ which is then used by all
the others. For now this is a completely internal library, but at
some point we will probably clean it up and expose some subset.

Also, we move the dbus proxy to libexecdir.
2015-07-10 12:15:45 +02:00
Dan Nicholson ef223b6a46 helper: Add all possible architectures to seccomp filter
Ensure that the seccomp filters will be applied if someone tries to run
a non-native architecture program. This currently only covers the
various x86 architectures and was borrowed from systemd LGPL code.

https://bugs.freedesktop.org/show_bug.cgi?id=91165
2015-07-01 00:18:44 +02:00
Alexander Larsson f28b1d3082 helper: Mount extra dirs/files only after all other mounts are up
This fixes the user-dirs.dirs write being over-mapped. But it also
just make more sense.
2015-07-01 00:14:21 +02:00
Dan Nicholson ecf8ecf088 Write user-dirs.dirs under app's XDG_CONFIG_HOME
Creating the custom user-dirs.dirs under ~/.config won't work since
later the config directory gets set via XDG_CONFIG_HOME. Pass in the
app's data directory so that the the custom config directory can be
used.

https://bugs.freedesktop.org/show_bug.cgi?id=91164
2015-06-30 23:26:35 +02:00
Dan Nicholson 163b582a72 helper: Disable socket filters on x86
Filtering on socket related syscalls are not possible on x86. See
https://github.com/seccomp/libseccomp/issues/8. Disable socket filtering
until a better solution comes along.

https://bugs.freedesktop.org/show_bug.cgi?id=91162
2015-06-30 23:05:38 +02:00
Alexander Larsson 653e71d006 run: Make users fonts appear in /run/host/user-fonts 2015-06-30 20:04:05 +02:00
Alexander Larsson 22bdf350db helper: Fix typo in the socket-family blacklist
We want greater-or-equal on the last family in the list, not on the
other families.
2015-06-29 23:00:50 +02:00