Commit Graph
5687 Commits
Author SHA1 Message Date
Bastien Nocera a4df2bae2b tests: Better failure output for test_dconf_paths
Output whether we get an unexpected failure or success, and the values
we passed in, to make it easy to pinpoint the failing test.
2020-03-17 13:11:54 +01:00
Alexander Larsson 6395d04e40 Merge pull request #3471 from owtaylor/oci-error-overwrite
oci-authenticator: fix failures to clear GError
2020-03-17 11:12:51 +01:00
Alexander Larsson 7f7ceab633 Merge pull request #3468 from alexlarsson/token-type-endianness
Enforce little endian for token-type
2020-03-17 10:51:36 +01:00
Alexander Larsson e22d4ff880 Merge pull request #3472 from owtaylor/oci-token-reuse
oci-authenticator: reuse token results when we already have them
2020-03-17 10:50:48 +01:00
Owen W. Taylor 08636d4729 oci-authenticator: reuse token results when we already have them
When we already have a token for the first repository after probing
for no-auth authenticator or testing user-entered credentials, just
use that, don't request it again in the loop over repositories.

This gives a significant optimization of the prompted-credentials
case for registry.redhat.io, which takes 4-5 seconds to generate a
token, hopefully avoiding the user thinking something has gone wrong.

Signed-off-by: Owen W. Taylor <otaylor@fishsoup.net>
2020-03-16 16:26:04 -04:00
Owen W. Taylor 425f628263 oci-authenticator: fix failures to clear GError
Fix problems overwriting a GError when we retry multiple times.
One of these was introduced with the recent change
e3f17a89a flatpak-oci-authenticator: try getting a token without credentials
but the other was existing.

Signed-off-by: Owen W. Taylor <otaylor@fishsoup.net>
2020-03-16 15:59:21 -04:00
Alexander Larsson fc8a6f0681 Merge pull request #3469 from alexlarsson/fix-gpg-tests
tests: Fix gpg signature failure checks
2020-03-16 15:18:08 +01:00
Alexander Larsson ab5f2dd7e8 tests: Fix gpg signature failure checks
It seems recent ostree reports a different error string for signature
check failures.
2020-03-16 15:01:54 +01:00
Alexander Larsson 360797dcd7 Merge pull request #3465 from alexlarsson/fix-repair-crash
repair: Don't crash if no remotes are configured
2020-03-16 12:30:59 +01:00
Alexander Larsson 00edd32596 common: Don't potentially write outside allocation
flatpak_bwrap_bundle_args() for some reasons does:

data = g_new (gchar, data_len);
*data = 0;

And then it starts copying in the data into the allocation, overwriting
the initial 0. If data_len is 0 this causes a write past end of
allocation, so just drop the second line above.
2020-03-16 12:30:49 +01:00
Alexander Larsson ff317fd4fb Enforce little endian for token-type
When storing the token-type in the commit and the summary cache we
hardcode it to little-endian.

In theory this breaks the "ABI", but in practice this change is a
no-op on little-endian systems which is what most are. Additionally as most
servers are little-endian this also fixes using big-endian clients with
such servers.

This fixes:
https://github.com/flatpak/flatpak/issues/3434
2020-03-16 11:26:10 +01:00
Alexander Larsson e2ee3306b7 repair: Don't crash if no remotes are configured
If no remotes are configured, ostree_repo_remote_list returns NULL
so don't dereference it.

Fixes: https://github.com/flatpak/flatpak/issues/3436
2020-03-16 10:47:41 +01:00
Alexander Larsson b79e878a75 document-export: Support exporting directories
This adds support for exporting a directory as a document, as
supported by version 4 of the portal:

  https://github.com/flatpak/xdg-desktop-portal/pull/447
