Commit Graph
5281 Commits
Author SHA1 Message Date
Alexander Larsson 62529fa0ce ci: Drop --trace from make check
Its really hard to read the output with all this spew
2019-10-09 14:25:44 +02:00
Alexander Larsson 227cde12ba tests: Redo httpd server setup
Rather than this weird shell loop with a timeout and polling we
move the httpd spawning entirely into the python code, and use
a pipe to synchronize the spawning. This way we can also use
the shell job control to properly clean up any running processes
from the test suite.

Additionally, this adds some (lame) support for token handling in the
test webserver, where you for any file foo can create a foo.need_token
containing a token that is needed for that file.
2019-10-09 14:25:44 +02:00
Matthias Clasen cee0d81d1b Merge pull request #3158 from uajain/uajain/add-missing-getters
Add a couple of missing getters
2019-10-08 07:26:08 -04:00
Umang Jain 11631f9514 transaction: Add getter for querying no-pull
As this is a required to deploy autoupdates downloaded in the
background, for clients like gnome-software.
2019-10-08 15:21:09 +05:30
Umang Jain c7670e87d7 transaction: Add getter for querying no-deploy
FlatpakTransaction inherently doesn't differentiate between a
autoupdate and a regular update; both are
FLATPAK_TRANSACTION_OPERATION_UPDATE.

This getter can help differentiate between a regular update
and autoupdate in clients like gnome-software. Autoupdates
work in two separate transaction passes; first that runs with
"no-deploy" and the second pass that deploys all the downloaded
update (i.e. with "no-pull").
2019-10-08 15:21:03 +05:30
Matthias Clasen a1f128a6f0 Merge pull request #3157 from pwithnall/parental-translations
po: Add some translations for parental controls strings
2019-10-07 15:14:24 -04:00
Matthias Clasen 804aaeea83 Merge pull request #3156 from alexlarsson/py3-tests
tests: Convert all tests to python3
2019-10-07 14:44:15 -04:00
Philip Withnall 6cdd216e8d po: Add some translations for parental controls strings
These are from paid-for translations from Endless’ downstream copy of
flatpak. I don’t know the original authors, and don’t know if the
translations are correct. (They should be though.)

Probably better than having no translations for these strings in
upstream flatpak, for the moment.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-07 19:32:22 +01:00
Alexander Larsson 2b6641575d tests: Convert all tests to python3
Python2 is pretty much dead, lets make us only use python3.
2019-10-07 11:38:24 +02:00
Matthias Clasen b2c471ca5a Merge pull request #3153 from matthiasclasen/fix-remotes-d
Fix a doc typo
2019-10-04 09:46:07 -04:00
Matthias Clasen 3910cff1a3 Merge pull request #3154 from AsciiWolf/l10n
Update Czech translation
2019-10-04 09:45:51 -04:00
AsciiWolf 13cb348e67 Update Czech translation 2019-10-04 13:58:22 +02:00
Matthias Clasen 8a338dff32 Fix a doc typo
The docs refer to flatpakref files in /etc/flatpak/remotes.d,
but the code is looking for flatpakrepo files there.
2019-10-03 22:23:30 -04:00
Matthias Clasen 9999d0294d Merge pull request #3151 from piotrdrag/piotrdrag/update-potfiles-191003
Update POTFILES.in 191003
2019-10-03 13:42:46 -04:00
Piotr Drąg 5044413de1 Update POTFILES.in 2019-10-03 19:18:27 +02:00
Philip Withnall 1e589c1b74 github: Add malcontent (parental controls) support to CI build
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-03 13:54:37 +02:00
Philip Withnall 7c9d609399 system-helper: Tweak documentation for parental controls
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-03 13:54:37 +02:00
Philip Withnall 62b0d3f4f1 common: Bump version numbers for new parental controls API
The PR was written before 1.5.0 was released, but was then merged after
1.5.0 was released — so bump the version numbers to 1.5.1.

See https://github.com/flatpak/flatpak/pull/2797.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-03 13:54:37 +02:00
Alexander Larsson c4e6c32f68 Remove old CI system 2019-10-03 11:42:33 +02:00
Philip Withnall c40223267c error: Add a ‘permission denied’ error code
This will be used for parental controls, and potentially other reasons
for denying installation of an app.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-03 10:42:04 +02:00
Philip Withnall de1759e2b4 utils: Add missing D-Bus error serialisation
FLATPAK_ERROR_REF_NOT_FOUND was missing its serialisation for sending
over D-Bus.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-03 10:42:04 +02:00
Philip Withnall d9d3ab9030 ci: Build with malcontent enabled
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-03 10:42:04 +02:00
Philip Withnall 9758968cc4 dir: Support filtering app installs/upgrades by user’s OARS settings
Use the user’s OARS filter to prevent installation or upgrade of
apps which have more extreme content than the user is allowed to see.

This uses libmalcontent to load the user’s enforced OARS filter, which
describes the extremeness of each type of content the user is allowed to
see. If an app they are trying to install exceeds the filter value in
any OARS section, installation is disallowed and an error is returned.

libmalcontent stores the parental controls policy per-user in
accountsservice, which enforces access control on the policies.

The app filter is also allowed to prevent app installation entirely,
which overrides the OARS values. This is independent from the app-install
polkit action, which determines whether an unprivileged user may install
an app system-wide. Being stored in accountsservice, the new boolean is
also easier to set per-user without having to programmatically write a
polkit JS policy file which handles multiple users (and parse it back
again).

The parental controls checks are done at deploy time, either in the
`flatpak` process (for user repositories) or in the
`flatpak-system-helper` (for system repositories). The checks use
content rating data extracted from the app’s AppData XML and stored in
the `FlatpakDeploy` cache. The checks are passed through polkit (even
for user repositories) so that users can get an admin override to
install apps which would otherwise be too extreme. This uses the new
`org.freedesktop.Flatpak.parental-controls` polkit rule.

The checks have to be done at deploy time, as that’s when the AppData
XML for the app is parsed. The downside of this arrangement is that an
app must be entirely downloaded before the parental checks can be done.
This won’t be much of an issue on normal desktops, however, since we can
assume that gnome-software will check an app’s appropriateness before
showing it to the user in the first place.

Parental controls are not enforced for non-apps/runtimes, which includes
the ostree-metadata and appstream/* refs.

One thorny issue is that flatpak unit tests may be run in an environment
with no system D-Bus available to connect to (a Jenkins instance, for
example), which means the call to `mct_manager_get_app_filter()` in
`flatpak_dir_check_parental_controls()` fails.

So this commit skips the parental controls check if the system bus is
unavailable and the environment variable
`FLATPAK_SYSTEM_HELPER_ON_SESSION` is set, since the testlibrary already
sets that variable so that the system-helper will be started on the
session bus.

The feature can be tested using something like:
```
   $ malcontent-client set philip \
       violence-realistic=none app/org.freedesktop.Bustle/x86_64/stable
   App filter for user 1000 set
   $ flatpak run org.freedesktop.Bustle
   error: Running app/org.freedesktop.Bustle/x86_64/stable is not allowed by the policy set by your administrator
   $ flatpak --user install flathub io.github.FreeDM
   error: Failed to install io.github.FreeDM: Installing app/io.github.FreeDM/x86_64/stable is not allowed by the policy set by your administrator
```

Includes work by André Magalhães and Umang Jain.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-03 10:42:04 +02:00
Philip Withnall 8bd8bdcbcc flatpak-dir: Add content rating support to deploy data
This will be used in upcoming commits to enforce parental controls on
app installations.

We extend version 2 of the deploy data format because it has not
appeared in a release yet.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://github.com/flatpak/flatpak/pull/2797
2019-10-03 10:42:04 +02:00
Philip Withnall 4113ffa007 flatpak-installed-ref: Add support for storing app content ratings
This will be used by upcoming commits to filter app installation by
content rating.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://github.com/flatpak/flatpak/pull/2797
2019-10-03 10:42:04 +02:00
Philip Withnall 0e53094645 flatpak-appdata: Add support for extracting app content ratings
This will be used in upcoming commits to enforce parental controls on
app installations.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://github.com/flatpak/flatpak/pull/2797
2019-10-03 10:42:04 +02:00
Philip Withnall ab5c0968e6 flatpak-run: Add parental controls support for filtering apps
Prevent the user from running a flatpak app if that app is filtered by
the parental controls applied to the user.

If flatpak is running as a system user (UID < 1000), ignore failure to
load the app filter. This could happen if a flatpak is run in the
gnome-initial-setup session, before the user’s account is created.

Includes contributions by André Magalhães.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://github.com/flatpak/flatpak/pull/2797
2019-10-03 10:42:04 +02:00
Philip Withnall c16d6f9166 common: Split LIBADD onto multiple lines and sort alphabetically
Also sort CFLAGS alphabetically. This will reduce the likelihood of
merge conflicts in future. This assumes the libraries and CFLAGS are
independent of each other.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-03 10:42:04 +02:00
Alexander Larsson da66eddd26 Post release version bump to 1.5.1 2019-10-03 10:02:17 +02:00
Alexander Larsson 72d7d456e4 Update pofiles for release 1.5.0 2019-10-03 09:38:18 +02:00
Alexander Larsson 9e9c202afa Fix distcheck 2019-10-02 17:33:08 +02:00
Alexander Larsson c6a20dcfd5 NEWS: Update for release 2019-10-02 16:55:45 +02:00
Alexander Larsson 47d6ea12b5 tests: Remove leftover debug stuff 2019-10-02 16:53:58 +02:00
Alexander Larsson a24a30ed17 NEWS: Import from 1.4 branch 2019-10-02 16:39:47 +02:00
Alexander Larsson 930b3d673d Fix detection of exported dbus-services with dbus-broker
Rather than unlinking and symlinking the new value we symling into
a temporary name and then atomically renames on top of the (possibly)
pre-existing file.

This has two advantages. First it is atomic, whereas the previous code
could end up removing the old code without creating the new one, and
secondly this will generate a move inotify event which is what dbus-broker
uses to detect changes in the services file directory.

Fixes https://github.com/flatpak/flatpak/issues/3145
2019-10-02 16:38:24 +02:00
Alexander Larsson 65bbd6c761 update-portal: Update docs
Mention permission issue and progress guarantees.
2019-10-02 14:57:11 +02:00
Alexander Larsson 4eb213a39a update-portal: Add tests with changed permission errors 2019-10-02 14:57:11 +02:00
Alexander Larsson 05df609e75 update portal: Don't allow self-updates if new permissions are needed
In this case we report a NotSupported error (not permission denied, because
that is used for other things).
2019-10-02 14:57:11 +02:00
Alexander Larsson 13be8b6365 common: Add flatpak_context_adds_permissions()
We want to use this in the update portal to catch the case
when some new permission was added and disallow self-updates in this case.
2019-10-02 14:57:11 +02:00
Alexander Larsson ade1b299e7 tests: Test masking in updates portal
If the app is masked it should neither report updates or update
itself. Test this.
2019-10-02 14:57:11 +02:00
Alexander Larsson 1eb68628ba update-portal: Don't report updates for masked refs 2019-10-02 14:57:11 +02:00
Alexander Larsson ea67fd8bb0 Export (private) flatpak_installation_get_dir()
We'll need this for the update portal work.
2019-10-02 14:57:11 +02:00
Alexander Larsson d942b47b64 tests: Remove some unused code in update-portal test 2019-10-02 14:57:11 +02:00
Alexander Larsson 714f13a6a0 tests: Test self-update via the update-portal
We test a successful update, a null update and a failed update.
2019-10-02 14:57:11 +02:00
Alexander Larsson 91d9fe9c60 tests: Add simple testing portal backend and wire it up to the tests
This only supports the AccessDialog call, and always just allows
everything. Still, it tests the entire codepath for authentication.
2019-10-02 14:57:11 +02:00
Alexander Larsson a95cf667a1 update-portal: Clean up details in progress reporting
Always report op/n_ops as their last values.
Ensure we never send op >= n_ops
Ensure we always send one and only one 100% running status (== op done)
2019-10-02 14:57:11 +02:00
Alexander Larsson 00921c2dba update-portal: Don't send weird glib encoded errors
If we don't have a registred dbus error, just send a generic
org.freedesktop.DBus.Error.Failed.
2019-10-02 14:57:11 +02:00
Alexander Larsson a87aaac4b1 update-portal: Allow overriding portals directory
Allow overriding $datadir/xdg-desktop-portal/portals using the
$XDG_DESKTOP_PORTAL_DIR env var. We will need this in the test suite when
we want to pass in our own (faked) portal implementation.
2019-10-02 14:57:11 +02:00
Alexander Larsson 21bc4fc29b update-portal: Use error_message, not error-message
All other places use underscores instead of dashes.
2019-10-02 14:57:11 +02:00
Alexander Larsson 6cb11631c5 update-portal: Don't fail if permission store not available
This downgrades g_warning to g_info, so that we don't fail if the
permission store is not available, which will happen in the test-suite.
2019-10-02 14:57:11 +02:00