Commit Graph

7245 Commits

Author SHA1 Message Date
Matthias Clasen
f2ebccf670 Validate exported commands a bit
Avoid obvious nonsense.
2023-05-03 07:39:28 -04:00
Matthias Clasen
f680676da8 Use + as separator
As pointed out in review, '-' has a risk of being ambiguous,
since it is allowed in the APP_ID.

Update the docs and provide some more guidance on suitable
COMMAND names.
2023-05-03 07:39:14 -04:00
Matthias Clasen
20c0700f70 Actually run the exported command in the wrapper
This was an oversight from copying the original wrapper setup code.

Co-authored-by: Robert McQueen <rob@endlessm.com>
2023-05-03 07:39:13 -04:00
Matthias Clasen
011bb1f237 Document new options and keys 2023-05-03 07:38:55 -04:00
Matthias Clasen
0e40ef8284 Fix the build with older glib 2023-05-03 07:38:55 -04:00
Matthias Clasen
501a797287 Add a way to export multiple commands
Add and --export-command=COMMAND option to the
build-finish command, export it under the exported-commands
key in the metadata file, and generate
APPID-command shell wrappers for each of them.
2023-05-02 16:33:55 -04:00
K.B.Dharun Krishna
1cbff35386 check.yml: bump Ubuntu runner for valgrind 2023-04-08 21:22:09 -05:00
K.B.Dharun Krishna
a98854b1a0 check.yml: bump actions/upload-artifacts to v3 2023-04-08 21:22:09 -05:00
K.B.Dharun Krishna
cb655ab336 check.yml: remove glib260 ppa
The required package is present in Ubuntu repos https://packages.ubuntu.com/focal/libglib2.0-dev
2023-04-08 21:22:09 -05:00
K.B.Dharun Krishna
dad39f61b5 block-autosquash-commits.yml: bump block-autosquash-commits-action version to 2.2.0 2023-04-08 21:22:09 -05:00
K.B.Dharun Krishna
97768cea84 check.yml: bump actions/checkout version and replace deprecated 18.04 runner with 20.04 2023-04-08 21:22:09 -05:00
Jan Macku
026bb1d01a ci: trigger differential-shellcheck workflow on push
Fixes: redhat-plumbers-in-action/differential-shellcheck#215
2023-03-31 16:38:25 +01:00
Dan Nicholson
5069fd6a21 tests: Add a test for atomicity of eol-rebase updates
This adds a test to cover the changes in the previous commit.

Helps: #3991
2023-03-30 14:54:18 +02:00
Philip Withnall
9a2d0413f5 app: Port transaction subclasses to use add_rebase_and_uninstall()
This fixes the possible situation where an eol-rebase app can be
uninstalled and the new version not correctly installed (due to, for
example, the install op failing due to a lack of disk space).

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

Fixes: #3991
2023-03-30 14:54:18 +02:00
Philip Withnall
a0f80cb32a transaction: Add new flatpak_transaction_add_rebase_and_uninstall() API
This mostly replaces `flatpak_transaction_add_rebase()`. It’s necessary
because the uninstall op for an eol-rebased app needs to be linked to
the install/update op for the rebased app, otherwise one op can proceed
after the other has failed (or they can be run in the wrong order) and
result in the old app being uninstalled but the new one not installed.

The following commit will port the internal flatpak `FlatpakTransaction`
subclasses to use it. Other consumers of `FlatpakTransaction` (such as
gnome-software) will have to be ported as well.

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

Fixes: #3991
2023-03-30 14:54:18 +02:00
Philip Withnall
0fff6ac171 transaction: Add an out_op argument to flatpak_transaction_add_ref()
This will be used in the next commit to simplify some new code.
Currently, this introduces no functional changes.

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

