forked from fwupd/fwupd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide HTTP passwords in fwupd debugging logs
This keeps being pasted to public places like GitHub -- copy what curl does.
- Loading branch information
Showing
4 changed files
with
86 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -566,6 +566,26 @@ fu_common_memmem_func(void) | |
g_assert_false(ret); | ||
} | ||
|
||
static void | ||
fu_strpassmask_func(void) | ||
{ | ||
struct { | ||
const gchar *in; | ||
const gchar *op; | ||
} strs[] = {{"foo https://test.com/auth bar", "foo https://test.com/auth bar"}, | ||
{"foo https://user%40host:[email protected]/auth bar", | ||
"foo https://user%40host:[email protected]/auth bar"}, | ||
{"foo https://user1%40host:[email protected]/auth " | ||
"https://user2%40host:[email protected]/auth bar", | ||
"foo https://user1%40host:[email protected]/auth " | ||
"https://user2%40host:[email protected]/auth bar"}, | ||
{NULL, NULL}}; | ||
for (guint i = 0; strs[i].in != NULL; i++) { | ||
g_autofree gchar *tmp = fu_strpassmask(strs[i].in); | ||
g_assert_cmpstr(tmp, ==, strs[i].op); | ||
} | ||
} | ||
|
||
static void | ||
fu_strsplit_func(void) | ||
{ | ||
|
@@ -4497,6 +4517,7 @@ main(int argc, char **argv) | |
g_test_add_func("/fwupd/struct", fu_plugin_struct_func); | ||
g_test_add_func("/fwupd/struct{wrapped}", fu_plugin_struct_wrapped_func); | ||
g_test_add_func("/fwupd/plugin{quirks-append}", fu_plugin_quirks_append_func); | ||
g_test_add_func("/fwupd/string{password-mask}", fu_strpassmask_func); | ||
g_test_add_func("/fwupd/common{strnsplit}", fu_strsplit_func); | ||
g_test_add_func("/fwupd/common{olson-timezone-id}", fu_common_olson_timezone_id_func); | ||
g_test_add_func("/fwupd/common{memmem}", fu_common_memmem_func); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters