4224 Commits

Author SHA1 Message Date
Alexander Larsson
aa245a02f3 Update pofiles 1.0.7 2019-02-11 13:46:16 +01:00
Alexander Larsson
ff152dccdd Update NEWS for release 2019-02-11 13:39:47 +01:00
Alexander Larsson
699d5af02d Bump version to 1.0.7 2019-02-11 13:39:35 +01:00
Alexander Larsson
9cb5f1e465 Don't expose /proc when running apply_extra
As shown by CVE-2019-5736, it is sometimes possible for the sandbox
app to access outside files using /proc/self/exe. This is not
typically an issue for flatpak as the sandbox runs as the user which
has no permissions to e.g. modify the host files.

However, when installing apps using extra-data into the system repo
we *do* actually run a sandbox as root. So, in this case we disable mounting
/proc in the sandbox, which will neuter attacks like this.

(cherry picked from commit 468858c1cbcdbcb27266deb5c7347b37adf3a9e4)
2019-02-11 13:39:23 +01:00
AsciiWolf
a1e50b90ea Update Czech translation
Closes: #2429
Approved by: matthiasclasen
2018-12-14 00:12:16 +00:00
Alexander Larsson
38b5560c66 Update pofiles for release 1.0.6 2018-11-16 12:09:54 +01:00
Alexander Larsson
dce295b7dd Bump version to 1.0.6 2018-11-16 12:05:14 +01:00
Alexander Larsson
8d95bc0a0d Update NEWS for 1.0.6 2018-11-16 12:04:52 +01:00
Erick555
d83076069e Mount x11_socket as read-only
Fixes https://github.com/flatpak/flatpak/issues/2315
Closes: #2316
Approved by: alexlarsson

(cherry picked from commit 0af71792b4)
2018-11-16 11:39:15 +01:00
Alexander Larsson
b98e09b20d extra-data: Don't allow creating files with non-canonical permissions in apply_extra
When installing a flatpak with extra-data we execute the apply_extra
script from the flatpak to extract the extra data files we
created. This script runs with very little filesystem acces, but it
does have write permissions to the location that will eventually be
/app/extra in the finished flatpak. This is especially problematic for
the systemwide install case, because the script is then run as root,
so it could potentially create a setuid file there.

Such a file would not be usable inside the sandbox (because setuid is
disabled in the sandbox), but it could potentially be a problem if the
user could be tricked into running the file directly on the host. This
is the same behaviour as e.g. rpm or deb which both can install setuid
files, but we want to guarantee that flatpak is better than that.

The fix is to run the script with all capabilities dropped (bwrap
--cap-drop ALL) which removes a bunch of possible attack vectors (for
instance setting file capabilities). However, even without
capabilities, it is possible for a user to make any file setuid to the
same user, so we also need to canonicalize the permissions of all
files generated by running the script.

Additionally, while running the script we set the toplevel directory
only be accessible to the user, meaning we will not temporarily leak
any potential setuid files to other users.

Note, this commit actually goes furthen than that and completely
canonicalizes all the file permissions to be the same as those
otherwise used by flatpak. For example we fix up cases where the
script creates files writable or unreadable by non-root users.

Closes: #2323
Approved by: alexlarsson

(cherry picked from commit 35598f46a5)
2018-11-16 11:37:42 +01:00
Alexander Larsson
4e257beab0 dir: Match pre-existing remotes better wrt collection-id
If you have a pre-existing remote configured its exact definition
might differ from the one specified in a flatpakrepo file and yet
be the same.

For example, i have:

$ flatpak --user remotes -d
Name      Title      URL                            Collection ID          Priority Options
flathub   Flathub    https://dl.flathub.org/repo/   org.flathub.Stable     1

Yet when i install a flatpakref:

$ flatpak --user install http://flathub.org/repo/appstream/org.gnome.gedit.flatpakref
The application org.gnome.gedit depends on runtimes from:
  https://dl.flathub.org/repo/
Configure this as new remote 'flathub-1' [y/n]:

Because the flathub flatpakrepo does not yet have the collection id specified.

So, we need to be more lenient when matching the pre-configured remotes.

Closes: #2324
Approved by: alexlarsson

