816 Commits

Author SHA1 Message Date
Sebastian Wick
2a4441382f context: Add --share-if and --allow-if context options
Actually make it possible to use the command line to use the new
conditional permission system.
2025-12-08 19:33:09 +00:00
Sebastian Wick
6667e1d361 context: Use the new permission system for shares and features
This gives us conditionals for shares and features. So far we have no
use case for this, but the system already exists, it makes the code
simpler, and when we need this in the future, we don't have to wait for
it to roll out.
2025-12-08 19:33:09 +00:00
Owen W. Taylor
841f33e451 app: Add a "signature lookaside" repository configuration
Allow specifying a lookside URL for downloading signatures for
an OCI remote. This can be specified:

 In a .repofile with the SignatureLookaside key
 As the --signature-lookaside option to remote-add/remote-modify
2025-12-08 19:09:56 +00:00
Sebastian Wick
4fb7b7158d ci: Do releases via the CI
Instead of doing meson dist on the developers machine and uploading it,
and creating the release in github, we can let the CI take care of it.

Closes #6404
2025-12-01 12:45:06 +00:00
Owen W. Taylor
e6b584f85c flatpak-build-bundle: Add --oci-layer-compress=zstd
Add an option to build OCI bundles with zstd compressed layers.

gzip is kept as the default for maximum compatibility:

Ecosystem support:

 distribution/distribution: no explicit support, but works
 quay.io: sinc 2021
 Amazon ECR: supported
 pulp_container: since 2022
 flatpak: since first-OCI supporting version
 tardiff: since first version
2025-11-20 17:30:07 +00:00
Sebastian Wick
947d4a6ce4 flatpak: Enable progress escape sequence by default
In 4febfb59 ("flatpak: Disable progress escape sequence by default") the
escape sequence has been disabled by default, but we want to enable it
again for 1.18.
2025-11-18 01:19:36 +00:00
Sebastian Wick
0fc61c1aff doc: Document the new Conditional Permissions system
The system was introduced in b93b58a4 ("context: Add new
FlatpakPermission(s) type") but we forgot to add documentation.
2025-10-30 11:29:16 +00:00
Sebastian Wick
3e9e68cc5d Support sideload repositories for OCI remotes
For OCI remotes, the existing sideload repository system doesn't
work: identity for OCI remotes is done by manifest digest (disguised
as a fake commit ID internally), instead of by ostree commit, so
we have no way of knowing whether a sideloaded image matches the
summary.

Allow specifying a new form of sideload repository with:

  --sideload-repo=oci:<path>

The desired use case for this is preinstalling Flatpaks during OS
install, and for this, binding the entire repository to a single
collection ID is both inconvenient and not useful, so OCI sideload
repostories don't have a defined collection ID - they just apply to
all OCI remotes. (And, because of this, they are restricted to
the command line.)
2025-10-24 16:27:33 +00:00
Sebastian Wick
feb2220a46 image-collection: Add the new FlatpakImageCollection class
The new FlatpakImageCollection class represents a set of
FlatpakImageSource loaded from the image sideload repository.
2025-10-24 16:27:33 +00:00
Sebastian Wick
0a3c2452c0 flatpak-build: Drop host permissions by default
For some reason, flatpak build always had host permissions set by
default. There really isn't a good reason for this. The build should be
isolated from the host as much as possible by default.
2025-10-13 19:24:50 +00:00
bbhtt
0bf531f44a dir: Add basic OS info to Flatpak-Os-Info header when pulling objects
Fixes https://github.com/flatpak/flatpak/issues/5549
2025-10-13 18:52:55 +00:00
Sebastian Wick
815301f341 doc: Build libflatpak-doc.html
Closes #4591
2025-10-10 10:04:37 +00:00
Sebastian Wick
f760f1b539 run: Add --clear-env option for clearing the outside environment 2025-10-09 18:02:50 +00:00
Ryan Brue
02587b5676 flatpak-metadata: Note host-root symlink pitfalls
Following symlinks from /run/host/root naively (for example, with
realpath()) is wrong.

This commit warns about this problem, and provides examples of how to
avoid it when using the host-root permission, either by using
https://man7.org/linux/man-pages/man2/openat2.2.html for modern kernels,
or 65adfdd5fc/steam-runtime-tools/resolve-in-sysroot.c
for older kernels.

Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
2025-09-24 17:19:21 +00:00
Harald Sitter
0493219ca5 exports: add host-root
Adapted from: https://github.com/flatpak/flatpak/pull/6125

In systemd v259, /run/host/root will be a documented location
for bind mounting the host's root filesystem into a
container. Ref: https://github.com/systemd/systemd/pull/38384

host-root is the sledgehammer permission for file browsers
and similar apps that the user might want to give full access
to.

This works same as the existing host keywords by mounting into
/run/host/root. applications will need adjustments to essentially
treat that path as "root".

Since this opens the door to all sorts of malicious software, the
permission should be put under tight review in flatpak
repositories.

Resolves: #5723

Co-authored-by: Ryan Brue <ryanbrue.dev@gmail.com>
2025-09-24 17:19:21 +00:00
Kalev Lember
d10e11482d Add initial support for preinstalling flatpaks
This adds new FlatpakTransaction API, and a new top level CLI command to
preinstall flatpaks, that is to install flatpaks that are considered
part of the operating system.

A new drop-in directory /etc/flatpak/preinstall.d/ allows configuring
what apps should be preinstalled, and a new flatpak preinstall command
installs and removes apps based on the current configuration.

A drop-in loupe.preinstall file can look something like this:

[Flatpak Preinstall org.gnome.Loupe]
Branch=stable
IsRuntime=false

The corresponding API is flatpak_transaction_add_sync_preinstalled()
which can be implemented by GUI clients to drive the actual installs
on system startup.

Resolves: https://github.com/flatpak/flatpak/issues/5579
Co-authored-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-08-26 11:51:07 +00:00
Owen W. Taylor
a460dd5069 image-source: Support oci-archive: image sources
Add support for `oci-archive:` image sources by temporarily
unpacking the archive using libarchive.

Co-authored-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-08-25 15:56:20 +00:00
Owen W. Taylor
eee21d5a27 builtins/install: Allow direct installation from OCI images
Similar to bundle installs, add:

 flatpak install [--image] docker://registry.example.com/image:latest
 flatpak install [--image] oci:/path/to/image

These is useful for testing purposes and in certain cases when installing
Flatpaks on disconnected systems.
2025-08-25 15:56:20 +00:00
Owen W. Taylor
59ad08e78c image-source: Refactor - add FlatpakImageSource type
To avoid passing around combinations of a FlaptakOciRegistry with
repository and digest, add a FlatpakImageSource type.

This also reduces duplicated code where every place that did
this independently retrieved the repository and image config.
2025-08-25 15:56:20 +00:00
Michael Catanzaro
0152272d6c doc: update documentation of flatpak-spawn --watch-bus
The current documentation is misleading, and confused multiple
experienced developers for the past two years.

Fixes #5501
2025-06-25 13:16:08 +00:00
Owen W. Taylor
c75ba1c7e1 common: Implement /etc/containers/certs.d for OCI registries
Docker and podman can be configured to use mutual TLS authentication
to the registry by dropping files into system-wide and user
directories. Implement this in a largely compatible way.

(Because of the limitations of our underlying libraries, we
can't support multiple certificates within the same host config,
but I don't expect anybody actually needs that.)

The certs.d handling is extended so that certificates are separately
looked up when downloading the look-aside index. This is mostly
to simplify our tests, so we can use one web server for both -
in actual operation, we expect the indexes to be unauthenticated.

Also for testing purposes, FLATPAK_CONTAINER_CERTS_D is supported
to override the standard search path.

Co-authored-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-05-08 16:08:21 +00:00
Philip Withnall
932c2fe648 doc: Improve formatting and clarity of bus policy section of docs
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-03-14 12:43:12 +00:00
David Auer
9f822ff145 run: Unset PYTHONPYCACHEPREFIX from envrionment
This repeatedly lead to errors when users had it set to a directory
accessible from the flatpak when importing pillow/PIL.
2025-02-11 11:36:37 -06:00
Chris Williams
cdc912728e flatpak-permission-show(1): Remove incorrect paragraph from description
This was probably accidentally copied from flatpak-permissions(1).

Closes #4859
2025-01-14 20:24:15 +01:00
Simon McVittie
d0ab55ea4c flatpak(1): Document more environment variables
Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-01-10 14:30:32 +01:00
Simon McVittie
51aaaa943a flatpak(1): Re-word introduction to the list of environment variables
This is more grammatically correct.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-01-10 14:30:32 +01:00
Simon McVittie
bb22b078e2 flatpak(1): Sort environment variables alphabetically
Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-01-10 14:30:32 +01:00
Simon McVittie
424400edc6 flatpak(1): Expand description of FLATPAK_TTY_PROGRESS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-01-09 17:33:54 +01:00
Georges Basile Stavracas Neto
4febfb5973 flatpak: Disable progress escape sequence by default
And add the FLATPAK_TTY_PROGRESS env var to re-enable it.

This seems to only be supported by recent versions of terminal emulators
which will cause problems with shipping Flatpak on older distros.

Closes https://github.com/flatpak/flatpak/issues/6052
2025-01-09 17:22:19 +01:00
Simon McVittie
5250be9502 doc: Document $FLATPAK_FANCY_OUTPUT
Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-01-09 16:44:19 +01:00
Simon McVittie
c7ae1cc18c release-checklist: Match the last few releases
The release checklist claimed we used titles like `Release 1.15.12`,
but in practice they've all been like `1.15.12` for a long time.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-11-28 16:23:25 +00:00
Georges Basile Stavracas Neto
a625aaa006 doc: Use post-release bumps in the checklist
As per suggestion in the Flatpak channel. This makes such
that the version built is always the version that will be
released.
2024-11-27 13:51:55 +01:00
Hubert Figuière
1d56bd377e context: Implement device lists for usb
Signed-off-by: Hubert Figuière <hub@figuiere.net>
2024-10-16 14:11:56 -03:00
Hubert Figuière
19b447f49a flatpak: Add USB enumerables / hidden lists
Add '--usb' and '--nousb' to the FlatpakContext option group.

Map these parameters to either the enumarable list, or the hidden
list, of a new "USB Devices" group in the metadata key file. It looks
like this:

```
[USB Devices]
hidden-devices=cls:01:*;
enumerable-devices=vnd:0fd9+dev:0080;vnd:0fd9+dev:0080;
```

Flatpak itself does not use these values, they're meant to be used
by e.g. XDG Desktop Portal to filter which devices the app can see
through the USB portal.

Hidden devices must always take precedence over enumerable devices.

This is heavily inspired by https://github.com/flatpak/flatpak/pull/4083

Co-Authored-By: Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
Co-Authored-By: Ryan Gonzalez <rymg19@gmail.com>
Signed-off-by: Hubert Figuière <hub@figuiere.net>
2024-10-16 14:11:56 -03:00
Sebastian Wick
1561e0f39c run: Unset $TZDIR environment variable
We now resolve the zoneinfo and always make it available at
/usr/share/zoneinfo in the sandbox so we unset TZDIR to get flatpak apps
looking at the right directory.
2024-09-23 22:52:08 -03:00
Sebastian Wick
aa03174e14 run: Sync the list of unset environment variables
More variables got added but the documentation was not updated.
2024-09-23 22:52:08 -03:00
Pablo Correa Gómez
0313df972a dir: search for repositories also under FLATPAK_BASEDIR
This is more compliant with FHS specification. Most notably, /etc
is not appropriate to hold distro configuration, which is a common
use for the remotes.d feature. It is better practice to put things
under /usr/share, and let the system administrator modify /etc to
their will, of course giving them priority.

Update documentation to reflect this change.

In the process, move to use g_build_filename
2024-09-20 17:30:56 +01:00
Hubert Figuière
bdc96ee152 flatpak-run: Mount /dev/bus/usb with --device=usb
This adds a new `usb` device in the list to grant access to the whole
USB bus. This is narrower than `all` and should be enough for
anything accessing the USB directly (i.e. using libusb or equivalent).

This doesn't grant access to synthesized devices, i.e those exposed
in `/dev` but using USB, including but not limited to USB serial, webcams,
hidraw, hid, sound.

Close #4405

Signed-off-by: Hubert Figuière <hub@figuiere.net>
2024-09-02 10:00:53 -03:00
Georges Basile Stavracas Neto
915bbfb294 context: Add --a11y-own-name
This option allows the application (or subsandbox) to own the specified
name on the a11y bus. This will be useful for WebKit, that has a strict
security need that the Web processes cannot talk or see each other.

An alternative approach would be to make xdg-dbus-proxy permissions
modifiable at runtime, but that seems a lot riskier than this. Owning
a well known name based on the app id has proven to be a robust and
secure approach after all.
2024-08-29 14:11:50 -03:00
Simon McVittie
e5c97002e2 doc/release-checklist.md: Fix a leftover Autotools reference
In 1.15.x we're using `meson dist`, not `make distcheck`.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-07-22 19:12:31 +01:00
Chris Williams
7c63731349 doc: Correct special value for flatpak config
To include all languages, the languages key must be set to `*all*`, not
`all`. That was apparently intended to provide symmetry with how the
value is represented in the output of `flatpak config`.
2024-07-09 20:48:07 +01:00
Daniel Stone
18b85083b9 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>
2024-04-24 18:13:17 +01:00
Daniel Stone
0f2661045d 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>
2024-04-24 18:13:17 +01:00
Patrick Griffis
abcc001da8 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.
2024-04-24 10:03:59 -05:00
Hubert Figuière
56438bf542 doc: Fix multiple validation errors in docbook.
Signed-off-by: Hubert Figuière <hub@figuiere.net>
2024-03-20 19:43:49 +00:00
Simon McVittie
8e63eda867 Remove Autotools build system
As discussed in #5695, I think we're reaching a point where removing
Autotools is preferable to fixing it.

1.14.x continues to use Autotools, so platforms whose Meson version is
too old can stay on that branch until it becomes unsupported. We have
a very conservative Meson dependency (Ubuntu 20.04).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-16 19:30:32 +00:00
Chris Williams
ac4b51e3aa doc: rename man pages to flatpakref(5) and flatpakrepo(5)
Add symlinks to preserve flatpak-prefixed names.

Also fix section reference in flatpak-install(1).
2024-02-15 11:41:56 -06:00
Weng Xuetian
0402e1614c Limit the usage of WAYLAND_SOCKET to an opt-in feature
1. For security context creation, only relies on WAYLAND_DISPLAY, do not
   use WAYLAND_SOCKET since the file descriptor defined by WAYLAND_SOCKET
   can be only consumed once.
2. Due to the incompatiblity between WAYLAND_SOCKET and the security
   context, add a new permission --socket=inherit-wayland-socket
   to limit the usage of WAYLAND_SOCKET to an opt-in feature. Only when
   this flag is set, WAYLAND_SOCKET will be passed to the sandbox.
3. When WAYLAND_SOCKET is not inherited, set FD_CLOEXEC to avoid it to
   be leaked the to sandbox.

Closes: #5614
2024-02-14 19:39:50 +00:00
Hubert Figuière
2dd73bc343 doc: Add since version for --device=input
Follow-up to #5481

Signed-off-by: Hubert Figuière <hub@figuiere.net>
2024-02-11 10:19:45 -06:00
illtellyoulater
897c46f04a docs: Fix ambiguity due to lack of punctuation & capitalization 2024-02-02 19:38:01 -06:00