Commit Graph

5489 Commits

Author SHA1 Message Date
Alexander Larsson
6e6c122cb2 Authenticators: Add BasicAuth operation and handle it in transaction
This adds a new way for authenticators to trigger interactive authentication
in the client for simple user/password dialogs. These are not recommended
to use as a webflow is often better. However, for OCI remotes that
use http basic auth this is useful and allows the CLI experience to work
with that.
2019-12-12 12:16:53 +01:00
Alexander Larsson
ba9d607a92 transaction: Rename active_webflow* to active_request*
We want to use this for other types of interactive requests too.
2019-12-12 12:16:53 +01:00
Alexander Larsson
2601b4cb1a utils: Add helpers for text prompts and password prompts 2019-12-12 12:16:53 +01:00
Alexander Larsson
d25f65e968 OCI: Add an authenticator for OCI remotes
Given a configuration like:

[remote "oci-remote"]
url=oci+http://some.server.com/api/v1/organization/foo?index=labels
xa.authenticator-name=org.flatpak.Authenticator.Oci
xa.default-token-type=1
xa.authenticator-options={"auth": <"a-token-here">}

I was able to install an app from an OCI remote that required a login
2019-12-12 12:16:53 +01:00
Alexander Larsson
461a592b8e OCI: Add flatpak_oci_registry_get_token() method
This tries to do a HEAD request to the repository and if that fails
with 401 uses the OCI mechanism to (given a basic auth token) generate
a token for the download.
2019-12-12 12:16:53 +01:00
Alexander Larsson
b1a8852895 authenticator: Pass xa.oci-registry-uri from summary to authenticator
OCI will need this.
2019-12-12 12:16:53 +01:00
Alexander Larsson
73ea55c638 authenticator: Add per-commit summary info
In the non-p2p case add the per-commit summary info into the autheticator
request. This rewrites the keys with a "summary." prefix.

In the p2p case this doesn't make sense, so nothing there.

This will be needed for the OCI case where we need the
xa.oci-repository key.
2019-12-12 12:16:53 +01:00
Alexander Larsson
4dba1c389b authenticator: Add more data to token request
This adds the remote uri, and the per-ref commit id, as well
as extensible per-ref and per-request dicts we can add stuff to
as needed.

These will be used for the OCI case.
2019-12-12 12:16:53 +01:00
Alexander Larsson
976c88cf56 oci: Pass down token into OCI http operations
This is needed for pull operations to actually use the token if one
is given by an authenticator.
2019-12-12 12:16:53 +01:00
Alexander Larsson
6563b83704 Add xa.default-token-type remote option
This allows us to specify on a remote that all refs need a token
2019-12-12 12:16:53 +01:00
Matthias Clasen
54b5e39a96 permission-set: Auto-apply wrapping for data
It is confusing if we explicitly have to specify
the <> GVariant wrapping with --data, but
flatpak permissions strips it when displaying the
result.

Make it transparent by auto-applying the wrapping,
so what you need to pass to --data is the same
as what flatpak permissions shows you.
2019-12-12 09:08:07 +01:00
Matthias Clasen
6f8dc02bca permissions: Don't skip 'empty' rows
Don't skip entries that have no permissions.

