Commit Graph

7211 Commits

Author SHA1 Message Date
Dan Nicholson
776f89a879 run: Ensure container environment variable is used
If flatpak is run within a container manager that sets the `container`
environment variable, it will override the attempted `flatpak` value.

(cherry picked from commit 9e58442804)
2024-04-24 18:20:07 +01:00
Dan Nicholson
52b7e384a5 run: Ignore system bus failures in parental controls check
Currently if the parental controls check can't connect to the system
bus, apps are not allowed to run. However, apps are also allowed to run
if the malcontent (or accounts-service) D-Bus services aren't available.
Since it's trivial to meet that requirement by starting a temporary
dbus-daemon and setting `DBUS_SYSTEM_BUS_ADDRESS` to use it, not being
able to access the system bus at all is no less secure.

This primarily affects flatpak running in a container where D-Bus is
generally not available.

Fixes: #5076
(cherry picked from commit 3afdfd298b)
2024-04-24 18:20:07 +01:00
Dan Nicholson
45b05d1c79 tests: Skip more tests when FUSE isn't available
These tests try to install flatpaks, which fails in the system case when
FUSE isn't available to mount revokefs-fuse.

(cherry picked from commit 65bc369a9f)
2024-04-24 18:20:07 +01:00
Alice Mikhaylenko
27fceff554 dir: Fix glib criticals
(cherry picked from commit 1a5fd13ca5)
2024-04-24 18:20:07 +01:00
Simon McVittie
8a6545e1c9 tests: Fix a double-free when exercising argument parsing
g_option_context_add_group() takes ownership of the group that it's
given, so we can't also free it.

Fixes: fab0f8ed "test-context: Exercise some corner cases for merging filesystems"
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 80c1fc5f78)
2024-04-24 18:20:07 +01:00
Simon McVittie
1e4f3adaec Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-04-24 18:19:14 +01:00
Daniel Stone
020d279397 run: Unset more Vulkan layer/driver paths
Following on from b8d8d80c61, add more environment variables used by
the Vulkan loader which expect paths to be provided.

These paths are typically referencing the host filesystem; if the user
is referencing paths only available in the sandbox, they can use --env
or overrides for them.

Signed-off-by: Daniel Stone <daniels@collabora.com>
(cherry picked from commit 18b85083b9)
2024-04-24 18:15:15 +01:00
Daniel Stone
77a7933124 run: Unset EGL driver paths
Similar to how b8d8d80c61 inhibited passthrough of environment
variables pointing the Vulkan loader towards a specific ICD, do the same
for the EGL paths used by libglvnd to discover the GL driver to use, as
well as for NVIDIA's EGLStream shim.

These paths are typically referencing the host filesystem; if the user
is referencing paths only available in the sandbox, they can use --env
or overrides for them.

Signed-off-by: Daniel Stone <daniels@collabora.com>
(cherry picked from commit 0f2661045d)
2024-04-24 18:15:06 +01:00
Patrick Griffis
e93a6a439a run: Don't inherit LD_PRELOAD/LD_AUDIT from the host
I don't think this env var makes much sense to pass into the sandbox
for similar reasons to LD_LIBRARY_PATH. Libraries from the host
just aren't relevant.

Users can still pass `--env=LD_PRELOAD=/foo` to use this functionality.

(cherry picked from commit abcc001da8)
2024-04-24 18:14:53 +01:00
Simon McVittie
510b30ade5 workflows: Disable Microsoft-specific apt repository
We don't need anything from here, and its secure-apt signing is
currently broken.

Workaround-for: https://github.com/orgs/community/discussions/120966
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit d828116a12)
2024-04-24 18:14:43 +01:00
Simon McVittie
b5ee7614f0 NEWS: Retroactively add 1.14.6 release date
The release was prepared under embargo and it wasn't immediately obvious
which day it was going to be released, so I left out the release date
at the time.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-04-19 11:06:03 +01:00
Simon McVittie
26948d65a9 tests: Fix a misleading comment
Arguably bwrap should exit with status 127 if it can't find the
executable, but right now it exits 1, so we accept any nonzero status.
The implementation was correct, but the comment was wrong.

Fixes: 84984e49 "test-run: Add a reproducer for CVE-2024-32462"
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 0982a4a93f)
2024-04-19 11:03:15 +01:00
Simon McVittie
02c9b5cb1d workflows: Remove confusing relic from Ubuntu 18.04
Before commits 97768cea and cb655ab3, we were upgrading GLib to a
post-Ubuntu-18.04 version before running tests, to work around a GLib
bug. We no longer need to do that now that we're running everything on
Ubuntu 20.04 or later.

