Commit Graph

6409 Commits

Author SHA1 Message Date
Alexander Larsson
1b130c5cc3 http utils: push custom thread local main context
We're calling async soup APIs with SOUP_SESSION_USE_THREAD_CONTEXT
set, which means that libsoup async APIs will run async callbacks on
the loop of the thread-default main context. We then manually spin
this main context, because we're supposed to look like a sync call and
the async stuff is just internally.

This is not really right, because normally there isn't any custom
mainloop context registred, which means we're spinning the main thread
context on some other thread, as well as queuing soup sorces on
it. This can't be any good!

Rather than doing this we actually create and push our own main
context that we then spin isolated from the default mainloop.
2021-03-19 10:59:04 +01:00
Alexander Larsson
49e8bfcea5 system-helper: Fix deploys of local remotes
For updates in remotes with a local (file:) uri we just do a deploy
with a LOCAL_PULL flag set and an empty arg_repo_path. However, our
arg_repo_path checking at some point seemed to stop properly handling
the case where it is empty. I got it to report "No such file" wich
broke the tests.
2021-03-19 10:59:04 +01:00
Alexander Larsson
534cf643a6 Revert "Revert "flatpak-utils-http: Don’t use GMainLoop""
This reverts commit 14f062593f.
2021-03-19 10:59:04 +01:00
Simon McVittie
14f062593f Revert "flatpak-utils-http: Don’t use GMainLoop"
This reverts commit c1561b1ded,
which seems to trigger a hang in the
test-oci-registry@system.wrap test-case.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-17 15:35:34 +01:00
Simon McVittie
bb52aeb342 Merge pull request #4076 from pwithnall/no-main-loops
flatpak-utils-http: Don’t use GMainLoop
2021-03-12 12:44:22 +00:00
Simon McVittie
9e62824ae5 Merge pull request #4171 from a-wai/fix-test-webserver
Fix an issue with the test webserver cache
2021-03-12 12:42:16 +00:00
Phaedrus Leeds
bced1def31 Merge pull request #4155 from flatpak/wip/security-policy
Add an initial security policy
2021-03-11 09:06:45 -08:00
Arnaud Ferraris
6996580bb8 tests: web-server: fix an issue with the web server cache
On a decently fast system, some files may be fetched, modified and then
fetched again within the same second. In that case, the web server
replies with a code 304 ("Not modified") to the 2nd query, causing some
tests to fail.

This commit forces the web server to ignore `If-Modified-Since` HTTP
headers, effectively disabling caching in order to mitigate the problem.
2021-03-11 13:31:17 +01:00
Simon McVittie
653a9b82fa Add an initial security policy
If we can get people to report security issues privately, then we can do
coordinated disclosure instead of having to rush to fix issues that are
already known to the public.
2021-03-10 19:39:01 -08:00
Simon McVittie
46b3ede524 dir: Refuse to export .desktop files with suspicious uses of @@ tokens
This is either a malicious/compromised app trying to do an attack, or
a mistake that will break handling of %f, %u and so on. Either way,
if we refuse to export the .desktop file, resulting in installation
failing, then it makes the rejection more obvious than quietly
removing the magic tokens.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-10 10:45:30 +01:00
Simon McVittie
1e7e8fdb24 dir: Reserve the whole @@ prefix
If we add new features analogous to file forwarding later, we might
find that we need a different magic token. Let's reserve the whole
@@* namespace so we can call it @@something-else.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-10 10:45:30 +01:00
Ryan Gonzalez
652a28ffab Disallow @@ and @@u usage in desktop files
Fixes #4146.
2021-03-10 10:45:30 +01:00
Simon McVittie
ba381ae936 tests: Remove hard-coded references to x86_64
Distributions run these tests on other architectures, but hard-coding
x86_64 to look for in output dooms that to failure.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-10 10:35:18 +01:00
Bastien Nocera
19b11ade73 app: Fix deprecation warning
The "new way" is supported since at least 2010 (!).

app/parse-datetime.y:302.1-12: warning: deprecated directive: ‘%pure-parser’, use ‘%define api.pure’ [-Wdeprecated]
  302 | %pure-parser
      | ^~~~~~~~~~~~
      | %define api.pure
2021-03-10 10:33:51 +01:00
Bastien Nocera
1941ddbdba app: Use bison to build parse-datetime.y
As it uses directives that POSIX yacc doesn't support:
app/parse-datetime.y:302.1-12: warning: POSIX Yacc does not support %pure-parser [-Wyacc]
  302 | %pure-parser
      | ^~~~~~~~~~~~
app/parse-datetime.y:307.1-7: warning: POSIX Yacc does not support %expect [-Wyacc]
  307 | %expect 31
      | ^~~~~~~
