Skip to content

tests: Check a metalink pull rejects an invalid summary signature - #3693

Closed
mardgez wants to merge 6 commits into
ostreedev:mainfrom
mardgez:pull-metalink-verify-summary
Closed

mardgez wants to merge 6 commits into
ostreedev:mainfrom
mardgez:pull-metalink-verify-summary

Conversation

@mardgez

@mardgez mardgez commented Nov 12, 2026 •

Copy link
Copy Markdown

Builds on #3692, whose second commit now also verifies the summary a metalink provides. The first version of this PR made that change; with it in #3692, this PR is down to the test.

#3692 checks that a pull of a valid signed summary through a metalink succeeds. This adds the negative case: with sign-verify-summary=true and an invalid summary.sig, a pull through the metalink fails with "No signatures found". On the code before #3692 that pull succeeds without the signature being checked, so this covers the metalink path of the fix.

It shows #3692's commits until that merges; only the last commit is new.

Mar and others added 5 commits November 12, 2026 18:19
With a remote configured with sign-verify-summary=true, a pull that
fetched a summary.sig but no summary did not fail: only a missing
summary.sig was an error, and the signature check itself only runs when
both are present. The pull then resolved the requested refs from the
unsigned refs/heads/ files served by the remote, so the summary
signature was never checked.

The GPG path already fails in this case ("GPG verification enabled, but
no summary found"), as does ostree_repo_remote_fetch_summary_with_options()
for both GPG and the sign API via _ostree_repo_verify_summary(). Do the
same for the sign API in ostree_repo_pull_with_options().

Extend tests/test-signed-pull-summary.sh with a remote serving
summary.sig but no summary; the pull succeeded before this change.

Signed-off-by: Colin Walters <walters@verbum.org>
ostree_repo_pull_with_options() carried its own copies of the summary
signature checks for GPG and for the sign API, apart from
_ostree_repo_verify_summary(), which
ostree_repo_remote_fetch_summary_with_options() uses. The copies had
drifted: the sign API one lacked the missing summary check (fixed in the
previous commit), and the retry after a cached summary failed
verification only re-checked the engine whose check had failed, so with
both gpg-verify-summary and sign-verify-summary enabled, a summary
refetched after a failed sign API check was never GPG verified. Neither
retry handled a refetch that found no summary: the GPG one passed NULL
to ostree_repo_verify_summary(), which failed on a critical warning
without setting an error, and the sign API one left it to each engine
to reject NULL data.

Use _ostree_repo_verify_summary() for both the first check and the
retry, so the pull and fetch-summary paths apply the same rules to every
engine. The pull now reports a missing summary or summary.sig with the
same messages as fetching the summary does (GPG error codes are
unchanged; a missing summary.sig under the sign API is now
G_IO_ERROR_NOT_FOUND, like a missing summary). In builds without GPGME,
a remote with gpg-verify-summary=true now fails the pull, as fetching
its summary already did, instead of skipping the check.

Add a missing summary case to tests/test-pull-summary-sigs.sh for the
GPG side.

Signed-off-by: Colin Walters <walters@verbum.org>
The delta index isn't covered by the signed summary, so a mirror can
serve a superblock and part whose op stream opens more objects than the
part declares. open_output_target() and dispatch_open() then hit
g_assert and abort the pulling process instead of failing the pull.

Turn those asserts into errors so a bad delta part is rejected cleanly.

Signed-off-by: Colin Walters <walters@verbum.org>
Signed-off-by: Colin Walters <walters@verbum.org>
Signed-off-by: Colin Walters <walters@verbum.org>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The broadened mode guard permits BARE_SPLIT_XATTRS deltas to publish file objects without required xattr records, causing subsequent loads with xattrs to fail.

1 open issue
What changed in this PR

This PR fixes summary signature verification for metalink pulls with an empty cache, following up on #3692. It verifies the fetched summary bytes and releases the existing summary variant before rebuilding it.

Changes:

  • Add signed-metalink and missing-summary regression coverage.
  • Consolidate summary verification and cached-summary retry handling.
  • Include static-delta validation changes and a development version bump to 2026.8.
File Description
tests/​test-signed-pull-summary.sh Add missing-summary and signed-metalink tests for dummy and ed25519 engines.
tests/​test-pull-summary-sigs.sh Add a missing-summary test with GPG verification enabled.
src/​libostree/​ostree-repo-static-delta-processing.c Replace assertions with errors for invalid delta state and repository modes.
src/​libostree/​ostree-repo-pull.c Verify metalink summary bytes and consolidate verification handling.
configure.ac Bump the development version to 2026.8.

Review effort: Balanced

g_assert (repo->mode == OSTREE_REPO_MODE_BARE || repo->mode == OSTREE_REPO_MODE_BARE_USER
|| repo->mode == OSTREE_REPO_MODE_BARE_USER_ONLY);
}
if (!state->stats_only && !_ostree_repo_mode_is_bare (repo->mode))
A remote with a metalink gets its summary through the metalink, before
the normal summary download, and on a pull with nothing cached the
summary signature check used to be skipped on that path.
test-signed-pull-summary.sh covers a valid signed summary via a
metalink; add the matching negative case: with sign-verify-summary
enabled and an invalid summary.sig, a pull through the metalink must
fail.
@mardgez
mardgez force-pushed the pull-metalink-verify-summary branch from a9d30df to b085db8 Compare November 13, 2026 04:45
@mardgez mardgez changed the title pull: Verify the summary a metalink fetched tests: Check a metalink pull rejects an invalid summary signature Nov 13, 2026
@cgwalters

Copy link
Copy Markdown
Member

The latest in #3693 should contains a fix for this that was done in a different way

@cgwalters

Copy link
Copy Markdown
Member

Merged into that PR

@cgwalters cgwalters closed this Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants