5220 Commits

Author SHA1 Message Date
Colin Walters
9f5b636990
tests/basic: Skip --no-xattrs if we have selinux
It cannot work to use `--no-xattrs` when SELinux is enabled
because we get a `security.selinux` attribute on created files
regardless.  So just skip this test if true.

Also add some `ostree fsck`s in here which helped me debug
this.
2021-09-06 07:41:01 +00:00
Luca BRUNO
27fcee861a
libtest: tweak selinux/relabel message 2021-09-06 07:41:00 +00:00
Colin Walters
3691a23a41
Merge pull request #2340 from cgwalters/sign-verify-api
Add an API to verify a commit signature explicitly
2021-08-31 08:04:21 -04:00
Colin Walters
359435de84 Add an API to verify a commit signature explicitly
We have a bunch of APIs to do GPG verification of a commit,
but that doesn't generalize to signapi.  Further, they
require the caller to check the signature status explicitly
which seems like a trap.

This much higher level API works with both GPG and signapi.
The intention is to use this in things that are doing "external
pulls" like the ostree-ext tar import support.  There we will
get the commitmeta from the tarball and we want to verify it
at the same time we import the commit.
2021-08-30 13:27:38 -04:00
Luca Bruno
cfa2aec839
Merge pull request #2426 from cgwalters/xattrs-bareuseronly-union
checkout: Also ignore xattrs for union in bare-user-only mode
2021-08-27 07:34:46 +00:00
Luca Bruno
7fb0266df6
Merge pull request #2425 from cgwalters/hardlink-correct-errno
checkout: Save errno when re-throwing
2021-08-27 07:33:27 +00:00
Colin Walters
dd506fe2c8 checkout: Also ignore xattrs for union in bare-user-only mode
Followup to PRs related to https://github.com/ostreedev/ostree/issues/2410

Since the test suite now covers this the test was failing on
a Fedora SELinux enabled host where we see `security.selinux`
even if not in the commit.
2021-08-26 17:42:29 -04:00
Colin Walters
77a86ccba3
Merge pull request #2424 from cgwalters/test-nonroot-ci
ci: Run GH action CI build+test as non-root
2021-08-26 17:25:59 -04:00
Dan Nicholson
6e32084b67
Merge pull request #2422 from cgwalters/allow-none-detached
lib: Change read_commit_detached_metadata to be nullable
2021-08-26 13:33:23 -06:00
Colin Walters
87d115706e checkout: Save errno when re-throwing
I was seeing an `EPERM`  here which was confusing.
It turned out the real error was `EEXIST`.

Since we're referring to the original error, but we do a
lot of computation in the middle, we need to save errno.
2021-08-26 15:17:36 -04:00
Colin Walters
fdeee165f6 ci: Run main GH action CI build+test as non-root
This is really the standard best practice, matching how
e.g. dpkg/rpm work, as well as most local development
environments (including mine) with e.g. `toolbox`.
2021-08-26 14:40:34 -04:00
Colin Walters
3e30e72d33 lib: Change read_commit_detached_metadata to be nullable
Hit this while working on some Rust code.
2021-08-25 21:29:51 -04:00
Colin Walters
28a0792919
Merge pull request #2421 from lucab/ups/auto-txn-fixes
lib: improve transactions auto-cleanup logic
2021-08-25 17:45:28 -04:00
Luca BRUNO
c64b4bceba
lib: improve transactions auto-cleanup logic
This fixes some aspects of OstreeRepoAutoTransaction and re-aligns
it with the logic in flatpak. Specifically:
 * link to the underlying repo through refcounting
 * bridge internal errors to warning messages
 * verify the input pointer type