2021-03-10 10:33:51 +01:00
Bastien Nocera
4ea46eb397 build: Add bison detection macro 2021-03-10 10:33:51 +01:00
Bastien Nocera
edf1e40bbb build: Fix warning during autogen.sh
The serial number is supposed to appear only once per file, at the top
of it. Add a serial that matches the highest serial and remove the
in-text serials.

acinclude.m4:113: warning: the serial number must appear before any macro definition
acinclude.m4:321: warning: the serial number must appear before any macro definition
2021-03-10 10:33:51 +01:00
Alicia Boya García
03369d3f47 Expose TERM to flatpak enter
This is necessary to be able to use ncurses-based programs, such as
nano or gdb TUI.
2021-03-10 10:32:29 +01:00
Alicia Boya García
f39287d47f Let child process handle SIGINT in flatpak enter
Otherwise when running software that handles SIGINT, such as gdb or
python, pressing ^C would kill flatpak-enter and return control to the
shell.
2021-03-10 10:28:52 +01:00
Phaedrus Leeds
79a91b5cf6 Make flatpak --help output use consistent verbiage
Use present tense consistently rather than gerunds for some headings in
"flatpak --help". Also tweak flatpak(1) to use similar wording but with
gerunds.
2021-03-10 10:27:31 +01:00
Gregor Simm
bcd7425597 Update dates in NEWS file
In the NEWS file, it says that versions 1.10.1 and 1.10.1 were released in 2020. Shouldn't that read 2021?
2021-02-23 14:56:01 +01:00
Bastien Nocera
e67847e253 common: Fix Spawn portal method not working with UTF-8 files
When the portal's Spawn method is used with the environment cleared,
it's very likely that the "flatpak run" that ends up being run will be
in an environment without UTF-8 support.

If one of the files or directories we try to expose to the sub-sandbox
contains UTF-8/non-ASCII characters, then "flatpak run" would fail with:
error: Invalid byte sequence in conversion input

This is caused by GOption trying to parse the --filesystem option for
flatpak, as, when using the G_OPTION_ARG_CALLBACK argument type, GOption
will split the option name from its value, and try to convert the value
to UTF-8. Which will fail because there's no UTF-8.

It won't however do that if we tell the option parser that the value is
a filename using G_OPTION_FLAG_FILENAME, so set it.
2021-02-23 14:18:57 +01:00
Phaedrus Leeds
c7bb35d323 Merge pull request #4134 from flatpak/trivial-configure-output
trivial: Fix formatting of configure output
2021-02-18 11:46:08 -08:00
Phaedrus Leeds
e2a2e38c6b Merge pull request #4130 from RyuzakiKK/xauthlocalhostname
run: Propagate X11 cookies with an address equals to XAUTHLOCALHOSTNAME
2021-02-18 11:45:50 -08:00
Phaedrus Leeds
af2b8ca236 Merge pull request #4133 from RyuzakiKK/unused_vars
Remove unused variables
2021-02-18 11:43:00 -08:00
Phaedrus Leeds
66c4ef8de9 trivial: Fix formatting of configure output 2021-02-18 11:31:10 -08:00
Ludovico de Nittis
0d27b27744 run: Remove unused GAsyncResult variable
Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2021-02-18 11:39:45 +01:00
Ludovico de Nittis
8d9be910e5 dir: Remove unused AutoPolkitDetails variable
Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2021-02-18 11:39:23 +01:00
Phaedrus Leeds
d192d1b43b Merge pull request #4119 from kalev/G_BEGIN_DECLS-G_END_DECLS
Add G_BEGIN_DECLS/G_END_DECLS to public headers
2021-02-17 10:32:30 -08:00
Ludovico de Nittis
fd6a3b79f4 run: Propagate X11 cookies with an address equals to XAUTHLOCALHOSTNAME
OpenSUSE inherits the hostname value from DHCP without updating its X11
authentication cookie, and it keeps the initial value in
`XAUTHLOCALHOSTNAME`.
To avoid breaking the X11 applications, OpenSUSE patches libxcb so that
it also considers the value in `XAUTHLOCALHOSTNAME` as another possible
hostname.

https://bugzilla.opensuse.org/show_bug.cgi?id=262309

To cope with that behavior we need to check `XAUTHLOCALHOSTNAME` too
and, if we have a cookie with that address, propagate it inside the
container adjusting its address to the canonical hostname
`unames.nodename`.

Fixes: #4043

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2021-02-17 18:03:00 +01:00
Kalev Lember
426284759c Add G_BEGIN_DECLS/G_END_DECLS to public headers
This ensures that we correctly specify C linkage when including flatpak
headers from C++ code.