Fixes: cb655ab3 "check.yml: remove glib260 ppa"
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 5114df1fcb)
(cherry picked from commit 19b5e1394e67642d5d350173db5dae13e1faccc2)
2024-04-18 20:09:29 +01:00
Simon McVittie
3e1de83085 Revert "CI: Add mono apt repo to fix build"
We added this entirely unrelated apt repo to make CI work, but in fact
it now makes CI fail.

This reverts commit b6d5e20857.

(cherry picked from commit d5f891e003)
2024-04-18 20:09:20 +01:00
Simon McVittie
3344a7a72f Update translation files for 1.14.6
Signed-off-by: Simon McVittie <smcv@collabora.com>
1.14.6
2024-04-17 19:21:14 +01:00
Simon McVittie
95168c73fe Prepare v1.14.6
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-04-17 18:28:27 +01:00
Simon McVittie
4dc55a80c8 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-04-17 18:13:14 +01:00
Simon McVittie
4fa5156efb test-run: Add a reproducer for CVE-2024-32462
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-04-17 18:12:30 +01:00
Alexander Larsson
b7c1a558e5 When starting non-static command using bwrap use "--"
This ensures that the command is not taken to be a bwrap option.

Resolves: CVE-2024-32462
Resolves: GHSA-phv6-cpc2-2fgj
Signed-off-by: Alexander Larsson <alexl@redhat.com>
[smcv: Fix DISABLE_SANDBOXED_TRIGGERS code path]
[smcv: Make flatpak_run_maybe_start_dbus_proxy() more obviously correct]
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-04-17 18:12:01 +01:00
Simon McVittie
2a9a668fe8 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-03-15 18:26:04 +00:00
Chris Williams
bcf0480e94 tests: Check appdata name parsing via flatpak info
Add a basic test for the extraction of appdata name and summary values
that are displayed in the flatpak UI. Also use the new developer name
syntax in the test app. This tests the fix made in previous commit.
2024-03-12 08:32:30 -05:00
Chris Williams
2cba9e3db3 appdata: exclude <name> element inside <developer>
<developer_name> has been deprecated in favor of <developer> with a
<name> child. We need to ensure that this developer name isn't parsed
as the application name.

Fixes: #5700
2024-03-12 08:32:21 -05:00
Simon McVittie
17455f97fc Automated update of translation files for 1.14.5
Signed-off-by: Simon McVittie <smcv@collabora.com>
1.14.5
2023-12-08 12:16:10 +00:00
Simon McVittie
c68219cd71 Prepare v1.14.5
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-12-08 12:15:18 +00:00
Simon McVittie
bfa9d0fff8 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-11-14 21:36:56 +00:00
Simon McVittie
4870e6ad03 portal, session-helper: Save original environment and use it for child
Otherwise, the child process will inherit GIO_USE_VFS=local, breaking
its ability to use GVfs and other GIO plugin interfaces.

Resolves: https://github.com/flatpak/flatpak/issues/5567
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 6e7eb1e19a)
2023-11-14 21:33:37 +00:00
Alberto Garcia
3ac2d5278e data: Remove all /var/tmp/flatpak-cache-* directories on boot
No one is clearing those directories so they pile up and can take a
significant amount of disk space.

Resolves: https://github.com/flatpak/flatpak/issues/1119
Signed-off-by: Alberto Garcia <berto@igalia.com>
(cherry picked from commit 14d735bfda)
2023-11-14 21:32:43 +00:00
bbhtt
1352613380 Make flatpak-metadata sections linkable
(cherry picked from commit ec3989def6)
2023-11-14 21:32:25 +00:00
bbhtt
53a4717828 Clarify that an app can own its app-id as subname of MPRIS bus
(cherry picked from commit c8e7b8df5c)
2023-11-14 21:32:21 +00:00
Matthias Klumpp
acec767157 Adjust to AppStream 1.0 API changes
(cherry picked from commit c0c466f269)
2023-11-14 21:31:53 +00:00
Steveice10
8607ee7ad0 flatpak-run: Unset VK_DRIVER_FILES and VK_ICD_FILENAMES
These environment variables inform the Vulkan loader on where to find driver files.
Since they typically point to locations on the host filesystem, any application that
attempts to load Vulkan within the flatpak sandbox would break with these set.

(cherry picked from commit b8d8d80c61)
2023-11-14 21:31:40 +00:00
Georges Basile Stavracas Neto
595b4f1f4c tests: Check if program exists before using it
The tests/make-test-runtime.sh scripts sets '-e' in lieu of
implementing useful error checking, but doesn't actually check
if the programs it uses exist in the first place; and aborts
silently when they're not available.

It is more useful to warn about them, and stop execution earlier.
This leaves some leftover files, but arguably that's better than
leaving leftover files AND people scratching their heads.

Warn about missing required programs.

Related: https://github.com/flatpak/flatpak/issues/5020
(cherry picked from commit 6a57fa42e4)
2023-11-14 21:31:34 +00:00
Timo Eisenmann
6fc12bfaa7 remote-info: Fix call to flatpak_dir_load_appstream_store()
Use architecture instead of id in call to
flatpak_dir_load_appstream_store ().

Without this, remote-info does not show AppStream metadata.

Fixes: adb3b61f "decomposed: Return FlatpakDecomposed from flatpak_dir_find_remote_ref()"
(cherry picked from commit 02bef871c0)
2023-11-14 21:31:13 +00:00
Philip Withnall
64da41f2b5 utils-http: Add transfer speed timeout for libcurl HTTP downloads
There was already a timeout set using `CURLOPT_CONNECTTIMEOUT`, but that
only affects the initial connection. Once a HTTP connection is
established, the timeout is ineffective.

That means that once a HTTP connection is established, there is no bound
on the length of time a download can take. Sometimes, downloads drop to
very low speeds (for Networking Reasons) and we need a way to give up on
a download if that happens.

So, set a low speed limit of 10KB/s for 60s. If a curl download goes
more slowly than this, it will be considered timed out, and the
`CURLE_OPERATION_TIMEDOUT` code path will be taken.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: https://github.com/flatpak/flatpak/issues/5519
(cherry picked from commit d6b10c26ef)
2023-11-14 21:31:02 +00:00
Simon McVittie
419e784e5e app: Use AS_FORMAT_STYLE_CATALOG if available
AS_FORMAT_STYLE_COLLECTION is a deprecated alias for ..._CATALOG, and
was removed entirely in appstream git main (presumably version 0.17
or 1.0).

Resolves: https://github.com/flatpak/flatpak/issues/5472
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 7a55b7c49f)
2023-11-14 21:29:56 +00:00
Simon McVittie
8434abaedf app: Provide a stub implementation of AS_CHECK_VERSION if needed
Our only code that is conditional on the libappstream version wants
version 0.14.0, which conveniently is exactly the version that
introduced AS_CHECK_VERSION.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 556984e1c1)
2023-11-14 21:29:49 +00:00
Dan Nicholson
b6e376f6d1 revokefs: Always bypass page cache for backend requests
By default, FUSE runs in cached I/O mode[1]. That means some I/O
responses will be taken from the page cache instead of being handled by
the FUSE process. For files opened for reading that's not a problem as
all the requests are just passed through.

However, that is problematic for files opened for writing since those
requests need to be handled by the backend. It's particularly bad for a
file opened `O_RDWR` since `read` responses from the page cache are
likely to be wrong. Instruct FUSE to use `direct-io` for those files so
that the page cache is bypassed.

1. https://docs.kernel.org/filesystems/fuse-io.html

Fixes: #5452
(cherry picked from commit c4738f8005)
2023-11-14 21:29:06 +00:00
K.B.Dharun Krishna
99e44c10d9 check.yml: bump Ubuntu runner for valgrind
(cherry picked from commit 1cbff35386)
2023-11-14 21:28:33 +00:00
K.B.Dharun Krishna
ebd15e962e check.yml: bump actions/upload-artifacts to v3
(cherry picked from commit a98854b1a0)
2023-11-14 21:28:30 +00:00
K.B.Dharun Krishna
9c1938f68f check.yml: remove glib260 ppa
The required package is present in Ubuntu repos https://packages.ubuntu.com/focal/libglib2.0-dev

(cherry picked from commit cb655ab336)
2023-11-14 21:28:27 +00:00
K.B.Dharun Krishna
7c9bbb62e6 block-autosquash-commits.yml: bump block-autosquash-commits-action version to 2.2.0
(cherry picked from commit dad39f61b5)
2023-11-14 21:28:22 +00:00
K.B.Dharun Krishna
d65cf36543 check.yml: bump actions/checkout version and replace deprecated 18.04 runner with 20.04
(cherry picked from commit 97768cea84)
2023-11-14 21:28:18 +00:00
Simon McVittie
38f1409b40 testlibrary: Initialize autofree variable to silence a compiler warning
As with commit 43085c0e "dir: Consistently initialize g_autofree
variables", this is currently harmless because we never actually
early-return or goto out of the region between declaration and
initialization, but some compiler versions log a warning here anyway.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit cffc3aed5b)
2023-11-14 21:27:31 +00:00
Simon McVittie
9de6856f7e run: Make it clearer that rest_argv_start is not used uninitialized
rest_argv_start is initialized whenever rest_argc != 0, so the previous
code was in fact safe; but this wasn't obvious to either a human reader
or the compiler, and some gcc versions warn here.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 0e3e646839)
2023-11-14 21:27:17 +00:00
Simon McVittie
b7a18d8f98 dir: Consistently initialize g_autofree variables
All g_autofree and g_autoptr variables should be initialized, either
with a value or NULL, and some gcc versions warn if they are not.

