Commit Graph

785 Commits

Author SHA1 Message Date
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
Chris Williams
c4466af059 doc: mention /etc/flatpak/remotes.d in flatpak-flatpakrepo(5) 2024-01-22 09:38:27 -06:00
Chris Williams
40d19dd7b7 doc: fix typo and add cross-references for /etc/flatpak/remotes.d 2024-01-22 09:38:27 -06:00
Patrick Griffis
8c26798991 update: Make autopruned refs automatically removed
In order to maintain a system over time update automatically removes any EOL runtimes that are unused.

This extends it to also remove any autopruned refs. In practice this means removing no longer used driver versions as the system is updated.

Closes #5261
2024-01-07 18:51:46 -06:00
bbhtt
ec3989def6 Make flatpak-metadata sections linkable 2023-11-07 12:40:51 -06:00
bbhtt
c8e7b8df5c Clarify that an app can own its app-id as subname of MPRIS bus 2023-11-07 12:40:51 -06:00
Steveice10
b8d8d80c61 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.
2023-10-08 11:33:57 -05:00
Forest
738a0b14de Add --device=input permission
This new permission exposes the host's /dev/input directory, providing
minimal game controller support without resorting to --device=all.
2023-09-08 19:03:24 +01: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
Fabio Pagnotta
fc05e818f0 Document path used for flatpak-override 2023-03-06 13:02:51 -06: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
Dan Nicholson
cc122e2972 flatpak-run: Unset GDK_BACKEND
If the `GDK_BACKEND` environment variable is present and it's value does
not match the Wayland and X11 socket configuration, then a GTK app will
fail to run since it will only consider the display backend from the
environment variable.

This should probably be extended to cover other display environment
variables such as `QT_QPA_PLATFORM` for Qt and `SDL_VIDEODRIVER` for
SDL. However, I've only tested this with GTK applications.
2023-02-13 18:24:54 +00:00
Leorize
df0b9d98b5 flatpak-run: unset GIO_EXTRA_MODULES
This variable contains paths to load GIO modules from. For the most
part, they refer to paths outside of the sandbox or if they happen
to be in the sandbox, would contain modules that are incompatible with
the sandbox runtime (ie. different libc).

While I've not found programs that would crash outright, it may cause
unexpected behaviors (eg. Apostrophe not being able to render math in
preview panel).

This variable is set by NixOS for its dependency boxing.
2022-12-07 16:20:51 -06:00
Leorize
751ff11d3a flatpak-run: unset XKB_CONFIG_ROOT
This variable is typically used to configure the use of a custom
set of XKB definitions. In those cases, it's mostly meant for the
X11 server or Wayland compositor. NixOS is known to employ this
variable for their custom XKB layout implementation.

When the path it points to is unreachable (due to the sandbox),
most GTK+/Qt applications will crash on Wayland.

Unsetting this does not seem to negatively impact the use of custom
XKB layouts with Flatpak applications.
2022-12-01 20:01:14 -06:00
Simon McVittie
db77992b28 doc: Update flatpak-metadata(5) for #5155
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-11-17 17:57:43 +00:00
Simon McVittie
26fbf692cd doc: Update flatpak-run(1) for #5168
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-11-17 17:44:18 +00:00
Simon McVittie
bb7240c2ef Update release checklist for merge of Meson build system
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-24 16:19:53 +01:00
Simon McVittie
9eb824f863 Add a Meson build system
Resolves: https://github.com/flatpak/flatpak/issues/2241
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-24 16:12:14 +01:00
Michael Catanzaro
1c32317841 Block KRB5CCNAME from inheriting into sandbox
If this environment variable is set on the host, it's going to mess up
authentication in the sandbox. For example, if the host has:

KRB5CCNAME=KCM:

then the sandboxed process will try to use the host KCM socket, which is
not available in the sandboxed environment, rather than the gssproxy
socket that we want it to use. We need to unset it to ensure that
whatever configuration we ship in the runtime gets used instead. We have
switched the GNOME runtime to use an empty krb5.conf and it works as
long as we don't break it with this environment variable meant for the
host.
2022-09-19 09:03:48 +02:00
Nick Reiley
764e5a4d0c Add --socket=gpg-agent 2022-08-16 13:29:06 +02:00
Phaedrus Leeds
ff8490a91e app: Add -u alias for --user
Save folks a few keystrokes. There is a command which already has a '-u'
option, document-export, but it doesn't support --user so there should
be no conflict. However '-s' is used by the info command among others,
so we can't use that for --system.
2022-08-16 10:50:29 +02:00
Patrick Griffis
6540f85511 Allow sub-sandboxes to own MPRIS names
We already allow normal apps to own MPRIS names but subsandboxes could not.

This allows them with the same dbus restrictions that they must be
prefixed by $app_id.Sandboxed.

This will be used by WebKitGTK.
2022-08-16 10:48:00 +02:00
Phaedrus Leeds
53a0b528bf Add DeploySideloadCollectionID flatpakref/flatpakrepo key
When Flatpak's P2P updates support was replaced with the "sideloading"
implementation in 1.7.1, a new server side repo config key
"deploy-sideload-collection-id" was added which gets set when you pass
"--deploy-sideload-collection-id" to "flatpak build-update-repo", and
has the effect of setting "xa.deploy-collection-id" in the repo metadata
that is pulled by clients, which itself causes a collection id to be set
on the remote for clients using Flatpak >= 1.7.1.

This commit adds an analogous key in flatpakref and flatpakrepo files,
so the collection id can be set when the remote is configured, rather
than later on when the repo metadata is pulled and acted upon. As before
with DeployCollectionID, it has no difference in function compared to
DeployCollectionID or CollectionID and the only difference is which
Flatpak versions are affected.

It would've been better if this were added in 1.7.1 when the sideload
support was added, but alas here we are.

(Also update the docs and unit tests)
2022-08-16 10:37:36 +02:00
Phaedrus Leeds
f0c1097690 doc/flatpak-override: Tweak manpage 2022-07-18 19:23:57 -05:00
Ryan Gonzalez
12305b2cae Add --include-sdk/debug to install SDK/debuginfo along with a ref
This makes it a lot easier to give guidance on using `flatpak run -d` or
`flatpak-coredumpctl`, because there's an easy way to install the
relevant refs.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
2022-05-06 17:35:30 -07:00
Phaedrus Leeds
b95525eae2 doc/flatpak-run: Update docs about env vars 2022-04-23 14:54:58 +01:00
Phaedrus Leeds
f4727eacb6 doc/flatpak-run: Add more info 2022-04-23 14:54:58 +01:00
Phaedrus Leeds
5acb4ee7e4 app: Disable fuzzy ref matching when id has a period
As discussed in #4848, this disables fuzzy matching when the string
given has a period in it. So for example "flatpak install org.mozilla"
would not offer "org.mozilla.firefox" even though the string given is a
substring of the app ID. This is desirable because it helps ensure fuzzy
matching is only used when the user intended to use it.

As with the previous commit that fixed #4829, this does technically
break backwards compatibility, but only in an interface intended for
interactive use by a human, not an interface that's used
programmatically, so it seems okay.
2022-04-21 20:53:46 +01:00
Phaedrus Leeds
23926b7090 app: Disable fuzzy ref matching when id has a slash
Fixes https://github.com/flatpak/flatpak/issues/4829
2022-04-21 20:53:46 +01:00
Simon McVittie
8bf4dbcae9 doc: have-kernel-module-* was added in 1.13.1
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-03 12:34:26 -08:00
Phaedrus Leeds
263acc5d24 doc: Try to clarify flatpak-spawn docs 2022-02-24 10:41:02 +00:00
Phaedrus Leeds
c932a57f4f doc: Tweak a few man pages
Make it clear what the current behavior is for sideloading from local
sources as well as for uninstalling unused EOL runtimes.
2022-02-17 10:37:25 -06:00