Commit Graph

8520 Commits

Author SHA1 Message Date
razzeee
4006907ba3 transaction: Add flatpak_transaction_progress_get_bytes_per_second() 2026-06-23 09:50:04 +00:00
bbhtt
5fcf748ac9 dir: Don't pass temp repo path to flatpak_dir_log during initial pull
During a system install with the system helper enabled, the initial
network pull goes to a temporary repo and then via pull local from that
repo to the final system repo while during user install there is only
one pull from network to the final repo.

c672c55 set the logger to use the temporary repo path as installation
but the history command afc87ad since the same day filters the initial
pull out as the installation name will never match the temporary path.

This causes the initial pull operation to be never show up in flatpak
history when using system installs while they work for user installs as
`INSTALLATION=user`.

This is presumably also broken for custom installations as they
will similarly not match the temp repo path.

So don't pass the path at all to flatpak_dir_log and we can later
fall back via flatpak_dir_get_name_cached() which sets the correct
`INSTALLATION` for system installs ie. `INSTALLATION=system`.

This also allows us to remove the workaround of adding two different
expected history outputs from ad1ff6d as both branches log the pull.

Without system helper `flatpak install` needs to be executed as
priviledged to operate on system install so the initial pull was
always logged correctly for that branch.
2026-06-23 09:11:59 +00:00
Mia McMahill
a9215f4153 flatpak-coredumpctl: Clean up usage messages slightly with metavar
This just makes the generated messages slightly less redundant and a
little closer to coredumpctl's.
2026-06-23 09:05:14 +00:00
Mia McMahill
aef5cf91a3 flatpak-coredumpctl: Make use of periods consistent in help messages
Help messages were inconsistent about whether they ended with periods or
not. I chose to remove the periods from those that had them rather than
the other way around because the help messages automatically generated
by argparse do not have periods.
2026-06-23 09:05:14 +00:00
Mia McMahill
32698f1e60 flatpak-coredumpctl: Refactor arg validation to have no typecheck errors
There are a couple related changes made here, with the intention of
making it easier to implement additional features in the future:
- Mutual exclusivity of --build-directory and app is better enforced
  both through types and at runtime. The types will let type checkers
  ensure that we cannot reach the run function without at least one of
  them being valid. At runtime, it no longer allows both to be
  specified, which could result in confusion over which takes
  precedence.
- Instead of wrapping the entire program in a class, there is now only a
  small class that handles validation of the arguments and holding the
  data to be passed to run. This provides a better separation of
  concerns, with the argument parsing now being a little less tied to
  running the debugger.
2026-06-23 09:05:14 +00:00
Mia McMahill
dbdddd4bd5 flatpak-coredumpctl: Only call sys.exit from main 2026-06-23 09:05:14 +00:00
Mia McMahill
e77bb49d88 flatpak-coredumpctl: Remove nargs="?" from -m option
-m with no argument currently results in coredumpctl_matches having a
value of "", which is exactly the same as if it weren't used at all. As
far as I can tell, allowing this does nothing useful, only making the
usage slightly less clear.
2026-06-23 09:05:14 +00:00
bbhtt
f4946b206b flatpak-context: Add test for flatpak_permission_to_args negated output
Test for the bug fixed in db70882d. We test no(socket | device) anyway
to stop future regressions.
2026-06-23 08:46:20 +00:00
Sebastian Wick
ce4a27e1fe portal: Check if the monitor is closed before emitting progress
`emit_progress` is called from a thread while another thread could
unexport/close the GDbusInterfaceSkeleton. If that happens, the
connection becomes NULL which is illegal for
`g_dbus_connection_emit_signal` which results in dereferencing an unset
error.

The fix is to lock the UpdateMonitorData, and then only emit the signal
if it is not closed.
2026-06-23 08:45:08 +00:00
Sebastian Wick
c4fce9e42a run: Error out if file forwarding of empty paths is attempted
The file forwarding feature errors out when the path or URI does not
lead to an actual file that can be forwarded. The empty path never
describes an actual file, so we always have to error out.

