fix(server): previously, user agent auth accepted invalid signatures
This commit is contained in:
@@ -10,7 +10,9 @@ use crate::{
|
|||||||
bootstrap::ConsumeToken,
|
bootstrap::ConsumeToken,
|
||||||
keyholder::{self, SignIntegrityTag},
|
keyholder::{self, SignIntegrityTag},
|
||||||
user_agent::{AuthPublicKey, UserAgentConnection, auth::Outbound},
|
user_agent::{AuthPublicKey, UserAgentConnection, auth::Outbound},
|
||||||
}, crypto::integrity::v1::USERAGENT_INTEGRITY_TAG, db::schema
|
},
|
||||||
|
crypto::integrity::v1::USERAGENT_INTEGRITY_TAG,
|
||||||
|
db::schema,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
@@ -244,15 +246,23 @@ where
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if valid {
|
match valid {
|
||||||
|
true => {
|
||||||
self.transport
|
self.transport
|
||||||
.send(Ok(Outbound::AuthSuccess))
|
.send(Ok(Outbound::AuthSuccess))
|
||||||
.await
|
.await
|
||||||
.map_err(|_| Error::Transport)?;
|
.map_err(|_| Error::Transport)?;
|
||||||
}
|
|
||||||
|
|
||||||
Ok(key.clone())
|
Ok(key.clone())
|
||||||
}
|
}
|
||||||
|
false => {
|
||||||
|
self.transport
|
||||||
|
.send(Err(Error::InvalidChallengeSolution))
|
||||||
|
.await
|
||||||
|
.map_err(|_| Error::Transport)?;
|
||||||
|
Err(Error::InvalidChallengeSolution)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> AuthContext<'_, T>
|
impl<T> AuthContext<'_, T>
|
||||||
|
|||||||
Reference in New Issue
Block a user