2020-03-16 09:29:55 +01:00
Matthew Leeds 6aa3ff0d6f common: Don't shadow parameter variables 2020-03-16 09:29:31 +01:00
Matthew Leeds 2f49385379 dir: Add a comment to an empty block
This makes lgtm.com happy
2020-03-16 09:29:31 +01:00
Matthew Leeds 24a99b354c repair: Don't shadow checksum parameter 2020-03-16 09:29:31 +01:00
Matthew Leeds 2005a52498 app/parse-datetime.h: Add #pragma once 2020-03-16 09:29:31 +01:00
Matthew Leeds 84c68ad501 oci-authenticator: Don't shadow a global variable 2020-03-16 09:29:31 +01:00
Matthew Leeds 4e7cee1b98 app: Don't shadow global variables
These were pointed out by lgtm.com
2020-03-16 09:29:31 +01:00
Zetrov (Zhengchao) 194ef58fb9 Update flatpak-build-init.xml 2020-03-16 09:27:20 +01:00
Zetrov (Zhengchao) 8b0a1936c0 typo 2020-03-16 09:27:20 +01:00
Zetrov (Zhengchao) d99af85f05 Improvements for new users & fix example
New users who jump directly into this command might think this command is to init a project or application dictionary but it actually creates somehow a  directory for *built* app to run inside. 

plus, fix not working example

Sorry for such minor and boring commit.
2020-03-16 09:27:20 +01:00
Owen W. Taylor f7616a8b3c flatpak-oci-registry.c: supply a default scope when getting a token
If no scope parameter is supplied in the WWW-Authenticate header,
docker and libpod will make up their own of the form
repository:<reponame>:pull when requesting a bearer token. Match that.

Signed-off-by: Owen W. Taylor <otaylor@fishsoup.net>
2020-03-16 09:15:00 +01:00
Owen W. Taylor fe3f17a89a flatpak-oci-authenticator: try getting a token without credentials
Some registries require getting a token even to download an image
anonymously. So, if no auth has been configured, before prompting
the user for username/password, try without a BasicAuth header.

Signed-off-by: Owen W. Taylor <otaylor@fishsoup.net>
2020-03-16 09:13:41 +01:00
Matthew Leeds 00d1988310 README: Change LGTM badge to C
Flatpak has barely any Python code; there's not much point in
advertising that grade.

This badge will work after the merge of #3430
2020-03-11 14:28:44 +01:00
Matthew Leeds 8fb7876305 Add .lgtm.yml
Without this, lgtm.com can't successfully build the C code in Flatpak.
2020-03-11 14:28:44 +01:00
Simon McVittie a36e0183b1 run: Cope with the primary gid not being in the nsswitch database
If it's an opaque integer on the host system, it might as well be an
opaque integer in the container too.