(cherry picked from commit 1ce0246b0d)
2018-11-16 11:34:07 +01:00
Matthew Leeds
269796028c Add a DeployCollectionID key to replace CollectionID
This commit adds a key called DeployCollectionID to the flatpakref and
flatpakrepo file formats, which is intended to replace the CollectionID
key (which is still supported but deprecated). The reason for the change
is the same as for the metadata key change from xa.collection-id to
ostree.deploy-collection-id, which is that old versions of Flatpak
(roughly 0.9.8 through 1.0.1 depending on compile time options) hit
various bugs when collection IDs are in use. Flathub will soon enable
the metadata key to deploy collection IDs, and this change means Flathub
can also deploy the collection ID in flatpakref and flatpakrepo files
without affecting old clients.

Adding DeployCollectionID to the flatpakref and flatpakrepo files will
mean the flathub remote can be automatically configured with a
collection ID without depending on the metadata key to do that.

Closes: #2329
Approved by: alexlarsson

(cherry picked from commit 348fcc3f97)
2018-11-16 11:32:33 +01:00
Alexander Larsson
89a7da60a2 Update pofiles 1.0.5 2018-11-12 15:58:59 +01:00
Alexander Larsson
79ab638f63 Bump version to 1.0.5 2018-11-12 15:47:07 +01:00
Alexander Larsson
773ce65366 Update NEWS for release 2018-11-12 15:46:59 +01:00
Alexander Larsson
787aae0c83 Make per-app generated files read-only
We generate various configuration files for each sandbox instance,
and expose them to the sandbox using flatpak_bwrap_add_args_data,
which in the end passed --bind-data to bwrap. These files are not
sensitive or shared, but it still doesn't really make sense for
the sandbox to allow them to be modified, so lets switch them
to --ro-bind-data.

