-
Notifications
You must be signed in to change notification settings - Fork 133
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
Redact unsafe URLs in the Trace2 output #1616
Changes from 2 commits
97d17c2
a1686ab
e50160f
9bfd00c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
test_description='test trace2 facility (normal target)' | ||
|
||
TEST_PASSES_SANITIZE_LEAK=true | ||
TEST_PASSES_SANITIZE_LEAK=false | ||
. ./test-lib.sh | ||
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. A comment on the commit message: s/The tests this commit/The new tests added in this commit/ Maybe drop the "Turn off TEST... in t0210 and t0211 tests." sentence, since it is explained in the next paragraph (and we only modified t0210 in this commit). |
||
|
||
# Turn off any inherited trace2 settings for this test. | ||
|
@@ -283,4 +283,22 @@ test_expect_success 'using global config with include' ' | |
test_cmp expect actual | ||
' | ||
|
||
test_expect_success 'unsafe URLs are redacted by default' ' | ||
test_when_finished \ | ||
"rm -r trace.normal unredacted.normal clone clone2" && | ||
|
||
test_config_global \ | ||
"url.$(pwd).insteadOf" https://user:pwd@example.com/ && | ||
test_config_global trace2.configParams "core.*,remote.*.url" && | ||
|
||
GIT_TRACE2="$(pwd)/trace.normal" \ | ||
git clone https://user:pwd@example.com/ clone && | ||
! grep user:pwd trace.normal && | ||
|
||
GIT_TRACE2_REDACT=0 GIT_TRACE2="$(pwd)/unredacted.normal" \ | ||
git clone https://user:pwd@example.com/ clone2 && | ||
grep "start .* clone https://user:pwd@example.com" unredacted.normal && | ||
grep "remote.origin.url=https://user:pwd@example.com" unredacted.normal | ||
' | ||
|
||
test_done |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -337,8 +337,8 @@ struct key_value_info; | |
void trace2_def_param_fl(const char *file, int line, const char *param, | ||
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. On the Git mailing list, Junio C Hamano wrote (reply to this): "Jeff Hostetler via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Jeff Hostetler <jeffhostetler@github.com>
>
> Add `struct key_value_info` argument to `trace2_def_param()`.
>
> In dc90208497 (trace2: plumb config kvi, 2023-06-28) a `kvi`
> argument was added to `trace2_def_param_fl()` but the macro
> was not up updated. Let's fix that.
>
> Signed-off-by: Jeff Hostetler <jeffhostetler@github.com>
> ---
> trace2.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/trace2.h b/trace2.h
> index 40d8c2e02a5..1f0669bbd2d 100644
> --- a/trace2.h
> +++ b/trace2.h
> @@ -337,8 +337,8 @@ struct key_value_info;
> void trace2_def_param_fl(const char *file, int line, const char *param,
> const char *value, const struct key_value_info *kvi);
>
> -#define trace2_def_param(param, value) \
> - trace2_def_param_fl(__FILE__, __LINE__, (param), (value))
> +#define trace2_def_param(param, value, kvi) \
> + trace2_def_param_fl(__FILE__, __LINE__, (param), (value), (kvi))
IOW, this macro was not used back when it was updated, and nobody
used it since then?
I briefly wondered if we are better off removing it but that does
not make sense because you are adding a new (and only) user to it.
Will queue. Thanks.
>
> /*
> * Tell trace2 about a newly instantiated repo object and assign |
||
const char *value, const struct key_value_info *kvi); | ||
|
||
#define trace2_def_param(param, value) \ | ||
trace2_def_param_fl(__FILE__, __LINE__, (param), (value)) | ||
#define trace2_def_param(param, value, kvi) \ | ||
trace2_def_param_fl(__FILE__, __LINE__, (param), (value), (kvi)) | ||
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. This commit is unrelated to the radacting theme of the series, should we put it first to better isolate it? 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. Sounds good! |
||
|
||
/* | ||
* Tell trace2 about a newly instantiated repo object and assign | ||
|
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.
On the Git mailing list, Elijah Newren wrote (reply to this):
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.
On the Git mailing list, Jeff King wrote (reply to this):