-
Notifications
You must be signed in to change notification settings - Fork 286
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
Improve SignHash error message to clarify intentional security design #2141
base: main
Are you sure you want to change the base?
Conversation
Update the UnsupportedSignerOperation error display to explicitly mention that blind signing is intentionally disabled as a security best practice, rather than appearing as a technical limitation. This provides clearer guidance to users encountering this error.
@@ -79,7 +79,12 @@ pub enum UnsupportedSignerOperation { | |||
|
|||
impl fmt::Display for UnsupportedSignerOperation { | |||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |||
self.as_str().fmt(f) | |||
match self { |
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.
you want to change this above in enum Error, but i think it should be another variant
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 you mean convert UnsupportedSignerOperation into an error via thiserror?
I think we should do this because otherwise this new message will mess with the error message here:
alloy/crates/signer/src/error.rs
Lines 13 to 14 in 750004c
#[error("operation `{0}` is not supported by the signer")] | |
UnsupportedOperation(UnsupportedSignerOperation), |
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.
I think we should keep things as is and just add another variant with a message that it is intentionally unimplemented
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.
right. Your suggestion is better by making a distinction between what is unsupported and what is opted out due to security reasons. maybe a new variant to the Error definition:
pub enum Error {
// ...
/// The operation is deliberately disabled for security reasons
#[error("Operation {0} is restricted due to security restrictions")]
SecurityRestriction(String),
// ...
}
@@ -79,7 +79,12 @@ pub enum UnsupportedSignerOperation { | |||
|
|||
impl fmt::Display for UnsupportedSignerOperation { | |||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |||
self.as_str().fmt(f) | |||
match self { |
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 you mean convert UnsupportedSignerOperation into an error via thiserror?
I think we should do this because otherwise this new message will mess with the error message here:
alloy/crates/signer/src/error.rs
Lines 13 to 14 in 750004c
#[error("operation `{0}` is not supported by the signer")] | |
UnsupportedOperation(UnsupportedSignerOperation), |
Motivation
see #2114
Solution
Update the
UnsupportedSignerOperation
error display to explicitly mention that blind signing is intentionally disabled as a security best practicePR Checklist