This is a preparation step before exposing this logic as a public API.
2021-08-25 16:17:52 +00:00
Luca Bruno
30909a28f2
Merge pull request #2418 from lucab/ups/lib-commit-xattrs
commit: automatically skip xattrs in bare-user-only mode
2021-08-24 14:28:39 +00:00
Luca BRUNO
00660eae79
tests: update several bare-user-only checks 2021-08-24 07:56:48 +00:00
Luca BRUNO
3e2360e3bb
lib/commit: automatically skip xattrs in bare-user-only mode 2021-08-24 07:56:46 +00:00
Luca BRUNO
f75552e15c
builtins/commit: set up relevant flags in bare-user-only mode
This detects bare-user-only mode and automatically enables a
commit modifier with relevant flags.
2021-08-24 07:56:19 +00:00
Luca BRUNO
0276f4dc0c
lib/diff: automatically skip xattrs in bare-user-only mode 2021-08-24 07:56:18 +00:00
Luca Bruno
89432b2e2d
Merge pull request #2419 from dbnicholson/gpg-list-keys
bin/remote: Rename list-gpg-keys to gpg-list-keys
2021-08-24 07:55:59 +00:00
Dan Nicholson
58a683f8f0 bin/remote: Rename list-gpg-keys to gpg-list-keys
As pointed out in the original review, `gpg-list-keys` fits better
alongside the existing `gpg-import`.

Changes were done with:

```
git grep -l list-gpg-keys | xargs sed -i 's/list-gpg-keys/gpg-list-keys/'
for src in $(git ls-files '*list-gpg-keys*'); do
  dst=${src/list-gpg-keys/gpg-list-keys}
  git mv "$src" "$dst"
done
```
2021-08-23 15:30:31 -06:00
Colin Walters
452611e4a8
Merge pull request #2417 from lucab/ups/diff-repo-ignore-xattrs
lib/diff: ignore xattrs if disabled on either repos
2021-08-23 10:58:36 -04:00
Luca BRUNO
06ff77cfeb
lib/diff: ignore xattrs if disabled on either repos
This fixes the logic to detect whether xattrs should be automatically
ignored when diffing.
2021-08-23 13:31:13 +00:00
Colin Walters
2f675cf1b1
Merge pull request #2412 from lucab/ups/lib-commit-canonicalize
lib/commit: autofix permissions for bare-user-only
2021-08-20 15:12:21 -04:00
Colin Walters
98f3fe3d8e
Merge pull request #2401 from dbnicholson/gpg-key-info
Remote GPG key info
2021-08-20 15:11:11 -04:00
Luca BRUNO
8a5241dd6a
lib/commit: autofix permissions for bare-user-only
This tweaks commit logic to detect bare-user-only repositories and
canonicalize permissions automatically.
2021-08-20 16:11:04 +00:00
Luca Bruno
3209acbdbe
Merge pull request #2415 from lucab/ups/checksum-canonical-perms
lib/checkout: use canonical permissions in bare-user-only mode
2021-08-19 17:00:14 +00:00
Luca BRUNO
d41fcd17a7
lib/repo/checkout: use canonical perms in bare-user-only mode
This automatically enables canonical permissions for checkouts in
bare-user-only mode.
2021-08-19 16:09:54 +00:00
Luca BRUNO
c6b72f527b
lib/core/checksum: add flag to use canonical permissions
This adds a new `OSTREE_CHECKSUM_FLAGS_CANONICAL_PERMISSIONS`
checksumming flag, which is needed in bare-user-only mode
to ignore local IDs.
2021-08-19 14:08:36 +00:00
Colin Walters
cac4f2133b
Merge pull request #2414 from lucab/ups/cli-commit-modifier-autoptr
builtins/commit: move commit modifier to auto-cleanup
2021-08-18 09:10:17 -04:00
Colin Walters
6cd585774f
Merge pull request #2411 from lucab/ups/cli-commit-errors
builtins/commit: check for conflicting permissions options
2021-08-18 07:59:12 -04:00
Luca BRUNO
b079c11381
builtins/commit: move commit modifier to auto-cleanup
This reduces the usage of goto cleanup logic by porting the commit
modifier pointer to autoptr.
2021-08-18 09:06:26 +00:00
Luca BRUNO
5a3d5fb86f
builtins/commit: check for conflicting permissions options
This explicitly checks for commit command options asking for both
non-zero UID/GID and canonical permissions at the same time,
which are incompatible.
2021-08-18 08:16:26 +00:00
Luca Bruno
87db562744
Merge pull request #2409 from jlebon/pr/cov-fixes
A couple of Coverity fixes
2021-08-04 06:13:37 +00:00
Jonathan Lebon
0f95e4e5ee ostree/dump: Fix free'ing a static string
Reported-by: Seth Arnold <seth.arnold@canonical.com>
2021-08-03 16:49:49 -04:00
Jonathan Lebon
738831c50b lib/sysroot: Fix error message about creating /var/lib
Reported-by: Seth Arnold <seth.arnold@canonical.com>
2021-08-03 16:49:49 -04:00
Jonathan Lebon
75b17937cf lib/sign-dummy: Handle incorrect signatures correctly
We need to check all signatures for one which passes, not just fail on
the first one.

