Commit Graph

6467 Commits

Author SHA1 Message Date
Simon McVittie
2b6d192434 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-03-15 11:19:22 +00:00
Simon McVittie
f1dd7d6076 build: Accept gpgme >= 1.8.0 as equivalent to gpgme-pthread
Before 1.8.0 (2016), gpgme used to have two different thread-safe builds,
one for use with POSIX-style pthread and one for use with GNU Portable
Threads (libpth), plus a non-thread-safe version. Since 1.8.0, this
complexity has gone away and there is only libgpgme, which is thread-safe.

In practice this meant that on modern distros since 2016, we would always
fail to detect gpgme via pkg-config and fall back to calling gpgme-config.

Library-specific -config scripts are generally considered problematic
for multiarch, multilib and cross-compiling, and the gpgme-config script
recently disappeared from GPGME's Debian packaging
(see https://bugs.debian.org/1022348 and https://bugs.debian.org/1023601),
so it's better if we can prefer to use pkg-config.

If gpgme >= 1.8.0 is not found, fall back to gpgme-pthread >= 1.1.8,
either discovered via pkg-config or via gpgme-config.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 9b87e4c0d4)
(cherry picked from commit c8f3f0dc1a)
2023-03-15 11:18:57 +00:00
Philip Withnall
8faaca8bdf flatpak-dir: Clean up temp deploy dir on failure of flatpak_dir_deploy()
This already happens for installs due to the cleanup path in
`flatpak_dir_deploy_install()`, but it doesn’t happen for other calls to
`flatpak_dir_deploy()`. Notably, during updates of already installed
apps.

Specifically, this means that if an app update is cancelled due to being
blocked by a parental controls policy, the temp deploy dir for that app
(such as
`~/.local/share/flatpak/app/com.corp.App/x86_64/stable/.somehex-XXXXXX`)
will be leaked. It will never be automatically cleaned up, as it’s not
in `/var/tmp` either.

Fix that by using `glnx_mkdtempat()` to create a scoped temporary
directory.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
(cherry picked from commit 85a83a06f9 with
minor conflicts)
2022-11-10 12:45:08 +00:00
Simon McVittie
40fcf41c6c Update NEWS so far for 1.10.8
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-09 16:46:14 +00:00
Simon McVittie
b557787d18 NEWS: Correct release date 2022-02-09 16:35:25 +00:00
Phaedrus Leeds
25b354cb65 test-history.sh: Fix flakiness by moving sleep
The history test fails sometimes in the CI due to the remote add
operation being missing from the history command's output:

+ diff history-log -
0a1
> add remote			system (history-installation)	test-repo

Presumably this is due to that operation happening in the same second
that is passed to --since, so move the sleep statement to make sure a
second passes before we do anything.

(cherry picked from commit 417e3949c0)
2022-02-08 18:57:25 +00:00
Phaedrus Leeds
0059e2596b app: Don't use polkit agent in history command
There's no need to use polkit in the history command, so don't start the
agent in flatpak-main.c. This means we can avoid a test failure in
test-history.sh which was caused by old versions of valgrind being
unaware of syscall sched_getattr, which is used in g_bus_get_sync(),
itself called by install_polkit_agent().

(cherry picked from commit e6702161da)
2022-02-08 18:57:25 +00:00
Phaedrus Leeds
96468b0909 Add a unit test for the history command
(cherry picked from commit 8b05f6b365)
2022-02-08 18:57:25 +00:00
Phaedrus Leeds
caae698495 history: Fix exclusion of temp repos
Without this change there are history entries showing pulls into
temporary repos which we don't want.

(cherry picked from commit 2f13aabad6)
2022-02-08 18:57:25 +00:00
Phaedrus Leeds
5e4e8c6e4b history: Omit entries for appstream refs
Currently we include entries in the output of the history command for
pulls of appstream refs, e.g. "appstream2/x86_64". However since they
don't have an application ID the Application column shows up blank and
it seems like a pull of nothing which is confusing. These are basically
an implementation detail like the temp repo pulls we already exclude, so
I think it makes sense to exclude them from the output.

It would also make sense to exclude pulls of ostree-metadata refs, but
for some reason I don't see those in practice, even with a collection ID
set on the remote.

(cherry picked from commit 72aef63c58)
2022-02-08 18:57:25 +00:00
Phaedrus Leeds
9c354072e8 history: Fix printing refs
The history command seems to have been broken since it was changed to
use FlatpakDecomposed, since that type only works for app or runtime
refs, resulting in errors such as:
$ flatpak history
error: appstream2/x86_64 is not application or runtime

Fix this by making the logic a bit smarter, and don't let any one
invalid ref entry prevent the whole command from working.

Fixes #4332

(cherry picked from commit 7b6dba8803)
2022-02-08 18:57:25 +00:00
malbx
486ff371e2 history: Handle transaction log entry with empty REF field
This checks that the value of the REF field is not an empty string
before calling `flatpak_decomposed_new_from_ref`.  Attempting to
decompose an empty string leads to a validation error and prevents
any history from being printed.

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

(cherry picked from commit 0a9253f7d9)
2022-02-08 18:57:25 +00:00
Piotr Drąg
0ca7693d89 Update Polish translation 2022-02-05 09:06:22 -08:00
Simon McVittie
e50a8fd4c9 Update translation files for release
Signed-off-by: Simon McVittie <smcv@collabora.com>
1.10.7
2022-01-18 18:46:24 +00:00
Simon McVittie
fda8064e0b Prepare v1.10.7
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-01-18 17:34:26 +00:00
Simon McVittie
b2307ad095 NEWS: Describe what is intended to appear in 1.10.7
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-01-18 16:36:16 +00:00
Simon McVittie
9966e42a18 NEWS: Mention CVE-2022-21682
At the time we wrote the NEWS for 1.10.6, this CVE ID had not yet been
issued.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-01-18 16:36:16 +00:00
Simon McVittie
2c89fc3ef3 test-override: Exercise --nofilesystem=host:reset
Signed-off-by: Simon McVittie <smcv@collabora.com>
Co-authored-by: Alexander Larsson <alexl@redhat.com>
(cherry picked from commit 4aa70d2d72)
2022-01-18 16:36:16 +00:00
Simon McVittie
4206d681c5 test-context: Exercise some corner cases for merging filesystems
Signed-off-by: Simon McVittie <smcv@collabora.com>
Co-authored-by: Alexander Larsson <alexl@redhat.com>
(cherry picked from commit fab0f8ed7c)
[smcv: Also backport the scaffolding to create this test-case]
2022-01-18 16:36:16 +00:00
Simon McVittie
d2128c5418 test-exports: Exercise host:reset and related filesystem tokens
Signed-off-by: Simon McVittie <smcv@collabora.com>
Co-authored-by: Alexander Larsson <alexl@redhat.com>
(cherry picked from commit f3d12dc793)
2022-01-18 16:36:16 +00:00
Simon McVittie
92b8cfe46b context: Introduce new --nofilesystem=host:reset
This reintroduces the special case that existed in Flatpak 1.12.3, but
under a different name, so that it will be backwards-compatible. With
this change, flatpak-builder will be able to resolve CVE-2022-21682 by
using --filesystem=host:reset.

We want to implement this as a suffix rather than as a new keyword,
because unknown suffixes are ignored with a warning, rather than causing
a fatal error. This means that the new version of flatpak-builder will
be able to run against older versions of flatpak: it will still be
vulnerable to CVE-2022-21682 in that situation, but at least it will run.

Co-authored-by: Alexander Larsson <alexl@redhat.com>
(cherry picked from commit 5709f1aaed)
2022-01-18 16:36:16 +00:00
Simon McVittie
b543933ce1 test-override: Assert that --nofilesystem with suffix yields a warning
This was added as part of implementing the :reset suffix.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit ab0169ee39)
2022-01-18 16:36:16 +00:00
Simon McVittie
734047a1d7 test-override: Assert pre-1.12.3 behaviour of --nofilesystem=home, host
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 813e1f0b3b)
2022-01-18 16:36:16 +00:00
Simon McVittie
fe3954ff63 run, override: Clarify the effect of --nofilesystem
There are two reasonable interpretations for --nofilesystem=home:
either it revokes a previous --filesystem=home (as in Flatpak 1.12.2 and
older versions), or it completely forbids access to the home directory
(as in Flatpak 1.12.3). Clarify the man pages to indicate that it only
revokes a previous --filesystem=home. This will hopefully reduce
mismatches between the design and what users expect to happen, as
in flatpak#4654.

A subsequent commit will introduce a way to get the Flatpak 1.12.3
behaviour in a way that is more backwards-compatible with Flatpak 1.12.2
and older versions.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 7bbeed2b87)
2022-01-18 16:36:16 +00:00
Simon McVittie
ed91bba615 Revert "Make --nofilesystem=host/home remove access to subdirs of those"
This caused regressions for some previously-working use cases. For
example, some Flatpak users previously used a global
`flatpak override --nofilesystem=home` or
`flatpak override --nofilesystem=host`, but expected that individual apps
would still be able to have finer-grained filesystem access granted by the
app manifest, such as Zoom's `--filesystem=~/Documents/Zoom:create`. With
the changes in 1.12.3, this no longer has the desired result, because
`--nofilesystem=home` was special-cased to disallow inheriting the
finer-grained `--filesystem`.

This reverts commit 445bddeee6.

This reverts the initial solution to CVE-2022-21682, which we intend to
resolve differently, by introducing a new feature in Flatpak and making
use of it in a new flatpak-builder version.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 917a7f5870)
2022-01-18 16:36:16 +00:00
Simon McVittie
da5ae83cfa Revert "manpages: Document the new details of --nofilesystem behaviour."
The new behaviour caused regressions in some situations that previously
worked, and will be reverted.

This reverts commit 4d11f77aa7.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit dfe868d628)
2022-01-18 16:36:16 +00:00
Simon McVittie
97dd26c02e test-override: Assert that unimplemented suffix is ignored with a warning
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 8a44df04c8)
2022-01-18 01:18:08 +00:00
Simon McVittie
74f02d1e95 test-override: Assert that only the expected term is negated
We weren't distinguishing here between overrides that should have been
negated (xdg-documents) and overrides that should not have been negated
(everything else).

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 4e3d1d8b7b)
2022-01-18 01:18:08 +00:00
Phaedrus Leeds
1dbc175314 Update variant-schema-compiler to fix build
This works with newer versions of pyparsing, while producing generated
files common/flatpak-variant{,-impl}-private.h identical to those produced
by the old variant-schema-compiler when using the pyparsing versions in
Debian 10 and Debian 11. Backporting this commit allows older branches
to be CI-tested successfully.

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

(cherry picked from commit 6cb4a2598e)
(cherry picked from commit a0d8a1dcf3)
[smcv: verified that this has no effect with older pyparsing versions]
2022-01-17 18:49:10 +00:00
Simon McVittie
eb324b9d82 test-metadata-validation.sh: Ensure that mtimes change between iterations
Our old adversary, 1-second timestamp resolution, strikes again!

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-01-12 13:58:17 -08:00
Alexander Larsson
17cc9937ca Update pofiles for release 1.10.6 2022-01-12 15:37:16 +01:00
Alexander Larsson
1fc1c031df Bump version to 1.10.6 2022-01-12 15:08:49 +01:00
Alexander Larsson
8270f8c639 Update NEWS for release 2022-01-12 15:07:09 +01:00
Alexander Larsson
0ceb8eb9ec manpages: Document the new details of --nofilesystem behaviour.
(cherry picked from commit da3e12b319094158c2afa3df380bc45a7626928c)
2022-01-12 14:54:45 +01:00
Alexander Larsson
307ee18dd6 Make --nofilesystem=host/home remove access to subdirs of those
Previously --nofilesystem=host only removed specifically access to the
`host` permissions, and not necessarily other filesystems (like `home`
or `/some/path`). This isn't very useful to limit access because you
don't know what other filesystems the app may have access too.

We change this to mean that `--nofilesystem=host` removes *all* filesystem
access from the parent layer, and `--nofilesystem=home` removes all
file access to the homedir and paths inside it.

The available layers are, in order:

 * app permissions
 * overrides
 * commandline args

This allows you to start from scratch with the filesystem permissions
in the overrides or the commandline. This is a small change in
behaviour, but not a lot of things use --nofilesystem, and the ones
that do probably expects this behaviour.

(cherry picked from commit e2c8863fb62301cb05c64bbb32b04446e88ce11a)
2022-01-12 14:54:40 +01:00
Phaedrus Leeds
ce0bb56c6f Add test for metadata validation
This tests for invalid metadata, missing xa.metadata and mismatched
values in xa.metadata and the real metadata, including the embedded
null leading to the hidden permissions of CVE-2021-43860.

(cherry picked from commit 2c2ce58c54b3e6c62f9c21c15efa0ba22f4bc09b)
2022-01-12 14:53:57 +01:00
Alexander Larsson
574cb11372 Ensure that bundles have metadata on install
If we have a bundle without metadata we wouldn't properly present
the permissions in the transaction.

(cherry picked from commit b250541302187ff2209b0bb1295e8223d0af860f)
2022-01-12 14:53:50 +01:00
Alexander Larsson
bd6948c375 Require metadata in commit also for OCI remotes
This was disables a long time ago because the fedora remotes didn't
contain metadata, but that has been added since then. Requiring fixes
a security concern where an app claims to require no permissions (by
having no metadata in commit) but then actually requires permissions
in the installed app.

(cherry picked from commit f0f3a35f404b5bd533186095db055f8b3d135576)
2022-01-12 14:53:26 +01:00
Alexander Larsson
10367bd7d2 Transaction: Fail the resolve if xa.metadata invalid or missing
If we fail to parse xa.metadata from the summary cache or the commit
xa.metadata we fail the resolve.

If xa.metadata is missing in the commit we fail the resolve (it is
always set in the summary cache, because summary update converts
missing xa.metadata to "", so we either get that, or cache miss which
leads to resolving from the commit.

This means that op->resolved_metadata is always set during install and
updates, which means we will show the app permissions. The transaction
will also always make sure that this data actually matches what gets
deployed.

Before this change an invalid metadata in the summary cache could lead
to a NULL resolved_metadata, which means we wouldn't print the app
permissions, yet we would still deploy some metadata file that could
have permissions. (NOTE: It would fail to deploy unless the
xa.metadata in the commit matched the metadata file, but in this
corner case we would't compare the summary and commit metadata, so
they may differ.)

(cherry picked from commit 5036bca4214d5b77e884dec42e36496a06e74081)
2022-01-12 14:51:10 +01:00
Ryan Gonzalez
3c3dc554e7 Fix metadata file contents after null terminators being ignored
In particular, if a null terminator is placed inside the metadata file,
Flatpak will only compare the text *before* it to the value of
xa.metadata, but the full file will be parsed when permissions are set
at runtime. This means that any app can include a null terminator in its
permissions metadata, and Flatpak will only show the user the
permissions *preceding* the terminator during install, but the
permissions *after* the terminator are applied at runtime.

Fixes GHSA-qpjc-vq3c-572j / CVE-2021-43860

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
(cherry picked from commit c9c3a667c09a846c0b230cf1cc8ed330028aa03c)
2022-01-12 14:07:46 +01:00
Phaedrus Leeds
23ce2b1bc6 NEWS: Fix typo in 1.10.4 notes 2021-10-12 20:43:39 +01:00
Simon McVittie
083730f59b Write NEWS so far for 1.10.6
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-10-12 20:43:39 +01:00
Simon McVittie
0717aa5535 NEWS: Clarify what was fixed in 1.12.1 and 1.10.5
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-10-12 20:43:39 +01:00
Simon McVittie
ee4a9c4e1c NEWS: Mention CVE-2021-41133
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit ff0c48c780)
2021-10-12 20:43:39 +01:00
Simon McVittie
7ea10dc919 run: Improve error handling/diagnostics for calls into libseccomp
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 53bde36585)
(cherry picked from commit bd2c58fc27)
2021-10-12 20:43:39 +01:00
Simon McVittie
2448522422 Fix handling of syscalls only allowed by --devel
This was incorrectly looking at errno instead of -r.

Fixes: 0b38b0f0 "run: Handle unknown syscalls as intended"
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 3fc8c67267)
(cherry picked from commit 97e128c2c1)
2021-10-12 20:43:39 +01:00
Piotr Drąg
e4a3969dd2 Update Polish translation 2021-10-11 09:45:07 +02:00
Alexander Larsson
c88587af73 Update pofiles 1.10.5 2021-10-08 19:26:20 +02:00
Alexander Larsson
4da2ec4923 Bump version to 1.10.5 2021-10-08 19:18:19 +02:00
Alexander Larsson
878d0d5a82 Update NEWS for 1.10.5 2021-10-08 19:18:08 +02:00