This affects these files in the sandbox:

 $HOME/.var/app/$APPID/config/user-dirs.dirs
 /etc/group
 /etc/ld.so.conf
 /etc/passwd
 /etc/pkcs11/modules/p11-kit-trust.module
 /etc/pkcs11/pkcs11.conf
 /etc/timezone
 /run/flatpak/ld.so.conf.d/*.conf
 /run/user/$UID/pulse/config
 /run/user/$UID/Xauthority

(cherry picked from commit a71f6ef13b)
2018-11-12 15:38:05 +01:00
Alexander Larsson
613fcfee5c Don't allow writes to runtime files in /etc
We mistakenly bind-mounted the runtime /usr/etc files read-write in
/etc, which means that application could modify some parts of the
runtimes (at least when using a per-user installed runtime). Fix
this by using a --ro-bind.

(cherry picked from commit 08e47e9544)
2018-11-12 15:38:05 +01:00
Alexander Larsson
2645aa80f1 run: Make repos optional (again)
If some installation is empty (or otherwise broken) we fail the
entire run command, even though the app might exist in e.g. the
user installation. This is a regression from
651c86d3c6 which also ended up in 1.0.4.
2018-11-12 15:38:05 +01:00
Matthias Clasen
93f98ffa21 Merge pull request #2278 from piotrdrag/pl-update-181028
Update Polish translation 181028
2018-10-30 13:47:09 -04:00
Piotr Drąg
41c127259c Update Polish translation
Closes: #2278
Approved by: matthiasclasen
2018-10-29 12:24:43 +00:00
Piotr Drąg
ff63b3ddd9 Update Polish translation 2018-10-28 17:32:31 +01:00
Matthias Clasen
3ff95539ca transaction: Improve the docs
Explain that it is possible to install from a
local repo by passing the location.

Closes: #2245
Approved by: alexlarsson

Closes: #2247
Approved by: alexlarsson
2018-10-19 11:01:20 +00:00
Matthias Clasen
743a51b88f transaction: Don't call g_object_ref on a GBytes
This won't go well.

Spotted while writing tests.

Closes: #2245
Approved by: alexlarsson

Closes: #2247
Approved by: alexlarsson
2018-10-19 11:01:20 +00:00
Matthias Clasen
cc5dd79b09 remote: Be robust against bad names
If we use a remote name containing questionable characters
such as newlines or '[', we will run into assertions in
GKeyFile. To avoid that, check that the group name we
pass is valid, and throw an error otherwise.

Found while writing tests.

Closes: #2244
Approved by: alexlarsson

Closes: #2247
Approved by: alexlarsson
2018-10-19 11:01:20 +00:00
Alexander Larsson
847902c303 Update pofiles 1.0.4 2018-10-12 11:26:21 +02:00
Alexander Larsson
0d7da9cffa Update NEWS 2018-10-12 11:21:51 +02:00
Matthew Leeds
619cd08235 common: Reload FlatpakRemoteState after changes
Some remote metadata can cause changes to the local configuration for a
remote, but Flatpak is not properly reloading the new config after
making changes. Specifically in flatpak_transaction_update_metadata() we
call flatpak_dir_update_remote_configuration() for each remote and then
try to reload the configuration by calling flatpak_dir_recreate_repo().
The problem is that while this reloads the config instance stored by the
repo member of the FlatpakDir, the FlatpakTransaction object still has
FlatpakRemoteState objects stored which were initialized from the old
config.

A consequence of this is that if a remote repository has the
"ostree.deploy-collection-id" key set in its metadata, the next
install/update operation from that remote will fail with the error
message "Can't pull from untrusted non-gpg verified remote", and then
subsequent operations will succeed. This is because during the first
operation Flatpak will add the collection ID to the local configuration
in flatpak_transaction_update_metadata() but then in
flatpak_dir_install() the outdated FlatpakRemoteState object will be
used which still has no collection ID.

So this commit frees all the stored FlatpakRemoteState objects on the
transaction, so they will be recreated when they're needed (based on the
new config).

Closes: #2243
Approved by: alexlarsson

(cherry picked from commit ce78f52fcc)
2018-10-12 11:20:41 +02:00
Alexander Larsson
2568bd196f Update NEWS for release 2018-10-12 10:50:33 +02:00
Matthias Clasen
bb979eb867 installation: Don't return freed memory
flatpak_installation_load_app_overrides was returning
freed memory. Oops.

Closes: #2239
Approved by: alexlarsson

(cherry picked from commit fd282a1ab8)
2018-10-12 10:07:32 +02:00
Matthew Leeds
35a4efcb0b common: Don't seg fault if a ref doesn't exist
Currently, if flatpak_installed_ref_get_latest_commit() returns NULL
(which means the ref doesn't exist in the local repo) we assume any
remote commit could be an update in
flatpak_installation_list_installed_refs_for_update() when a collection
ID is not configured on the remote. When a collection ID is configured,
if get_latest_commit() returns NULL it causes a crash in
ostree_repo_load_commit(). So this commit prevents the crash and makes
the behavior in the post-collection-id world consistent with the
behavior in the pre-collection-id world.

It's difficult to write a test for this that's not contrived, without
knowing what circumstances led to the disappearance of the ref from the
repo.

Fixes https://github.com/flatpak/flatpak/issues/2216

Closes: #2229
Approved by: alexlarsson

(cherry picked from commit 6b4402b60e)
2018-10-12 10:07:32 +02:00
Patrick Griffis
9ced088fb5 Implicity grant MPRIS2 permissions
This should be safe to expose without requiring everybody request
it.

Closes: #2226
Approved by: alexlarsson

(cherry picked from commit d6e51ede6d)
2018-10-12 10:07:32 +02:00
Matthias Clasen
f539213a34 dir: Return FALSE when setting an error
This is expected behavior.

(cherry picked from commit e9f2d11f4a)
2018-10-12 10:07:32 +02:00
Alexander Larsson
af7e3f02aa build-finish: Inherit permissions from runtime by default
In version 0.99.1 (065053775b) flatpak
stopped inheriting permissions from the runtime, because that made
the story about application permissions way to complicated. What
we want is to have a static set of permissions for the app that
is frozen at install time.

However, inheriting permissions from the runtime makes a lot of sense
as certain permissions are required from the runtime, in particular this
is used by the kde runtime to read the kdeglobals file, etc.

So, to combine the best of the two worlds, we now do inherit permissions,
but at build-time (and you can disable it if you want). This way
kde apps don't have to repeat themselves, but we still get static
application permissions.

Closes: #2230
Approved by: alexlarsson

(cherry picked from commit 99fbbc25c6)
2018-10-12 10:07:32 +02:00
Alexander Larsson
f0a3f54dfa sandbox: Expose /etc/timezone
This exposes a /etc/timezone with the current timezone, as per the old
debian spec: https://wiki.debian.org/TimeZoneChanges

In case we're using the session-helper this will be extracted from
the host config and applied whenever that changes.

Normally timezone info is specified by /etc/localtime being a symlink
into the locale data, and you can look at the symlink value itself.
However, in the sandbox we can't update a symlink in /etc at runtime,
nor can we make it of the canonical form as that would point into the
runtime. This is why /etc/timezone is used.

This fixes https://github.com/flatpak/flatpak/issues/2190

Closes: #2214
Approved by: alexlarsson

(cherry picked from commit 0b6844f39e)
2018-10-12 10:07:32 +02:00
Alexander Larsson
ae03bb49ac utils: Add flatpak_get_timezone()
This extracts the timezone from the symlink in /etc/localtime as
specified in e.g.
  https://www.freedesktop.org/software/systemd/man/localtime.html

If this doesn't exist, or is not a symlink, then it uses the old
debian /etc/timezone as specified in
  https://wiki.debian.org/TimeZoneChanges

If nothing else works it falls back to UTC.

Closes: #2214
Approved by: alexlarsson

(cherry picked from commit 6dec266189)
2018-10-12 10:07:32 +02:00
Matthias Clasen
6ddf772e97 Include the icon in the tarball
This makes it easier for third-party tools who want
to have an icon to use for flatpak.

Closes: #1344
(cherry picked from commit 1afa70e54d)
2018-10-12 10:07:32 +02:00
Matthias Clasen
6c6a0c251e remote: Save nodeps
flatpak_installation_modify_remote was not saving the nodeps
state. Found while writing FlatpakTransaction tests.

Closes: #2198
Approved by: alexlarsson

(cherry picked from commit de56d34104)
2018-10-12 10:07:32 +02:00
Matthias Clasen
f1c6a6bfe8 transaction: Fix a crash in an error path
This was found while writing transaction tests.
We were passing error, but trying to use the local_error
message.

Closes: #2198
Approved by: alexlarsson

(cherry picked from commit adf896d794)
2018-10-12 10:07:32 +02:00
Matthias Clasen
a73ee1d7ec transaction: Fix up a signal signature
We were emitting the ::operation-done signal with
different arguments than declared for the signal.
This showed up as test failure when comparing
the result argument.

Closes: #2187
Approved by: alexlarsson

(cherry picked from commit 3f0eb7e481)
2018-10-12 10:07:32 +02:00
Alexander Larsson
55126111a9 Post-relase version bump to 1.0.4 2018-10-12 10:07:32 +02:00
Matthias Clasen
f8daed11f3 Merge pull request #2210 from piotrdrag/pl-update-181007
Update Polish translation 181007
2018-10-07 19:33:25 -04:00
Piotr Drąg
ed9bf60e02 Update Polish translation 2018-10-08 00:33:53 +02:00
Alexander Larsson
b6a8cab35f Update pofiles 1.0.3 2018-10-04 14:54:32 +02:00
Alexander Larsson
651785c974 tests: Don't dist the .wrap files (as they don't exist) 2018-10-04 11:22:50 +02:00
Alexander Larsson
1196ff54bf Update version to 1.0.3 2018-10-04 11:08:16 +02:00
Alexander Larsson
eb5ffeab77 Update NEWS for 1.0.3 2018-10-04 11:08:05 +02:00
Alexander Larsson
a94eea8cc7 build-update-repo: Add appstream2 to the metadata cache
The old "appstream" is there already, and this allows us to get
things like download size info for it.

Closes: #2182
Approved by: alexlarsson
2018-10-04 06:58:23 +00:00
Alexander Larsson
35b92d7237 Support --allow=canbus for AF_CAN access
This fixes https://github.com/flatpak/flatpak/issues/2176

Closes: #2179
Approved by: alexlarsson
2018-10-03 14:31:30 +00:00
Kalev Lember
1a827c0469 transaction: Return G_IO_ERROR_CANCELLED when cancelled
Instead of FLATPAK_ERROR_ABORTED, return G_IO_ERROR_CANCELLED when the
passed in GCancellable gets cancelled. This makes it possible to cancel
updates in gnome-software without getting a generic "Aborted due to
failure" error popup.

Closes: #2178
Approved by: alexlarsson
2018-10-03 13:56:49 +00:00
Alexander Larsson
89e2b6679c Don't expose host /dev/shm with --device=all (fixing debian problems)
--device=all really means the device nodes, we should not expose the host
shared memory objects.

This change incidentally fixes issues with --device=all on debian (#2136)
where /dev/shm is a symlink to /run/shm, which doesn't exist in the sandbox.

Closes: #2160
Approved by: alexlarsson
2018-10-03 13:56:44 +00:00