I was wasting some time to track down why my
permission-set --data command wasn't working,
when in reality, the permissions command was
just not listing the entries I was adding :(
2019-12-11 17:21:36 +01:00
Matthias Clasen
cdf3c33293 permission-set: Add an option to set data
This is useful for debugging permission store functionality
and will be more so when the openuri portal starts using
per-entry data.
2019-12-11 17:21:36 +01:00
Matthew Leeds
0ab953a2f9 enter: Fix invalid arg error message
I think this was mistakenly changed in commit 4718bcccf.
2019-12-10 14:36:58 +01:00
Matthew Leeds
e0e9996370 doc/flatpak-build-bundle: Add an example for the user installation 2019-12-10 14:36:58 +01:00
Matthias Clasen
e7f0e09783 Merge pull request #3282 from ptomato/various-fixes
Minor fixes
2019-12-06 18:03:12 -05:00
Philip Chimento
3e0a8f296a utils: Fix crash with FlatpakRepoTransaction autoptr cleanup
The autoptr cleanup function for FlatpakRepoTransaction depends on the
OstreeRepo object that it was created with still being alive. If the
repo object is also an autoptr then it can depend on the order the
variables were declared in whether this works or crashes.

That is obviously an evil trap, so have FlatpakRepoTransaction take a
ref on the repo object and release it in the autoptr cleanup function,
in case the repo's autoptr cleanup function runs before that of
FlatpakRepoTransaction.
2019-12-06 13:26:49 -08:00
Philip Chimento
cbf1cc0e1d transaction: Fix transfer annotation on get_status()
flatpak_transaction_progress_get_status() returns a pointer created by
g_strdup() but was annotated transfer-none. A quick grep shows that
calling code in the tests does treat it as transfer-full, so change the
annotation to match the actual behaviour.
2019-12-06 13:26:49 -08:00
Philip Chimento
923beec024 Change "update-frequency" to "update-interval"
An event happens more often as its frequency gets higher, so these
values were confusing me.

Rename the constants to include their unit (ms) as well, to avoid
confusion.

Anything that affects public API (such as
flatpak_transaction_progress_set_update_frequency()) or libostree's
options passed to ostree_repo_pull_with_options(), is left as is.
2019-12-06 13:26:49 -08:00
Philip Chimento
0da49895ab Alphabetize and standardize some header includes
Cleanup commit, doesn't change functionality, but we'll be adding some
files to these lists in a subsequent commit.
2019-12-06 13:26:49 -08:00
Matthias Clasen
9b3156fb49 Merge pull request #3280 from flatpak/dont-reset-gerror
installation: Don't re-use a GError pointer
2019-12-06 08:33:29 -05:00
Matthew Leeds
dded404c33 installation: Don't re-use a GError pointer
Here we're using the same GError pointer multiple times without clearing
it, which is an error. Use a local_error and print a debug message
instead, which matches the behavior in the loop above.
2019-12-05 17:00:59 -08:00
Matthias Clasen
44b6bc7f98 Merge pull request #3259 from uajain/uajain/cache-remote-state
installation: Cache remote states while querying installed refs
2019-12-04 11:48:47 -05:00
Umang Jain
4ab74d07c0 installation: Cache remote states while querying installed refs
Cache remote state so that each remote is only queried once
for getting its state.

Follow up from https://github.com/flatpak/flatpak/pull/3204#discussion_r349642324
2019-12-04 18:22:23 +05:30
Alexander Larsson
849f448732 portal: Allow the ALLOW_A11Y flag
This was accidentally left out of the FLAGS_ALL define so it was denied.
2019-12-04 13:41:20 +01:00
Matthias Clasen
2166913eb1 Update flatpak ps docs
Mention the new columns.
2019-12-04 13:33:52 +01:00
Matthias Clasen
5ec73b9a9a ps: Allow showing compositor info
Show active and background state, based on information obtained
from the background portal backend about which apps have (active) windows.

This currently tries all known portal backends in turn. It might
be nicer to have a portal frontend api to query this, or to find
out which backend to talk to.
2019-12-04 13:33:52 +01:00
Matthias Clasen
653fce251f cli: Don't use \r in plain output
These show up as ^M in test logs, and that is irritating.
Just use \n when producing plain output.

Closes: https://github.com/flatpak/flatpak/issues/3226
2019-12-04 13:30:13 +01:00
Matthias Clasen
2dc0554f10 Merge pull request #3277 from mwleeds/minor-doc-fixes
common: Minor doc fixes
2019-12-03 09:04:19 -05:00
Matthew Leeds
17660cab57 common: Minor doc fixes 2019-12-02 18:16:44 -08:00
Matthias Clasen
d4a3897d5e Merge pull request #3276 from mwleeds/gitignore-test-auth
Update .gitignore for tests directory
2019-12-02 20:29:52 -05:00
Matthew Leeds
59aee7b9b9 .gitignore: Use full path for test-update-portal and test-portal-impl 2019-12-02 15:09:37 -08:00
Matthew Leeds
248029ceb8 .gitignore: Add tests/test-authenticator 2019-12-02 15:06:45 -08:00
Matthias Clasen
91217ecb24 doc: Fix a duplicate section
In commit 88aaaab7b, I overlooked that there
was already a doc comment for the flatpak-version-macros
section at the bottom. To make things worse,
the duplicate I added was malformed.
Fix things up to work as intended.
2019-12-02 07:45:51 -05:00
Matthias Clasen
eb3eff11ae Merge pull request #3274 from matthiasclasen/nread-overflow
Fix a case of signed/unsigned confusion
2019-12-02 07:29:29 -05:00
Matthias Clasen
d580dd71cf Merge pull request #3268 from matthiasclasen/doc-updates
Doc updates
2019-12-02 07:29:12 -05:00
Matthias Clasen
4765a78a87 Merge pull request #3270 from matthiasclasen/parent-pid-docs
run: Improve help output for --parent-pid
2019-12-02 07:28:28 -05:00
Matthias Clasen
b76a1bd0df Merge pull request #3265 from matthiasclasen/ps-instance
ps: Don't hardcode instance column
2019-12-02 07:27:23 -05:00
Matthias Clasen
a2424c0c33 Merge pull request #3269 from matthiasclasen/info-docs
info: Add an example to the man page
2019-12-02 07:26:59 -05:00
Matthias Clasen
4201a35081 Merge pull request #3266 from matthiasclasen/fail-message-period
Error message cosmetics
2019-12-02 07:26:41 -05:00
Matthew Leeds
3f81c0f61d Merge pull request #3275 from matthiasclasen/enter-help
enter: Correct the help output
2019-12-01 20:33:03 -08:00
Matthias Clasen
176f7dfd8d Merge pull request #3273 from mwleeds/persist-option-docs
context: Improve description of --persist
2019-12-01 23:31:56 -05:00
Matthias Clasen
76d23cca15 enter: Correct the help output
The COMMAND is not optional, so don't put it in brackets.

Closes: https://github.com/flatpak/flatpak/issues/2881
2019-12-01 23:14:27 -05:00
Matthias Clasen
e04263ca5c Fix a case of signed/unsigned confusion
G_input_stream_read_finish returns a gssize,
which we must not store in a gsize, since it
may be -1.

Closes: https://github.com/flatpak/flatpak/issues/2885
2019-12-01 23:01:10 -05:00
Matthew Leeds
ed945a1175 Merge pull request #3272 from matthiasclasen/readme-updates
README.md: Some updates
2019-12-01 19:38:11 -08:00
Matthew Leeds
948628f644 Merge pull request #3271 from matthiasclasen/permission-docs
docs: Add flatpak permissions-set to command list
2019-12-01 19:36:21 -08:00
Matthew Leeds
3211b537b5 doc/flatpak-permission-set: Add reference to permission-show 2019-12-01 19:08:58 -08:00
Matthew Leeds
d5909171bb context: Improve description of --persist
The --persist option makes a subpath in the user's home directory
available in the sandbox. Make the description more clear accordingly.
2019-12-01 15:50:29 -08:00
Matthias Clasen
a3185b44ac README.md: Some updates
Fix the link to bubblewrap, reword a few things, and
explain a few more components.
2019-12-01 16:56:21 -05:00
Matthias Clasen
d26d5edac0 doc: Fix a copy-paste error
Fix some ids in the flatpak-ps man page.
2019-12-01 16:49:36 -05:00