diff --git a/.changelog/5792.trivial.md b/.changelog/5792.trivial.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/keymanager/src/churp/handler.rs b/keymanager/src/churp/handler.rs index d61eddb7082..06c3706c370 100644 --- a/keymanager/src/churp/handler.rs +++ b/keymanager/src/churp/handler.rs @@ -1182,9 +1182,11 @@ impl Instance { impl Handler for Instance { fn verification_matrix(&self, req: &QueryRequest) -> Result> { let status = self.verify_last_handoff(req.epoch)?; - let shareholder = match status.suite_id { - SuiteId::NistP384Sha3_384 => self.get_shareholder(req.epoch)?, - }; + if !status.committee.contains(&self.node_id) { + return Err(Error::NotInCommittee.into()); + } + + let shareholder = self.get_shareholder(status.handoff)?; let vm = shareholder .verifiable_share() .verification_matrix() @@ -1199,6 +1201,9 @@ impl Handler for Instance { req: &QueryRequest, ) -> Result> { let status = self.verify_next_handoff(req.epoch)?; + if !status.committee.contains(&self.node_id) { + return Err(Error::NotInCommittee.into()); + } let kind = Self::handoff_kind(&status); if !matches!(kind, HandoffKind::CommitteeChanged) { @@ -1227,6 +1232,9 @@ impl Handler for Instance { req: &QueryRequest, ) -> Result> { let status = self.verify_next_handoff(req.epoch)?; + if !status.applications.contains_key(&self.node_id) { + return Err(Error::NotInCommittee.into()); + } let kind = Self::handoff_kind(&status); if !matches!(kind, HandoffKind::CommitteeChanged) { @@ -1256,6 +1264,9 @@ impl Handler for Instance { req: &QueryRequest, ) -> Result { let status = self.verify_next_handoff(req.epoch)?; + if !status.applications.contains_key(&self.node_id) { + return Err(Error::NotInCommittee.into()); + } let node_id = req.node_id.as_ref().ok_or(Error::NotAuthenticated)?; if !status.applications.contains_key(node_id) { @@ -1309,6 +1320,9 @@ impl Handler for Instance { if status.handoff != req.epoch { return Err(Error::HandoffMismatch.into()); } + if !status.committee.contains(&self.node_id) { + return Err(Error::NotInCommittee.into()); + } // Note that querying past key shares can fail at this point // if the policy has changed.