Skip to content

Commit c269f57

Browse files
authored
avoid rejecting repositories too early (#34)
The control flow here incorrectly diverges if a candidate trust root fails to verify a repository and a previous candidate already failed. (In other words: it works with two trust roots, but potentially not with three, depending on ordering.) The conditional should have been inside the expression, not the match arm guard; the conditional is unimportant and has been removed altogether.
1 parent 3923a43 commit c269f57

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/src/repository.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl OmicronRepo {
136136
Err(
137137
err @ (Error::VerifyMetadata { .. }
138138
| Error::VerifyTrustedMetadata { .. }),
139-
) if verify_error.is_none() => {
139+
) => {
140140
verify_error = Some(err.into());
141141
continue;
142142
}
@@ -631,6 +631,11 @@ mod tests {
631631
vec![trusted_root.buffer(), untrusted_root.buffer()],
632632
vec![untrusted_root.buffer(), trusted_root.buffer()],
633633
vec![trusted_root.buffer(), trusted_root.buffer()],
634+
vec![
635+
untrusted_root.buffer(),
636+
untrusted_root.buffer(),
637+
trusted_root.buffer(),
638+
],
634639
] {
635640
OmicronRepo::load(&logctx.log, &repo_dir, trust_store)
636641
.await

0 commit comments

Comments
 (0)