@@ -1221,4 +1221,51 @@ mod tests {
12211221 assert ! ( decode_key_provider_info( b"" ) . is_none( ) ) ;
12221222 assert ! ( decode_key_provider_info( b"not json" ) . is_none( ) ) ;
12231223 }
1224+
1225+ #[ tokio:: test]
1226+ async fn verifies_sev_snp_attestation_fixture_without_image_download ( ) {
1227+ let request: VerificationRequest =
1228+ serde_json:: from_str ( include_str ! ( "../fixtures/sev-snp-attestation.json" ) )
1229+ . expect ( "SNP verifier fixture parses" ) ;
1230+ let cache = tempfile:: tempdir ( ) . expect ( "temp cache dir" ) ;
1231+ let image_cache_dir = cache. path ( ) . join ( "cache" ) ;
1232+ let verifier = CvmVerifier :: new (
1233+ image_cache_dir. display ( ) . to_string ( ) ,
1234+ "http://127.0.0.1:9/should-not-download/{OS_IMAGE_HASH}.tar.gz" . to_string ( ) ,
1235+ Duration :: from_secs ( 1 ) ,
1236+ None ,
1237+ ) ;
1238+
1239+ let response = verifier. verify ( request) . await . expect ( "verifier runs" ) ;
1240+ assert ! ( response. is_valid, "{:?}" , response. reason) ;
1241+ assert ! ( response. details. quote_verified) ;
1242+ assert ! ( response. details. event_log_verified) ;
1243+ assert ! ( response. details. os_image_hash_verified) ;
1244+ assert_eq ! ( response. details. tee_platform. as_deref( ) , Some ( "sev-snp" ) ) ;
1245+ assert ! (
1246+ !image_cache_dir. exists( ) ,
1247+ "SNP verification must not download or cache OS images"
1248+ ) ;
1249+ }
1250+
1251+ #[ tokio:: test]
1252+ async fn attestation_fixture_ignores_conflicting_top_level_inputs ( ) {
1253+ let mut request: VerificationRequest =
1254+ serde_json:: from_str ( include_str ! ( "../fixtures/sev-snp-attestation.json" ) )
1255+ . expect ( "SNP verifier fixture parses" ) ;
1256+ request. quote = Some ( vec ! [ 0 ] ) ;
1257+ request. event_log = Some ( "[]" . to_string ( ) ) ;
1258+ request. vm_config = Some ( "not-json" . to_string ( ) ) ;
1259+ let cache = tempfile:: tempdir ( ) . expect ( "temp cache dir" ) ;
1260+ let verifier = CvmVerifier :: new (
1261+ cache. path ( ) . join ( "cache" ) . display ( ) . to_string ( ) ,
1262+ "http://127.0.0.1:9/should-not-download/{OS_IMAGE_HASH}.tar.gz" . to_string ( ) ,
1263+ Duration :: from_secs ( 1 ) ,
1264+ None ,
1265+ ) ;
1266+
1267+ let response = verifier. verify ( request) . await . expect ( "verifier runs" ) ;
1268+ assert ! ( response. is_valid, "{:?}" , response. reason) ;
1269+ assert_eq ! ( response. details. tee_platform. as_deref( ) , Some ( "sev-snp" ) ) ;
1270+ }
12241271}
0 commit comments