-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Log HTTP request body on signature verification failure #3239
base: master
Are you sure you want to change the base?
Conversation
There have been reports both internally and in support channels of ingress messages failing signature verification. So far these have not been reproducible, and the cause is unknown. To assist debugging, if verification fails log the HTTP request body.
pub fn signed(&self) -> &HttpRequest<SignedIngressContent> { | ||
&self.signed | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just stumbled upon
impl AsRef<HttpRequest<SignedIngressContent>> for SignedIngress {
fn as_ref(&self) -> &HttpRequest<SignedIngressContent> {
&self.signed
}
}
so theoretically, the new signed(&self)
is not strictly necessary as the same can be achieved with the existing as_ref()
. For people who don't know this code well (like me), this is not obvious, however.
pub(crate) fn validation_error_to_http_error<C: std::fmt::Debug>( | ||
request: &HttpRequest<C>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Optionally we could make this
pub(crate) fn validation_error_to_http_error<C: std::fmt::Debug + HttpRequestContent>(
request: &HttpRequest<C>,
err: RequestValidationError,
log: &ReplicaLogger,
) -> HttpError {
i.e,. we don't need to take the message_id
separately, because we can just get it from the request via request.id()
.
"msg_id: {}, err: {}, request: {:?}", | ||
message_id, | ||
err, | ||
request.content() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have sufficient debug info when just logging request.content()
rather than request
?
If we log the entire request
, we also get the HttpRequest::auth: Authentication
part, which contains the signature
and signer_pubkey
(and sender_delegation
) for authenticated requests.
There have been reports both internally and in support channels of ingress messages failing signature verification. So far these have not been reproducible, and the cause is unknown. To assist debugging, if verification fails log the HTTP request body.