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,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>