Reported-by: Seth Arnold <seth.arnold@canonical.com>
2021-08-03 16:49:49 -04:00
Colin Walters
a3ce5df22e
Merge pull request #2408 from bgilbert/workflow
workflows: bump lint toolchain; restrict repository access
2021-07-28 20:27:35 -04:00
Benjamin Gilbert
d9483f89ad workflows: limit permissions to reading repo contents
Move the existing docs permissions stanza to the top of the workflow for
consistency.
2021-07-28 18:32:04 -04:00
Benjamin Gilbert
079528971c workflows: bump lint toolchain 2021-07-28 18:30:33 -04:00
Luca Bruno
5023278293
Merge pull request #2406 from liujianqiang-niu/main
fix: Avoid wild pointers
2021-07-28 08:26:45 +00:00
刘建强
28174970c7 fix: Avoid wild pointers
Pointer command is dangerous if there is no assignment.

Log: Avoid wild pointers
2021-07-28 09:40:37 +08:00
Luca Bruno
835b114192
Merge pull request #2407 from smcv/tests-source-date-epoch
tests: Unset SOURCE_DATE_EPOCH
2021-07-26 11:52:06 +00:00
Simon McVittie
2c5fa2cdb6 tests: Unset SOURCE_DATE_EPOCH
Some distributions set this during build in order to have reproducible
builds from the same source code: for example, Debian uses the date
from debian/changelog.

However, some of our tests assume that `ostree commit` will result in
a commit with the current date/time, and SOURCE_DATE_EPOCH breaks that
assumption. Unset it for our build-time tests.

Resolves: https://github.com/ostreedev/ostree/issues/2405
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-07-26 11:48:45 +01:00
Dan Nicholson
81df5c8aba fixup! lib/repo: Add ostree_repo_remote_get_gpg_keys() 2021-07-15 17:03:45 -06:00
Dan Nicholson
814e481fff fixup! bin/remote: Add list-gpg-keys subcommand 2021-07-15 16:25:13 -06:00
Dan Nicholson
30c054b521 fixup! lib/repo: Add ostree_repo_remote_get_gpg_keys() 2021-07-15 16:24:36 -06:00
Dan Nicholson
90a3bda1f8 bin/remote: Include update URLs in list-gpg-keys 2021-07-15 15:50:04 -06:00
Dan Nicholson
27dc5d7d38 lib/repo: Include WKD update URLs in GPG key listing
If the key UID contains a valid email address, include the GPG WKD
update URLs in GVariant returned by ostree_repo_remote_get_gpg_keys().
2021-07-15 15:50:04 -06:00
Dan Nicholson
4fa403aee5 libotutil: Add helper for GPG WKD update URLs
Calculate the advanced and direct update URLs for the key discovery
portion[1] of the OpenPGP Web Key Directory specification, and include
the URLs in the key listing in ostree_repo_remote_get_gpg_keys(). These
URLs can be used to locate updated GPG keys for the remote.

1. https://datatracker.ietf.org/doc/html/draft-koch-openpgp-webkey-service#section-3.1
2021-07-15 15:50:04 -06:00