-
Notifications
You must be signed in to change notification settings - Fork 5
Redact password in Debug prints + some housekeeping #13
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
Changes from 5 commits
36550f4
5c45cc1
3f447c5
838b465
187685a
1839829
b350c1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,4 +153,16 @@ mod tests { | |
|
|
||
| assert!(credentials.is_err()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn debug_redacts_password() { | ||
| let password = "secret teapot"; | ||
| let credentials = Credentials::new("username", password); | ||
|
|
||
| let debugged = format!("{credentials:?}"); | ||
| let pretty = format!("{credentials:#?}"); | ||
|
|
||
| assert!(!debugged.contains(password)); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we have a check for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I left it out intentionally so as not to be flaky wrt. changes in the text, but ya I can add it. Just means that the test will need to be updated if someone wants to change the text. |
||
| assert!(!pretty.contains(password)); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.