This should fix fallout from glib's change to include C++ code in its
headers, see https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1935
for discussion.

Fixes https://github.com/flatpak/flatpak/issues/4117
2021-02-12 15:58:09 +01:00
Phaedrus Leeds
7224809bc1 testlibrary: Fix memory leaks 2021-02-10 09:17:53 +01:00
Phaedrus Leeds
2a111e5042 common: Add API for listing related refs of installed ref
Currently if a user of libflatpak wants to list the related refs (such
as extensions and plugins) of something, they have three options:
1. They can parse the metadata manually with e.g.
   flatpak_remote_ref_get_metadata() and then key-file operations, but
   this means re-implementing parts of libflatpak and using key file
   strings that are not actually public (FLATPAK_METADATA_KEY_...).
2. They can use flatpak_installation_list_installed_related_refs_sync()
   but this only works for installed related refs not remote ones.
3. They can use flatpak_installation_list_remote_related_refs_sync() but
   this lists all remotely available related refs, including ones that
   may not be compatible with the installed version of the main ref
   (because they don't match any of the values in the "versions"
   metadata key).

So since none of these provide a way to get the remote related refs
corresponding to an installed application, add new API for that. For the
motivation of this see
https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1132
2021-02-10 09:17:53 +01:00
Alexander Larsson
f85cbcfde2 Bump version to 1.11.1. 1.10.x is now on flatpak-1.10.x branch. 2021-02-10 09:16:10 +01:00
Phaedrus Leeds
bc39bb59c4 doc: Add info -l docs 2021-02-09 09:37:32 +01:00
Phaedrus Leeds
dbe81c90c2 common: Tweak error code docs
FLATPAK_ERROR_ALREADY_INSTALLED can be returned from, for example,
flatpak_installation_add_remote(), so document that it applies to
remotes not just apps and runtimes.
2021-02-09 09:36:59 +01:00
Phaedrus Leeds
0920e959b5 common: Update FlatpakRef docs with respect to uniqueness
See these links for context on this change:
- https://lists.freedesktop.org/archives/flatpak/2021-January/002087.html
- https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/583#note_1006763
2021-02-09 09:34:47 +01:00
Simon McVittie
a926776cf4 tests: Disable revokefs if FUSE doesn't work
There are various reasons why distro autobuilder environments might not
be able to use FUSE in build-time tests: they might not have
fusermount(1), they might be locked-down to be unable to load the FUSE
kernel module as a result of security hardening, they might not have the
/etc/mtab symlink, they might not have CAP_SYS_ADMIN in their capability
bounding set, or they might not have write access to /dev/fuse. Try to
check for all of these conditions.

Heavily based on code that I previously contributed to
xdg-desktop-portal. Disabling revokefs, instead of skipping the test
that needs it, is based on the patches applied in @alexlarsson's PPA.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-02-09 09:33:57 +01:00
Phaedrus Leeds
a8cc112dfa Merge pull request #4102 from jtojnar/docbook-unification
doc: Unify DocBook versions again
2021-02-05 19:51:16 -08:00
Phaedrus Leeds
997293d91e Merge pull request #4104 from pwithnall/content-rating-leak
flatpak-installation: Fix a leak of the content rating hash table
2021-02-05 15:34:52 -08:00
Philip Withnall
ae457239f5 flatpak-installation: Fix a leak of the content rating hash table
`flatpak_deploy_data_get_appdata_content_rating()` returns ownership of
the container.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-03 17:13:01 +00:00
Jan Tojnar
2bdd687bd7 doc: Unify DocBook versions again
Fixes a regression in version monoculture that occurred since the first attempt in
https://github.com/flatpak/flatpak/pull/3760
2021-02-01 23:16:25 +01:00
Alexander Larsson
acb2a190b3 Update pofiles for release 1.10.1 2021-01-21 14:59:10 +01:00
Alexander Larsson
c159070a74 Update version to 1.10.1 2021-01-21 14:45:11 +01:00
Alexander Larsson
f800187ce9 Update NEWS for release 2021-01-21 14:44:59 +01:00
Yuri Chornoivan
84fe927048 Update Ukrainian translation 2021-01-21 14:21:27 +01:00
Simon McVittie
b2b3612148 NEWS: Add CVE reference for CVE-2021-21261
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-21 14:20:48 +01:00
AsciiWolf
362c60e089 Update Czech translation 2021-01-21 14:20:01 +01:00
Piotr Drąg
ef825991e1 Update Polish translation 2021-01-21 14:18:45 +01:00
Simon McVittie
d0d5794621 doc: Mention some typical tags
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-21 14:18:21 +01:00