diff --git a/attestation-service/src/bin/grpc/mod.rs b/attestation-service/src/bin/grpc/mod.rs index faba652bc..c02d24d39 100644 --- a/attestation-service/src/bin/grpc/mod.rs +++ b/attestation-service/src/bin/grpc/mod.rs @@ -173,11 +173,6 @@ impl AttestationService for Arc> { } }; - let policy_ids = match request.policy_ids.is_empty() { - true => vec!["default".into()], - false => request.policy_ids, - }; - let attestation_token = self .read() .await @@ -189,7 +184,7 @@ impl AttestationService for Arc> { runtime_data_hash_algorithm, init_data, init_data_hash_algorithm, - policy_ids, + request.policy_id, ) .await .map_err(|e| Status::aborted(format!("Attestation: {e:?}")))?; diff --git a/attestation-service/src/bin/restful/mod.rs b/attestation-service/src/bin/restful/mod.rs index be0ee21a4..ec40beb3b 100644 --- a/attestation-service/src/bin/restful/mod.rs +++ b/attestation-service/src/bin/restful/mod.rs @@ -41,7 +41,7 @@ pub struct AttestationRequest { init_data: Option, runtime_data_hash_algorithm: Option, init_data_hash_algorithm: Option, - policy_ids: Vec, + policy_id: String, } #[derive(Debug, Serialize, Deserialize)] @@ -139,13 +139,6 @@ pub async fn attestation( } }; - let policy_ids = if request.policy_ids.is_empty() { - info!("no policy specified, use `default`"); - vec!["default".into()] - } else { - request.policy_ids - }; - let token = cocoas .read() .await @@ -156,7 +149,7 @@ pub async fn attestation( runtime_data_hash_algorithm, init_data, init_data_hash_algorithm, - policy_ids, + request.policy_id, ) .await .context("attestation report evaluate")?; diff --git a/attestation-service/src/lib.rs b/attestation-service/src/lib.rs index 466339c7c..abb4f4d10 100644 --- a/attestation-service/src/lib.rs +++ b/attestation-service/src/lib.rs @@ -175,7 +175,7 @@ impl AttestationService { runtime_data_hash_algorithm: HashAlgorithm, init_data: Option, init_data_hash_algorithm: HashAlgorithm, - policy_ids: Vec, + policy_id: String, ) -> Result { let verifier = verifier::to_verifier(&tee)?; @@ -218,11 +218,7 @@ impl AttestationService { let appraisal = self .policy_engine - .evaluate( - reference_data_map.clone(), - tcb_claims, - policy_ids[0].clone(), - ) + .evaluate(reference_data_map.clone(), tcb_claims, policy_id.clone()) .await .map_err(|e| anyhow!("Policy Engine evaluation failed: {e}"))?; diff --git a/attestation-service/tests/e2e/request.json.template b/attestation-service/tests/e2e/request.json.template index b2218ee23..3bac75f1b 100644 --- a/attestation-service/tests/e2e/request.json.template +++ b/attestation-service/tests/e2e/request.json.template @@ -1,5 +1,5 @@ { "tee": "%TEE_NAME%", "evidence": "%EVIDENCE%", - "policy_ids": [] -} \ No newline at end of file + "policy_id": "default" +} diff --git a/kbs/src/attestation/coco/builtin.rs b/kbs/src/attestation/coco/builtin.rs index cc0bdcf9d..b0f853474 100644 --- a/kbs/src/attestation/coco/builtin.rs +++ b/kbs/src/attestation/coco/builtin.rs @@ -40,7 +40,8 @@ impl Attest for BuiltInCoCoAs { HashAlgorithm::Sha384, None, HashAlgorithm::Sha384, - vec!["default".into()], + // TODO: figure out a better way to set the policy id + "default", ) .await } diff --git a/kbs/src/attestation/coco/grpc.rs b/kbs/src/attestation/coco/grpc.rs index 903dbf344..c21296459 100644 --- a/kbs/src/attestation/coco/grpc.rs +++ b/kbs/src/attestation/coco/grpc.rs @@ -110,7 +110,8 @@ impl Attest for GrpcClientPool { init_data_hash_algorithm: COCO_AS_HASH_ALGORITHM.into(), runtime_data: Some(RuntimeData::StructuredRuntimeData(runtime_data_plaintext)), init_data: None, - policy_ids: vec!["default".to_string()], + // TODO: figure out a better way to set this + policy_id: "default".to_string(), }); let mut client = { self.pool.lock().await.get().await? }; diff --git a/protos/attestation.proto b/protos/attestation.proto index 8e9b531b7..141cd530c 100644 --- a/protos/attestation.proto +++ b/protos/attestation.proto @@ -62,9 +62,8 @@ message AttestationRequest { // "sha384" or "sha512". If not specified, "sha384" will be selected. string init_data_hash_algorithm = 8; - // List of IDs of the policy used to check evidence. If not provided, - // a "default" one will be used. - repeated string policy_ids = 9; + // ID of the policy used to check evidence. + string policy_id = 9; } message AttestationResponse {