-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix(forge): sensitive broadcast logs #4892
fix(forge): sensitive broadcast logs #4892
Conversation
5f9946b
to
15d208f
Compare
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.
Hey hey thanks for this!
logic looks ok, but haven't tested. some nits re docs/comments/naming:
cli/src/cmd/forge/script/sequence.rs
Outdated
@@ -45,6 +48,29 @@ pub struct ScriptSequence { | |||
pub commit: Option<String>, | |||
} | |||
|
|||
#[derive(Deserialize, Serialize, Clone, Default)] | |||
pub struct TransactionWithMetadataSensitive { |
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.
Could we add some docs about what this struct is?
Also, I think we could have a better name e.g SensitiveTxMetadata
—We only really have the sensitive logged info here, rather than being a full blown tx that has sensitive info.
cli/src/cmd/forge/script/sequence.rs
Outdated
|
||
/// Sensitive info from the script sequence which is saved into the cache folder | ||
#[derive(Deserialize, Serialize, Clone, Default)] | ||
pub struct ScriptSequenceSensitive { |
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.
ditto on above comment—let's try and look for a more intuitive/accurate name
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.
Would SensitiveScriptSequence
be better? I wanted to keep the name close to the ScriptSequence
struct as that's where these values come from.
That way you have your ScriptSequence
which can be committed and SensitiveScriptSequence
which shouldn't be.
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.
Yep, this sounds good!
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.
Cool, that's already in my last commit :)
)?), | ||
&script_sequence_sensitive, | ||
)?; | ||
|
||
shell::println(format!("\nTransactions saved to: {path}\n"))?; |
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.
maybe we should print an extra message indicating sensitive info has been written to a separate path?
hey hey, will TAL tomorrow and hopefully merge this! looks solid, just haven't fully tested yet |
No prob @Evalir, you're smashing PRs out lately! <3 |
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.
this lgtm!
ptal @mattsse
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.
cool!
test lgtm!
@Evalir do we need to put this in the changelog?
I believe we need to add this to the default gitignore as well for forge init
@mattsse thanks for reviewing! I'm not sure why this would need changes in the default
|
I see, so the senstive logs are always ignored? |
@mattsse Yeah, the sensitive logs go into directories under the cache directory. See the |
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.
gg
Motivation
Remove sensitive values from broadcast logs. Namely
rpc
andpath
. Fixes #4730.Solution
As proposed in #4730, saves sensitive values into a file with the same name / folder path but instead of the
broadcast
dir, we use thecache
dir. It introduces aScriptSequenceSensitive
struct which can be used to write sensitive values and later load them back into theScriptSequence
struct.Also fixes and extends the
check_broadcast_log
test so the changes can be tested.