Skip to content

Conversation

@alexlarsson
Copy link
Member

I'm working on some changes in rpm-ostree (will link later) that uses the signature support and the composefs digest. This is a set of changes that:

  • Fixes a double free in ostree_sign_set_sk()
  • Annotates (for binding) return value of ostree_blob_reader_read_blob as nullable
  • Adds Ostree.BlobReader to rust bindings
  • Adds GLib.VariantDict to rust bindings, allowing ostree_repo_commit_add_composefs_metadata() to be callable
  • Regenerates rust binding and bumps version to 0.20.5 so the above is usable.

@github-actions github-actions bot added the area/rust-bindings Relates to the Rust bindings for the C library label Sep 26, 2025
When the gvariant is G_VARIANT_TYPE_BYTESTRING we need to duplicate
the data we get from g_variant_get_fixed_array(), otherwise we will
double-free it when we later free sign->secret_key.
This adds api docs to ostree_blob_reader_read_blob() so that we
can mark the return value as nullable. This is needed, because
this function can return NULL without setting error, and this
needs to be handled in bindings (such as the rust ones).
This adds GLib.VariantDict, which is needed for
ostree_repo_commit_add_composefs_metadata(), and OSTree.BlobReader
which are needed for ostree_sign_read_sk().

With these we can sign ostree commits with composefs digests in them.
This adds the new bindings for signing and composefs use.
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a memory safety fix for signature handling and updates the Rust bindings. The changes in ostree_sign_ed25519.c and ostree_sign-spki.c address a potential use-after-free vulnerability by copying secret key data. The Rust bindings are regenerated to expose Ostree.BlobReader and GLib.VariantDict, and to correctly handle the nullable return from ostree_blob_reader_read_blob. My review of the changes did not identify any issues.

alexlarsson added a commit to alexlarsson/rpm-ostree that referenced this pull request Sep 26, 2025
This adds a new --sign-commit CLI option to `rpm-ostree experimental
compose build-chunked-oci` which signs the embedded ostree commit.

With this, it is possible (with some care) to layer a signed bootc
image that uses old-school signed ostree/composefs support.

Note, this relies on the double free fix for ostree_sign_set_sk() in
ostreedev/ostree#3527 to work.
alexlarsson added a commit to alexlarsson/rpm-ostree that referenced this pull request Sep 26, 2025
This adds a new --sign-commit CLI option to `rpm-ostree experimental
compose build-chunked-oci` which signs the embedded ostree commit.

With this, it is possible (with some care) to layer a signed bootc
image that uses old-school signed ostree/composefs support.

Note, this relies on the double free fix for ostree_sign_set_sk() in
ostreedev/ostree#3527 to work.
@cgwalters cgwalters merged commit b3fbab5 into ostreedev:main Sep 26, 2025
24 of 26 checks passed
@alexlarsson
Copy link
Member Author

@cgwalters How do we get 0.20.5 rust bindings released?

@cgwalters
Copy link
Member

#3529

alexlarsson added a commit to alexlarsson/rpm-ostree that referenced this pull request Oct 3, 2025
This adds a new --sign-commit CLI option to `rpm-ostree experimental
compose build-chunked-oci` which signs the embedded ostree commit.

With this, it is possible (with some care) to layer a signed bootc
image that uses old-school signed ostree/composefs support.

Note, this relies on the double free fix for ostree_sign_set_sk() in
ostreedev/ostree#3527 to work.
alexlarsson added a commit to alexlarsson/rpm-ostree that referenced this pull request Oct 3, 2025
This adds a new --sign-commit CLI option to `rpm-ostree experimental
compose build-chunked-oci` which signs the embedded ostree commit.

With this, it is possible (with some care) to layer a signed bootc
image that uses old-school signed ostree/composefs support.

Note, this relies on the double free fix for ostree_sign_set_sk() in
ostreedev/ostree#3527 to work.
alexlarsson added a commit to alexlarsson/rpm-ostree that referenced this pull request Oct 15, 2025
This adds a new --sign-commit CLI option to `rpm-ostree experimental
compose build-chunked-oci` which signs the embedded ostree commit.

With this, it is possible (with some care) to layer a signed bootc
image that uses old-school signed ostree/composefs support.

Note, this relies on the double free fix for ostree_sign_set_sk() in
ostreedev/ostree#3527 to work.
alexlarsson added a commit to alexlarsson/rpm-ostree that referenced this pull request Oct 15, 2025
This adds a new --sign-commit CLI option to `rpm-ostree experimental
compose build-chunked-oci` which signs the embedded ostree commit.

With this, it is possible (with some care) to layer a signed bootc
image that uses old-school signed ostree/composefs support.

Note, this relies on the double free fix for ostree_sign_set_sk() in
ostreedev/ostree#3527 to work.
alexlarsson added a commit to alexlarsson/rpm-ostree that referenced this pull request Oct 15, 2025
This adds a new --sign-commit CLI option to `rpm-ostree experimental
compose build-chunked-oci` which signs the embedded ostree commit.

With this, it is possible (with some care) to layer a signed bootc
image that uses old-school signed ostree/composefs support.

Note, this relies on the double free fix for ostree_sign_set_sk() in
ostreedev/ostree#3527 to work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/rust-bindings Relates to the Rust bindings for the C library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants