@@ -62,8 +62,7 @@ fn build_auth(reference: &Reference) -> RegistryAuth {
62
62
Err ( CredentialRetrievalError :: NoCredentialConfigured ) => RegistryAuth :: Anonymous ,
63
63
Err ( e) => {
64
64
log:: info!(
65
- "Error retrieving docker credentials: {}. Using anonymous auth" ,
66
- e
65
+ "Error retrieving docker credentials: {e}. Using anonymous auth"
67
66
) ;
68
67
RegistryAuth :: Anonymous
69
68
}
@@ -87,7 +86,7 @@ async fn setup_trust_repository(cli: &Cli) -> Result<Box<dyn TrustRoot>, anyhow:
87
86
match SigstoreTrustRoot :: new ( None ) . await {
88
87
Ok ( repo) => return Ok ( Box :: new ( repo) ) ,
89
88
Err ( e) => {
90
- log:: warn!( "Failed to initialize TUF trust repository: {}" , e ) ;
89
+ log:: warn!( "Failed to initialize TUF trust repository: {e}" ) ;
91
90
log:: info!( "Falling back to manual trust repository" ) ;
92
91
}
93
92
}
@@ -104,10 +103,10 @@ async fn setup_trust_repository(cli: &Cli) -> Result<Box<dyn TrustRoot>, anyhow:
104
103
log:: info!( "Added Rekor public key" ) ;
105
104
data. rekor_keys . push ( content) ;
106
105
}
107
- Err ( e) => log:: warn!( "Failed to read Rekor public keys file: {}" , e ) ,
106
+ Err ( e) => log:: warn!( "Failed to read Rekor public keys file: {e}" ) ,
108
107
}
109
108
} else {
110
- log:: warn!( "Rekor public keys file not found: {:?}" , rekor_keys_path ) ;
109
+ log:: warn!( "Rekor public keys file not found: {rekor_keys_path :?}" ) ;
111
110
}
112
111
}
113
112
@@ -126,15 +125,14 @@ async fn setup_trust_repository(cli: &Cli) -> Result<Box<dyn TrustRoot>, anyhow:
126
125
log:: info!( "Added Fulcio certificate" ) ;
127
126
data. fulcio_certs . push ( cert) ;
128
127
}
129
- Err ( e) => log:: warn!( "Failed to parse Fulcio certificate: {}" , e ) ,
128
+ Err ( e) => log:: warn!( "Failed to parse Fulcio certificate: {e}" ) ,
130
129
}
131
130
}
132
- Err ( e) => log:: warn!( "Failed to read Fulcio certificates file: {}" , e ) ,
131
+ Err ( e) => log:: warn!( "Failed to read Fulcio certificates file: {e}" ) ,
133
132
}
134
133
} else {
135
134
log:: warn!(
136
- "Fulcio certificates file not found: {:?}" ,
137
- fulcio_certs_path
135
+ "Fulcio certificates file not found: {fulcio_certs_path:?}"
138
136
) ;
139
137
}
140
138
}
@@ -143,7 +141,7 @@ async fn setup_trust_repository(cli: &Cli) -> Result<Box<dyn TrustRoot>, anyhow:
143
141
}
144
142
145
143
async fn verify_image_signature ( cli : & Cli , image_reference : & str ) -> Result < bool , anyhow:: Error > {
146
- log:: info!( "Verifying signature for {}" , image_reference ) ;
144
+ log:: info!( "Verifying signature for {image_reference}" ) ;
147
145
148
146
// Set up the trust repository based on CLI arguments
149
147
let repo = setup_trust_repository ( cli) . await ?;
@@ -175,7 +173,7 @@ async fn verify_image_signature(cli: &Cli, image_reference: &str) -> Result<bool
175
173
match client. triangulate ( & image_ref, auth) . await {
176
174
Ok ( ( sig_image, digest) ) => ( sig_image, digest) ,
177
175
Err ( e) => {
178
- log:: warn!( "Failed to triangulate image: {}" , e ) ;
176
+ log:: warn!( "Failed to triangulate image: {e}" ) ;
179
177
return Ok ( false ) ; // No signatures found
180
178
}
181
179
} ;
@@ -187,13 +185,13 @@ async fn verify_image_signature(cli: &Cli, image_reference: &str) -> Result<bool
187
185
{
188
186
Ok ( layers) => layers,
189
187
Err ( e) => {
190
- log:: warn!( "Failed to get trusted signature layers: {}" , e ) ;
188
+ log:: warn!( "Failed to get trusted signature layers: {e}" ) ;
191
189
return Ok ( false ) ;
192
190
}
193
191
} ;
194
192
195
193
if signature_layers. is_empty ( ) {
196
- log:: warn!( "No valid signatures found for {}" , image_reference ) ;
194
+ log:: warn!( "No valid signatures found for {image_reference}" ) ;
197
195
return Ok ( false ) ;
198
196
}
199
197
@@ -229,16 +227,14 @@ async fn verify_image_signature(cli: &Cli, image_reference: &str) -> Result<bool
229
227
// Verify the constraints
230
228
match verify_constraints ( & signature_layers, verification_constraints. iter ( ) ) {
231
229
Ok ( ( ) ) => {
232
- log:: info!( "Signature verification successful for {}" , image_reference ) ;
230
+ log:: info!( "Signature verification successful for {image_reference}" ) ;
233
231
Ok ( true )
234
232
}
235
233
Err ( SigstoreVerifyConstraintsError {
236
234
unsatisfied_constraints,
237
235
} ) => {
238
236
log:: warn!(
239
- "Signature verification failed for {}: {:?}" ,
240
- image_reference,
241
- unsatisfied_constraints
237
+ "Signature verification failed for {image_reference}: {unsatisfied_constraints:?}"
242
238
) ;
243
239
Ok ( false )
244
240
}
@@ -253,14 +249,12 @@ pub async fn pull_and_extract_oci_image(
253
249
) -> Result < ( ) , Box < dyn std:: error:: Error > > {
254
250
if Path :: new ( local_output_path) . exists ( ) {
255
251
log:: info!(
256
- "Plugin {} already cached at: {}. Skipping downloading." ,
257
- image_reference,
258
- local_output_path
252
+ "Plugin {image_reference} already cached at: {local_output_path}. Skipping downloading."
259
253
) ;
260
254
return Ok ( ( ) ) ;
261
255
}
262
256
263
- log:: info!( "Pulling {} ..." , image_reference ) ;
257
+ log:: info!( "Pulling {image_reference } ..." ) ;
264
258
265
259
let client_config = oci_client:: client:: ClientConfig :: default ( ) ;
266
260
let client = Client :: new ( client_config) ;
@@ -270,23 +264,22 @@ pub async fn pull_and_extract_oci_image(
270
264
271
265
// Verify the image signature if it's an OCI image and verification is enabled
272
266
if !cli. insecure_skip_signature {
273
- log:: info!( "Signature verification enabled for {}" , image_reference ) ;
267
+ log:: info!( "Signature verification enabled for {image_reference}" ) ;
274
268
match verify_image_signature ( cli, image_reference) . await {
275
269
Ok ( verified) => {
276
270
if !verified {
277
271
return Err ( format ! (
278
- "No valid signatures found for the image {}" ,
279
- image_reference
272
+ "No valid signatures found for the image {image_reference}"
280
273
)
281
274
. into ( ) ) ;
282
275
}
283
276
}
284
277
Err ( e) => {
285
- return Err ( format ! ( "Image signature verification failed: {}" , e ) . into ( ) ) ;
278
+ return Err ( format ! ( "Image signature verification failed: {e}" ) . into ( ) ) ;
286
279
}
287
280
}
288
281
} else {
289
- log:: warn!( "Signature verification disabled for {}" , image_reference ) ;
282
+ log:: warn!( "Signature verification disabled for {image_reference}" ) ;
290
283
}
291
284
292
285
// Accept both OCI and Docker manifest types
@@ -327,12 +320,12 @@ pub async fn pull_and_extract_oci_image(
327
320
let mut content = Vec :: new ( ) ;
328
321
entry. read_to_end ( & mut content) ?;
329
322
fs:: write ( local_output_path, content) ?;
330
- log:: info!( "Successfully extracted to: {}" , local_output_path ) ;
323
+ log:: info!( "Successfully extracted to: {local_output_path}" ) ;
331
324
return Ok ( ( ) ) ;
332
325
}
333
326
}
334
327
}
335
- Err ( e) => log:: info!( "Error during extraction: {}" , e ) ,
328
+ Err ( e) => log:: info!( "Error during extraction: {e}" ) ,
336
329
}
337
330
}
338
331
}
0 commit comments