1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-09 05:00:10 +00:00

Fix cancel signing

This commit is contained in:
Bernd Schoolmann
2025-10-16 15:28:48 +02:00
parent 6aecbc4e13
commit 86964979d9
2 changed files with 22 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ use crate::{
async_stream_wrapper::AsyncStreamWrapper,
connection::ConnectionInfo,
key_store::Agent,
replies::{AgentFailure, IdentitiesReply, SshSignReply},
replies::{AgentExtensionFailure, AgentFailure, IdentitiesReply, SshSignReply},
requests::Request,
},
transport::peer_info::PeerInfo,
@@ -63,7 +63,9 @@ async fn handle_connection(
let Ok(request) = Request::try_from(request.as_slice()) else {
span.in_scope(|| error!("Failed to parse request"));
stream.write_reply(&AgentFailure::new().into()).await?;
stream
.write_reply(&AgentExtensionFailure::new().into())
.await?;
continue;
};
@@ -73,7 +75,9 @@ async fn handle_connection(
let Ok(true) = agent.request_can_list(connection).await else {
span.in_scope(|| error!("List keys request denied by UI"));
return stream.write_reply(&AgentFailure::new().into()).await;
return stream
.write_reply(&AgentExtensionFailure::new().into())
.await;
};
IdentitiesReply::new(agent.list_keys().await?)
@@ -105,7 +109,7 @@ async fn handle_connection(
)?
.encode()
} else {
Ok(AgentFailure::new().into())
Ok(AgentExtensionFailure::new().into())
}
.map_err(|e| anyhow::anyhow!("Failed to create sign reply: {e}"))
}

View File

@@ -115,6 +115,19 @@ impl SshSignReply {
}
}
pub(crate) struct AgentExtensionFailure;
impl AgentExtensionFailure {
pub fn new() -> Self {
Self {}
}
}
impl From<AgentExtensionFailure> for ReplyFrame {
fn from(_value: AgentExtensionFailure) -> Self {
ReplyFrame::new(ReplyType::SSH_AGENT_EXTENSION_FAILURE, Vec::new())
}
}
pub(crate) struct AgentFailure;
impl AgentFailure {
pub fn new() -> Self {
@@ -124,6 +137,6 @@ impl AgentFailure {
impl From<AgentFailure> for ReplyFrame {
fn from(_value: AgentFailure) -> Self {
ReplyFrame::new(ReplyType::SSH_AGENT_EXTENSION_FAILURE, Vec::new())
ReplyFrame::new(ReplyType::SSH_AGENT_FAILURE, Vec::new())
}
}