@@ -121,12 +121,16 @@ pub struct LayeredImageState {
121121 pub merge_commit : String ,
122122 /// The digest of the original manifest
123123 pub manifest_digest : Digest ,
124- /// The image manfiest
124+ /// The image manifest
125125 pub manifest : ImageManifest ,
126126 /// The image configuration
127127 pub configuration : ImageConfiguration ,
128128 /// Metadata for (cached, previously fetched) updates to the image, if any.
129129 pub cached_update : Option < CachedImageUpdate > ,
130+ /// The signature verification text from libostree for the base commit;
131+ /// in the future we should probably instead just proxy a signature object
132+ /// instead, but this is sufficient for now.
133+ pub verify_text : Option < String > ,
130134}
131135
132136impl LayeredImageState {
@@ -230,6 +234,8 @@ pub struct PreparedImport {
230234 pub ostree_commit_layer : Option < ManifestLayerState > ,
231235 /// Any further non-ostree (derived) layers.
232236 pub layers : Vec < ManifestLayerState > ,
237+ /// OSTree remote signature verification text, if enabled.
238+ pub verify_text : Option < String > ,
233239}
234240
235241impl PreparedImport {
@@ -635,6 +641,7 @@ impl ImageImporter {
635641 ostree_layers : component_layers,
636642 ostree_commit_layer : commit_layer,
637643 layers : remaining_layers,
644+ verify_text : None ,
638645 } ;
639646 Ok ( Box :: new ( imp) )
640647 }
@@ -704,7 +711,7 @@ impl ImageImporter {
704711 /// Extract the base ostree commit.
705712 #[ context( "Unencapsulating base" ) ]
706713 pub ( crate ) async fn unencapsulate_base (
707- & mut self ,
714+ & self ,
708715 import : & mut store:: PreparedImport ,
709716 require_ostree : bool ,
710717 write_refs : bool ,
@@ -804,17 +811,19 @@ impl ImageImporter {
804811 let blob = super :: unencapsulate:: decompressor ( & media_type, blob) ?;
805812 let mut archive = tar:: Archive :: new ( blob) ;
806813 importer. import_commit ( & mut archive, Some ( cancellable) ) ?;
807- let commit = importer. finish_import_commit ( ) ;
814+ let ( commit, verify_text ) = importer. finish_import_commit ( ) ;
808815 if write_refs {
809816 repo. transaction_set_ref ( None , & target_ref, Some ( commit. as_str ( ) ) ) ;
810817 tracing:: debug!( "Wrote {} => {}" , target_ref, commit) ;
811818 }
812819 repo. mark_commit_partial ( & commit, false ) ?;
813820 txn. commit ( Some ( cancellable) ) ?;
814- Ok :: < _ , anyhow:: Error > ( commit)
821+ Ok :: < _ , anyhow:: Error > ( ( commit, verify_text ) )
815822 } ) ;
816- let commit = super :: unencapsulate:: join_fetch ( import_task, driver) . await ?;
823+ let ( commit, verify_text) =
824+ super :: unencapsulate:: join_fetch ( import_task, driver) . await ?;
817825 commit_layer. commit = Some ( commit) ;
826+ import. verify_text = verify_text;
818827 if let Some ( p) = self . layer_progress . as_ref ( ) {
819828 p. send ( ImportProgress :: OstreeChunkCompleted (
820829 commit_layer. layer . clone ( ) ,
@@ -977,7 +986,7 @@ impl ImageImporter {
977986 . unwrap_or_else ( || chrono:: offset:: Utc :: now ( ) . timestamp ( ) as u64 ) ;
978987 // Destructure to transfer ownership to thread
979988 let repo = self . repo ;
980- let state = crate :: tokio_util:: spawn_blocking_cancellable_flatten (
989+ let mut state = crate :: tokio_util:: spawn_blocking_cancellable_flatten (
981990 move |cancellable| -> Result < Box < LayeredImageState > > {
982991 use rustix:: fd:: AsRawFd ;
983992
@@ -1090,6 +1099,8 @@ impl ImageImporter {
10901099 } ,
10911100 )
10921101 . await ?;
1102+ // We can at least avoid re-verifying the base commit.
1103+ state. verify_text = import. verify_text ;
10931104 Ok ( state)
10941105 }
10951106}
@@ -1220,6 +1231,8 @@ pub fn query_image_commit(repo: &ostree::Repo, commit: &str) -> Result<Box<Layer
12201231 manifest,
12211232 configuration,
12221233 cached_update,
1234+ // we can't cross-reference with a remote here
1235+ verify_text : None ,
12231236 } ) ;
12241237 tracing:: debug!( "Wrote merge commit {}" , state. merge_commit) ;
12251238 Ok ( state)
0 commit comments