This particular instance was harmless, because we initialized regexp
to either NULL or a valid non-NULL value as the first statement of the
function, so there was no way to return before regexp was initialized;
but if we introduced an early-return such as a g_return_val_if_fail
before the current first statement, then that early return would have
caused uninitialized stack contents to be freed, likely resulting in a
crash.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 43085c0e2a)
2023-11-14 21:27:07 +00:00
Philip Withnall
2fc0fa3306 dir: Fix a minor leak of an OSTree checksum
The checksum here can leak if `flatpak_dir_remote_load_cached_summary()`
returns false at least once.

Spotted by asan while running gnome-software:
```
Direct leak of 2925 byte(s) in 45 object(s) allocated from:
    #0 0x7f44774ba6af in __interceptor_malloc (/lib64/libasan.so.8+0xba6af)
    #1 0x7f44764c941a in g_malloc ../../source/glib/glib/gmem.c:130
    #2 0x7f445bc860e7 in ostree_checksum_from_bytes src/libostree/ostree-core.c:1599
    #3 0x7f445bdbea82 in flatpak_dir_remote_fetch_indexed_summary /opt/gnome/source/flatpak/common/flatpak-dir.c:12563
    #4 0x7f445bd9932e in flatpak_remote_state_ensure_subsummary /opt/gnome/source/flatpak/common/flatpak-dir.c:577
    #5 0x7f445bdbfd42 in _flatpak_dir_get_remote_state /opt/gnome/source/flatpak/common/flatpak-dir.c:12872
    #6 0x7f445bdc006c in flatpak_dir_get_remote_state_optional /opt/gnome/source/flatpak/common/flatpak-dir.c:12953
    #7 0x7f445be07886 in flatpak_transaction_ensure_remote_state /opt/gnome/source/flatpak/common/flatpak-transaction.c:2057
    #8 0x7f445be095c7 in flatpak_transaction_add_ref /opt/gnome/source/flatpak/common/flatpak-transaction.c:2732
    #9 0x7f445be09c37 in flatpak_transaction_add_update /opt/gnome/source/flatpak/common/flatpak-transaction.c:2940
    #10 0x7f445bdd202c in flatpak_installation_list_installed_refs_for_update /opt/gnome/source/flatpak/common/flatpak-installation.c:1103
    #11 0x7f445bf07824 in gs_flatpak_add_updates ../../source/gnome-software/plugins/flatpak/gs-flatpak.c:2082
    #12 0x7f445bf2e2b9 in gs_plugin_add_updates ../../source/gnome-software/plugins/flatpak/gs-plugin-flatpak.c:484
    #13 0x7f44770533b2 in gs_plugin_loader_call_vfunc ../../source/gnome-software/lib/gs-plugin-loader.c:620
    #14 0x7f447705430f in gs_plugin_loader_run_results ../../source/gnome-software/lib/gs-plugin-loader.c:748
    #15 0x7f447706cb03 in gs_plugin_loader_process_thread_cb ../../source/gnome-software/lib/gs-plugin-loader.c:3110
    #16 0x7f44769967ed in g_task_thread_pool_thread ../../source/glib/gio/gtask.c:1531
    #17 0x7f447650e760 in g_thread_pool_thread_proxy ../../source/glib/glib/gthreadpool.c:350
    #18 0x7f447650dd02 in g_thread_proxy ../../source/glib/glib/gthread.c:831
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
(cherry picked from commit ce4bb3d153)
2023-11-14 21:26:57 +00:00
Simon McVittie
9a28eafcc4 tests: Call g_test_init() before isolated_test_dir_global_setup()
g_test_init() is meant to be called before any other use of GTest APIs,
and isolated_test_dir_global_setup() can call g_test_message(). GLib
2.76 makes this more of a practical problem.

(isolated_test_dir_global_setup() is essentially a reimplementation of
G_TEST_OPTION_ISOLATE_DIRS, since we don't depend on GLib 2.60.)

Alternative to https://github.com/flatpak/flatpak/pull/5355.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit a058d9617f)
2023-11-14 21:26:46 +00:00
Simon McVittie
1423f0e9bf security policy: Downgrade 1.12.x, 1.10.x to "supported if feasible"
We have too many branches and too few maintainers to be able to treat
old-stable branches as fully supported.

Helps: #5352
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 319832190f)
2023-11-14 21:26:41 +00:00
Jan Alexander Steffens (heftig)
0dea86b0d6 Set size of file info for symlinks to 0
`ostree_raw_file_to_content_stream` will try to read it, causing a
critical warning with GLib 2.76 causing tests to fail.

(cherry picked from commit c9cbdf5179)
2023-11-14 21:26:33 +00:00
Simon McVittie
8a1edceadf Update translation files for 1.14.4 release
Signed-off-by: Simon McVittie <smcv@collabora.com>
1.14.4
2023-03-16 10:07:08 +00:00