Without the check, we would get a NULL path from
`flatpak_file_get_path_cached` and crash later.

Closes: #6689
2026-06-23 08:44:34 +00:00
꧁★☆ 𝚖𝚒𝚐𝚞𝚎𝚕𝟶𝟺𝟼𝟾𝟻 ☆★꧂
fdb1741789 Update Brazilian Portuguese translation 2026-06-19 08:13:21 +05:30
bbhtt
ad1ff6da68 tests: Fix expected history output when system helper is compiled out
Pulls do not go to the temp repo so they are logged when system
helper is compiled out
2026-06-18 21:15:41 +00:00
bbhtt
d820c4bc5e tests: Fix FL_CACHE_DIR when system helper is compiled out
The tests assumed that a system installation always uses the XDG cache
location unless running as root. However, Flatpak only uses that cache
location when the system helper is available at both compile and run
time. [1]

Builds configured with -Dsystem_helper=disabled instead use the
repo-local cache directory [2], causing the tests to look for cached
summaries in the wrong location and fail.

[1]: 96ad6825f3/common/flatpak-dir.c (L4853-L4862)
[2]: 96ad6825f3/common/flatpak-dir.c (L4942-L4943)
2026-06-18 21:15:41 +00:00
bbhtt
489b3972cb tests: Skip seccomp tests when seccomp is unavailable
Fixes the testsuite with `-Dseccomp=disabled`.
2026-06-18 21:15:41 +00:00
Sebastian Wick
f7138cbbc3 Update subtree: libglnx 2026-06-18
* backports, local-alloc: Provide a backport of g_autofd
* build: Add meson.override_dependency('libglnx', libglnx_dep)
* fdio: Add support for name_to_handle_at
* chase: Add glnx_chase_and_mkdirat

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2026-06-18 14:09:38 +02:00
Mia McMahill
a9766fbcbd ci: Bump differential shellcheck to v5 2026-06-18 11:18:12 +00:00
Mia McMahill
f4512ef55e ci: Bump CodeQL actions to v4
This addresses CodeQL v3 and Node 20 deprecation warnings
2026-06-18 11:18:12 +00:00
Mia McMahill
84271a64c4 ci: Bump actions/checkout to v6 and actions/upload-artifact to v7
This addresses the Node 20 deprecation warnings
2026-06-18 11:18:12 +00:00
Mia McMahill
02fc85a3c2 completion: Minor cleanup of variable usage in bash completion
1. Removed unnecessary punctuation to help with readability
2. Loop over RES elements directly instead of indexing
3. Declare COMPGEN_OPTS only once vs redeclaring on each iteration
2026-06-18 11:15:54 +00:00
Mia McMahill
21ae7723c0 completion: Address a couple shellcheck warnings
1. Use $() command substitution instead of legacy `` style
2. Properly quote COMPGEN_OPTS
3. Use readarray instead of relying on word splitting
2026-06-18 11:15:54 +00:00
Mia McMahill
9047dabfaf completion: Make all variables local where possible in bash completion
A few global variables were being created unecessarily still. This makes
sure that users shell environments are not polluted by extra variables
and that the completion doesn't modify unrelated variables
2026-06-18 11:15:54 +00:00
Sebastian Wick
8ef5ee9455 Merge branch 'wip/chase-callback' into 'master'
chase: Add glnx_chase_and_mkdirat

See merge request GNOME/libglnx!76
2026-06-17 12:30:57 +00:00
Sebastian Wick
ae7355612a chase: Add glnx_chase_and_mkdirat
We found that there is a common use case where we need to get a
subdirectory (potentially multiple levels) which might not exist yet.
Adding another flag for this to GlnxChaseFlags is what systemd has done,
but creating a directory takes a mode, so the flag creates directories
with a fixed mode. This approach instead takes the mode as argument.
2026-06-17 14:27:41 +02:00
Sebastian Wick
4f8674709d chase: Add internal glnx_chaseat_full for a strategic callback
It takes a callback which gets called every time we try to open the next
segment of the path. This allows implementing more specific and advanced
use cases to be implemented without adding more complexity to the chase
algorithm itself.
2026-06-17 14:27:16 +02:00
Owen W. Taylor
906affa13b Handle null properties as missing properties
We were handling null properties the same as missing properties
*except* that the MANDATORY flag allowed null properties but
not missing properties. Fix this, so null is disallowed by
MANDATORY.

When checking signatures, the image identity could only have
been NULL if it was null in the input file - so replace a
conditional check on it being non-null with an assertion.
2026-06-16 20:13:10 +00:00
Owen W. Taylor
b15828e119 Fix crash on image indexes with missing architecture
It's legitimate to have manifests listed in an image index that
have no platform object, and hence no architecture - avoid crashing
if we encounter such a manifest.
2026-06-16 20:13:10 +00:00
Owen W. Taylor
fa4b413c02 Make mandatory properties from OCI specifications mandatory
Mark all properties required by the OCI specification as required;
this eliminates a bunch of cases where we were assuming that
descriptor->digest was non-NULL, and potentially generating
critical errors from g_return_if_fail().
2026-06-16 20:13:10 +00:00
Mia McMahill
4d3f0bbb79 app, common: Remove duplicate directories from export functions
Both collect exports and flatpak_export_dir recursively export the
directories in their respective directory lists. Because of this,
including share/metainfo/releases when share/metainfo is already in the
lists is unnecessary and can cause exporting to fail because of
duplicate files.
2026-06-16 11:20:58 +00:00
Mia McMahill
cebc323966 tests: Add test for building and installing with exported releases.xml
Adds a test that verifies releases.xml metainfo files are not duplicated
at any export stage, and that they are not left unexported either.
2026-06-16 11:20:58 +00:00
Kolja Lampe
4ff158caea http: Propagate stream write failures to curl
We did not report the written bytes of the aborted stream before - so
curl thought that we wrote all bytes.
2026-06-15 10:02:12 +00:00
Kolja Lampe
420ce91428 http: Reset curl TLS options between transfers
Previously the curl object potentially leaked cert infos from different
urls
2026-06-15 10:02:12 +00:00
Razze
8ac2adefce oci-registry: Apply TLS certs to request
Signature downloads can use a different URL from the OCI registry
itself, so they must not depend on TLS options left on the reused curl
handle. Resolve certificates for the URI and pass them explicitly.
2026-06-15 10:02:12 +00:00
bbhtt
69bf837676 instance: Annotate flatpak_instance_get_all as (transfer container)
Annotating the return as (transfer full) causes bindings to additionally
unref each element on array free, resulting in a use-after-free.

Change the annotation to (transfer container) so bindings know to unref
the array only.

Fixes: https://github.com/flatpak/flatpak/issues/6666
2026-06-15 09:26:10 +00:00
asbytes
db70882df1 context: Fixed negated permission string for allow and share options
It was solved partially in e0e1b20, but not for completely disallowed code path.
Steps to reproduce:
1. Run any flatpak with explicit --unshare option, e.g:
    [user@user-standardpc ~]$ flatpak run --unshare=network --command=bash io.gitlab.librewolf-community
2. Inside flatpak shell spawn any executable:
    [io.gitlab.librewolf-community ~]$ flatpak-spawn ls /
Result is:
error: Unknown option --noshare=network
2026-06-11 20:40:49 +00:00
Luigi Pavan
b9c3cdd7a4 tests: Add test for installing from an auth-protected OCI registry
Add a regression test that installs from an auth-protected OCI registry.
The registry requires a bearer token for all /v2/ requests; the client
authenticates via the mock test authenticator and the installation
completes successfully. The test runs for both user and system install
paths.

Assisted-by: Cursor
2026-06-11 18:26:52 +00:00
Luigi Pavan
a5b15b9aa1 tests/oci-registry: Add bearer token auth support to the mock OCI registry
Add infrastructure for testing OCI installations from auth-protected
registries. The mock server now supports requiring a bearer token on all
/v2/ requests, configurable via a new POST /testing-auth/configure admin
endpoint. The client gains a corresponding 'configure-auth' subcommand.

Assisted-by: Cursor
2026-06-11 18:26:52 +00:00
Sebastian Wick
32baedaa7e oci-registry: Check signatures from mirrored repo in the system helper
In flatpak_pull_from_oci we can be in in the system helper where we pull
the mirrored OCI image into the system repo. However, to fetch the
signatures in GPG signed repos, we used a remote OciImageSource created
through `flatpak_remote_state_fetch_image_source`. This caused fetching
some data from the registry which we don't want in the deploy method,
and also fails if a token is required to access the repo.

This change fetches the signatures from the mirrored OCI repo instead of
pulling them from the remote OciImageSource. The signatures can come from
anywhere because we verify them against the GPG key in the system repo.

The important bit is the change in `flatpak_pull_from_oci` where we now
pass in the local image_source to fetch the signatures from, and in the
system helper, where we get the right metadata to check the signatures
against (eventually ends up in `flatpak_oci_signatures_verify`).
2026-06-11 18:26:52 +00:00
Sebastian Wick
1a33d1a15b oci-registry: Load the certificates from an ImageSource 2026-06-11 18:26:52 +00:00
Simon McVittie
c88d9f2251 Merge branch 'wip/meson-override-dependency' into 'master'
build: Add meson.override_dependency('libglnx', libglnx_dep)

See merge request GNOME/libglnx!77
2026-06-11 16:25:49 +00:00
Sebastian Wick
96ad6825f3 Post-release version bump 2026-06-08 14:51:50 +02:00
Sebastian Wick
5de2b58bda 1.18.0 1.18.0 2026-06-08 14:36:33 +02:00
Sebastian Wick
90f3aa450f Update SECURITY.md 2026-06-08 14:35:23 +02:00
Sebastian Wick
ad7aff2c55 Update translation files for 1.18.0 2026-06-08 14:22:12 +02:00
razzeee
6b6fdda2f6 flatpak-coredumpctl: Guard against unexpected coredumpctl output
The bare tuple unpack 'executable, = re.findall(...)' raises a cryptic
ValueError if the pattern matches zero or more than one line. Replace it
with an explicit length check and a clear error message.

Also pass count=1 to str.replace() so a /newroot prefix is only stripped
once and /app/ paths are passed through unchanged.
2026-06-08 12:10:42 +00:00
Mia McMahill
8c418fa4b9 flatpak-coredumpctl: Use subprocess.PIPE instead of NamedTemporaryFile 2026-05-27 14:48:22 +00:00
Mia McMahill
61272df8cd flatpak-coredumpctl: Require Python 3.10 or greater at runtime 2026-05-27 14:48:22 +00:00
Mia McMahill
b6ceab85c3 flatpak-coredumpctl: Pass tuple to startswith instead of two calls 2026-05-27 14:48:22 +00:00
Mia McMahill
4bcd6cd48b flatpak-coredumpctl: Pass description as argparse description argument
This prevents it from getting printed twice in some circumstances
2026-05-27 14:48:22 +00:00
Mia McMahill
8e5d4c1183 flatpak-coredumpctl: Exit with return code of flatpak_command 2026-05-27 14:48:22 +00:00
Mia McMahill
0285e879d0 flatpak-coredumpctl: Print help message to stderr
This is more consistent with common practice for
help messages printed due to missing/incorrect arguments.
2026-05-27 14:48:22 +00:00