Skip to content

Commit 173a5d1

Browse files
committed
verifier-cli: add trap door to skip log appraisal in verify command
We need this to unblock mfg.
1 parent 14c059f commit 173a5d1

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

verifier-cli/src/main.rs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,17 @@ enum AttestCommand {
9393
#[clap(long, env = "VERIFIER_CLI_WORK_DIR")]
9494
work_dir: Option<PathBuf>,
9595

96+
/// Skip measurement log appraisal.
97+
#[clap(
98+
long,
99+
default_value_t = false,
100+
env = "VERIFIER_CLI_SKIP_APPRAISAL"
101+
)]
102+
skip_appraisal: bool,
103+
96104
/// Path to file holding the reference measurement corpus
97105
#[clap(env, env = "VERIFIER_CLI_CORPUS")]
98-
corpus: PathBuf,
106+
corpus: Option<PathBuf>,
99107
},
100108
/// Verify signature over Attestation
101109
VerifyAttestation {
@@ -255,6 +263,7 @@ fn main() -> Result<()> {
255263
ca_cert,
256264
corpus,
257265
self_signed,
266+
skip_appraisal,
258267
work_dir,
259268
} => {
260269
// Use the directory provided by the caller to hold intermediate
@@ -263,16 +272,19 @@ fn main() -> Result<()> {
263272
Some(w) => verify(
264273
attest.as_ref(),
265274
ca_cert.as_deref(),
266-
&corpus,
275+
corpus.as_deref(),
267276
self_signed,
268277
&w,
269278
)?,
270279
None => {
280+
if corpus.is_none() && !skip_appraisal {
281+
return Err(anyhow!("no corpus provided but not instructed to skip measurement log appraisal"));
282+
}
271283
let work_dir = tempfile::tempdir()?;
272284
verify(
273285
attest.as_ref(),
274286
ca_cert.as_deref(),
275-
&corpus,
287+
corpus.as_deref(),
276288
self_signed,
277289
work_dir.as_ref(),
278290
)?
@@ -380,7 +392,7 @@ fn verify_measurements(
380392
fn verify(
381393
attest: &dyn Attest,
382394
ca_cert: Option<&Path>,
383-
corpus: &Path,
395+
corpus: Option<&Path>,
384396
self_signed: bool,
385397
work_dir: &Path,
386398
) -> Result<PlatformId> {
@@ -472,8 +484,12 @@ fn verify(
472484
)?;
473485
info!("attestation verified");
474486

475-
verify_measurements(&cert_chain_path, &log_path, corpus)?;
476-
info!("measurements verified");
487+
if let Some(corpus) = corpus {
488+
verify_measurements(&cert_chain_path, &log_path, corpus)?;
489+
info!("measurements verified");
490+
} else {
491+
warn!("measurement corpus is None: skipping log appraisal");
492+
}
477493

478494
let cert_chain = fs::read(&cert_chain_path).context(format!(
479495
"read cert chain from path: {}",

0 commit comments

Comments
 (0)