Helps: #3991
2023-03-30 14:54:18 +02:00
Simon McVittie
cffc3aed5b 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>
2023-03-30 14:42:44 +02:00
Alexander Larsson
23ec4eda2f Use new --disable-userns bubblewrap feature when possible
This feature (added in https://github.com/containers/bubblewrap/pull/488)
allows us to improve the guarantees of disallowing the sandbox to use
recursive user namespaces (which is a security risk) compared to the
existing limits that use seccomp.

[smcv: Move this to flatpak_run_setup_base_argv() so it will apply
equally in apply_extra_data() and `flatpak build`; make the compile-time
check for a setuid bwrap into a runtime check]

Co-authored-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-03-24 13:29:32 +00:00
Simon McVittie
4650179d7c build: Require bubblewrap 0.8.0
This lets us use its new features unconditionally.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-03-24 13:29:32 +00:00
Simon McVittie
0e3e646839 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>
2023-03-20 12:19:15 +00:00
Simon McVittie
43085c0e2a 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>
2023-03-20 12:19:15 +00:00
Simon McVittie
ec6ca9b6a6 Update submodule: bubblewrap 0.8.0
* Improve error message if seccomp is disabled in kernel config
* Add --disable-userns option (needed for #5084)
* Add --assert-userns-disabled option (needed for #5084)

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-03-20 12:11:01 +00:00
Philip Withnall
ce4bb3d153 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>
2023-03-20 12:10:41 +00:00
Simon McVittie
a058d9617f 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>
2023-03-17 16:34:09 +00:00
Simon McVittie
319832190f 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>
2023-03-17 13:36:50 +00:00
Jan Alexander Steffens (heftig)
c9cbdf5179 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.
2023-03-17 13:27:21 +00:00
Simon McVittie
e936e3100d Update translation files for release
Signed-off-by: Simon McVittie <smcv@collabora.com>
1.15.4
2023-03-16 09:54:14 +00:00
Simon McVittie
7bfc469e38 Prepare v1.15.4
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-03-16 09:54:14 +00:00
Simon McVittie
e8219ad8c8 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-03-16 09:54:14 +00:00
Simon McVittie
8e63de9a7d run: Prevent TIOCLINUX ioctl, the same as TIOCSTI
The TIOCLINUX ioctl is only available on Linux virtual consoles such as
/dev/tty1. It has several Linux-specific functions, one of which is a
copy/paste operation which can be used for attacks similar to TIOCSTI.

This vulnerability does not affect typical graphical terminal emulators
such as xterm, gnome-terminal and Konsole, and Flatpak is primarily
designed to be run from a Wayland or X11 graphical environment, so this
is relatively unlikely to be a practical problem.

CVE-2023-28100, GHSA-7qpw-3vjv-xrqp

Resolves: https://github.com/flatpak/flatpak/security/advisories/GHSA-7qpw-3vjv-xrqp
Signed-off-by: Simon McVittie <smcv@debian.org>
2023-03-16 09:54:14 +00:00
Simon McVittie
409e34187d cli-transaction: Escape any special characters in the EOL reason
CVE-2023-28101, GHSA-h43h-fwqx-mpp8

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-03-16 09:54:14 +00:00
Ryan Gonzalez
7fe63f2e8f Reject paths given to --filesystem/--persist with special characters
There isn't much in the way of legit reasons for this, but it's a
potential security footgun when displaying the text.

CVE-2023-28101, GHSA-h43h-fwqx-mpp8

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
Co-authored-by: Simon McVittie <smcv@collabora.com>
2023-03-16 09:54:14 +00:00
Ryan Gonzalez
6cac99dafe Ensure special characters in permissions and metadata are escaped
This prevents someone from placing special characters in order to
manipulate the appearance of the permissions list.

CVE-2023-28101, GHSA-h43h-fwqx-mpp8

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
2023-03-16 09:54:14 +00:00
Sabri Ünal
3abfddba92 Update Turkish Translation
- Translate new strings.
- To ensure consistency with Git terminology, use "İşleme" as a translation for "Commit".
2023-03-16 09:34:52 +00:00
Anders Jonsson
47d522acd0 Update Swedish translation 2023-03-16 09:34:18 +00:00
Mejans
da6c7e66eb Occitan translations updated 2023-03-16 09:33:12 +00:00
Fabio Pagnotta
fc05e818f0 Document path used for flatpak-override 2023-03-06 13:02:51 -06:00
Piotr Drąg
2e633bd7fa Update Polish translation 2023-03-06 15:47:19 +00:00
Philip Withnall
209d4bba0d transaction: Remove unused error argument from flatpak_transaction_add_op()
Introduces no functional changes, but simplifies the code a little.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-23 18:57:50 +00:00
Philip Withnall
0b106a992f transaction: Fix a minor typo in a documentation comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-21 19:59:30 +00:00
Dmitry
9db4cc7d7b Russian translation update 2023-02-21 19:59:01 +00:00
Simon McVittie
756994b5c4 Prepare v1.15.3
Signed-off-by: Simon McVittie <smcv@collabora.com>
1.15.3
2023-02-21 10:03:49 +00:00
Simon McVittie
09d6adcb78 Update i18n files for release
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-21 10:03:49 +00:00
Simon McVittie
26be72d070 meson: Use flatpak in all-lower-case as the machine-readable project name
The Meson project name is more like Autotools PACKAGE_TARNAME, and in
particular is used in the name of the dist tarball.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-21 10:03:49 +00:00
Simon McVittie
0a4ce23448 README: Signpost https://flatpak.org/setup/ as a good way to install
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-21 09:55:10 +00:00
Simon McVittie
cf2a4f2b59 CONTRIBUTING: Recommend building this branch with Meson
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-21 09:54:46 +00:00
Simon McVittie
cb7f17b1d2 release-checklist: Describe how to do releases with Meson
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-21 09:20:02 +00:00
Simon McVittie
9fa89a9587 meson: Include the same i18n bug reporting address as for Autotools
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-21 09:19:37 +00:00
Simon McVittie
30c6b7dbf2 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-21 09:09:56 +00:00
Rodhos
88c187e44a update es.po 2023-02-21 09:07:51 +00:00