Fixes: #3416
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-03-11 14:27:59 +01:00
Erick555 b4c29df7bd Mount systemd sockets as read-only
This is continuation of https://github.com/flatpak/flatpak/commit/ad9599d3e31050d07d782267038cc2f316af0235#diff-9efab2399c7c560b34de477b9aa0a465
and should complete coverage of read-only bind-mounts of sockets.
2020-03-11 14:24:24 +01:00
Matthew Leeds c7a6141dfe Merge pull request #3440 from AsciiWolf/l10n
Update Czech translation
2020-03-04 14:04:13 -08:00
Matthew Leeds c41aae4256 Merge pull request #3433 from smcv/out-of-tree
Fix (and test) out-of-tree builds
2020-03-04 14:03:34 -08:00
AsciiWolf 6443cdb244 Update Czech translation 2020-03-04 16:06:48 +01:00
Simon McVittie 0d58999756 CI: Do one build out-of-tree
With the gcc build out-of-tree and the clang build in-tree, we're
testing both ways.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-02-27 12:49:12 +00:00
Simon McVittie 189394653c build: Fix out-of-tree build with variant-schema-compiler
The variant-schema-compiler and its input are in the $(srcdir).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-02-27 12:46:01 +00:00
Danilo Spinella f3b863a187 Add --with-systemd arg to make systemd optional 2020-02-18 12:02:27 +01:00
Alexander Larsson 567bddf25c Use generated variant accessors for commit objects 2020-02-17 16:10:50 +01:00
Alexander Larsson f29830b4a4 Convert sparse cache API to generated variant APIs 2020-02-17 16:10:50 +01:00
Alexander Larsson 61da44a5e3 Convert flatpak_summary_lookup_ref from GVariants
Now it returns a VarRefInfoRef instead of a GVariant
2020-02-17 16:10:50 +01:00
Alexander Larsson 9f6c60405d utils: Convert summary ref lookup code to variant codegen
We can't use the built-in bsearch from the codegen because its an array
instead of a dict, so we have to keep that but its now not using
variant at least.
2020-02-17 16:10:50 +01:00
Alexander Larsson 7c4fd8891e Convert deploy data to use variant schemas 2020-02-17 16:10:50 +01:00
Alexander Larsson 0f028e5329 flatpak_remote_state_lookup_sparse_cache: Use variant schema 2020-02-17 16:10:50 +01:00
Alexander Larsson 8fe634d047 Remove unused flatpak_remote_state_lookup_repo_metadata() 2020-02-17 16:10:50 +01:00
Alexander Larsson 93d44413e6 flatpak_dir_list_all_remote_refs: Implement using variant schemas 2020-02-17 16:10:50 +01:00
Alexander Larsson 00283943f2 flatpak_remote_state_lookup_cache: Implement using variant schemas 2020-02-17 16:10:50 +01:00
Alexander Larsson 4f2c4a5b1c Add schema for some ostree/flatpak variant type and generate header 2020-02-17 16:10:50 +01:00
Alexander Larsson 4046741e5c Add (and dist) variant-schema-compiler to sources 2020-02-17 16:10:50 +01:00
Alexander Larsson 966c6e2a25 CI: Add python3-pyparsing deps 2020-02-17 16:10:50 +01:00
Alexander Larsson ebca05ff10 utils: Add flatpak_bytes_save() 2020-02-17 16:10:50 +01:00
Alexander Larsson 2d2dd37741 flatpak-dir: Fix doc-comment for flatpak_deploy_data_get_subpaths 2020-02-17 16:10:50 +01:00
Piotr Drąg 9610d2ef01 Update Polish translation 2020-02-17 15:41:24 +01:00
Simon McVittie fe2536b844 exports: Add host-etc and host-os keywords
These are subsets of the host keyword, which provide access to operating
system files but not to users' personal files.

In particular, the experimental support for namespace-based sandboxes
in the Steam Runtime[1] uses the graphics stack from the host system,
which requires access to the host /usr/libQUAL, /libQUAL (even if the
host OS has undergone the /usr merge, the canonical paths of ELF
interpreters start with /lib), /etc/ld.so.cache, and for some libraries
on Debian-based systems, /etc/alternatives. It will not be possible to
do similar things in Flatpak without either allowing full host
filesystem access (which exposes personal files, and in any case cannot
be done by the Steam app because it is incompatible with --persist=.),
or adding the ability to expose /usr and related directories without
including the rest of the host filesystem.

To the best of my knowledge, host-etc is not necessary for anything;
I've mainly provided it for symmetry, since it's the other significant
thing that we mount in /run/host and cannot get via --filesystem=/path.

Some notes on the security/privacy implications of the new keywords:

- Neither new keyword allows anything that was not already allowed
  by "host".
- Neither new keyword can allow anything that was not already allowed
  to the user outside the sandbox.
- "host-os" allows enumeration of the installed packages on the host
  system, and often their version numbers too. A malicious app could
  use this to look for exploitable security vulnerabilities on the
  host system. An app could also use this for fingerprinting, although
  this is not a regression, because the systemd/D-Bus machine ID,
  MAC addresses, hostname, kernel boot UUID, DMI product ID and many
  other unique or relatively unique properties are already available
  inside the sandbox.
- "host-os" allows read access, and possibly write access (if the user
  has it outside the sandbox, for example members of group 'staff' in
  older Debian installations), to /usr/local.
- "host-etc" allows reading configuration files whose contents might
  be considered sensitive, such as /etc/passwd.

[1] https://steamcommunity.com/app/221410/discussions/0/1638675549018366706/

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-02-14 15:41:59 +01:00