security: batch of fixes #95
@@ -20,7 +20,7 @@ pub mod client_connect_approval;
|
||||
|
||||
pub struct FlowCoordinator {
|
||||
pub clients: HashMap<ActorId, ActorRef<ClientSession>>,
|
||||
/// Maps DB client_id → ActorId for fast connected-client lookup.
|
||||
/// Maps DB `client_id` → `ActorId` for fast connected-client lookup.
|
||||
client_ids: HashMap<i32, ActorId>,
|
||||
operator_registry: ActorRef<OperatorRegistry>,
|
||||
}
|
||||
@@ -94,7 +94,7 @@ impl FlowCoordinator {
|
||||
self.client_ids.contains_key(&client_id)
|
||||
}
|
||||
|
||||
/// Returns the DB client_ids of all currently connected SDK clients.
|
||||
/// Returns the DB `client_ids` of all currently connected SDK clients.
|
||||
/// Used by operator sessions on startup to seed their approved-client set.
|
||||
#[message]
|
||||
pub fn get_connected_client_ids(&self) -> Vec<i32> {
|
||||
|
||||
@@ -192,10 +192,9 @@ pub async fn verify_entity<E: Integrable>(
|
||||
Ok(false) => Err(Error::MacMismatch {
|
||||
entity_kind: E::KIND,
|
||||
}),
|
||||
Err(SendError::HandlerError(vault::Error::Sealed))
|
||||
| Err(SendError::HandlerError(vault::Error::KeyVersionMismatch { .. })) => {
|
||||
Ok(AttestationStatus::Unavailable)
|
||||
}
|
||||
Err(SendError::HandlerError(
|
||||
vault::Error::Sealed | vault::Error::KeyVersionMismatch { .. },
|
||||
)) => Ok(AttestationStatus::Unavailable),
|
||||
Err(_) => Err(Error::VaultSend),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ mod tests {
|
||||
|
||||
/// Regression test: revocation must delete by access-entry `id`, not by `wallet_id`.
|
||||
///
|
||||
/// Before the fix, revoking entry_id=1 would delete all rows where wallet_id=1,
|
||||
/// Before the fix, revoking `entry_id=1` would delete all rows where `wallet_id=1`,
|
||||
/// wiping out every client's access to wallet #1.
|
||||
#[tokio::test]
|
||||
async fn revoke_deletes_by_entry_id_not_wallet_id() {
|
||||
@@ -395,10 +395,10 @@ mod tests {
|
||||
assert_eq!(still_there, 1, "unrelated entry must not be deleted");
|
||||
}
|
||||
|
||||
/// Regression test: when entry_id and wallet_id differ, only the correct row is removed.
|
||||
/// Regression test: when `entry_id` and `wallet_id` differ, only the correct row is removed.
|
||||
///
|
||||
/// This specifically catches the case where entry.id=5 and wallet_id=1 are different values;
|
||||
/// the old bug would delete by wallet_id, potentially matching a completely different entry.
|
||||
/// This specifically catches the case where `entry.id=5` and `wallet_id=1` are different values;
|
||||
/// the old bug would delete by `wallet_id`, potentially matching a completely different entry.
|
||||
#[tokio::test]
|
||||
async fn revoke_with_mismatched_wallet_and_entry_ids() {
|
||||
use crate::db::models::EvmWalletAccess;
|
||||
|
||||
@@ -54,7 +54,7 @@ pub struct OperatorSession {
|
||||
sender: Box<dyn Sender<OutOfBand>>,
|
||||
|
||||
pending_client_approvals: HashMap<Vec<u8>, PendingClientApproval>,
|
||||
/// DB client_ids this operator session is allowed to sign for.
|
||||
/// DB `client_ids` this operator session is allowed to sign for.
|
||||
/// Seeded from currently-connected clients on start, then updated as
|
||||
/// approvals are granted or denied during the session lifetime.
|
||||
approved_client_ids: HashSet<i32>,
|
||||
|
||||
Reference in New Issue
Block a user