fix(server): previously, user agent auth accepted invalid signatures
Some checks failed
ci/woodpecker/pr/server-lint Pipeline failed
ci/woodpecker/pr/server-audit Pipeline was successful
ci/woodpecker/pr/server-vet Pipeline failed
ci/woodpecker/pr/server-test Pipeline failed
ci/woodpecker/pr/useragent-analyze Pipeline failed

This commit is contained in:
hdbg
2026-04-04 14:26:04 +02:00
parent dd51d756da
commit 352ee3ee63

View File

@@ -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,14 +246,22 @@ where
} }
}; };
if valid { match valid {
self.transport true => {
.send(Ok(Outbound::AuthSuccess)) self.transport
.await .send(Ok(Outbound::AuthSuccess))
.map_err(|_| Error::Transport)?; .await
.map_err(|_| Error::Transport)?;
Ok(key.clone())
}
false => {
self.transport
.send(Err(Error::InvalidChallengeSolution))
.await
.map_err(|_| Error::Transport)?;
Err(Error::InvalidChallengeSolution)
}
} }
Ok(key.clone())
} }
} }