fetch-pack: redact packfile urls in traces
In some setups, packfile uris act as bearer token. It is not recommended to expose them plainly in logs, although in special circunstances (e.g. debug) it makes sense to write them. Redact the packfile URL paths by default, unless the GIT_TRACE_REDACT variable is set to false. This mimics the redacting of the Authorization header in HTTP. Signed-off-by: Ivan Frade <ifrade@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
e9e5ba39a7
commit
88e9b1e3fc
@ -1653,8 +1653,13 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
|
||||
receive_wanted_refs(&reader, sought, nr_sought);
|
||||
|
||||
/* get the pack(s) */
|
||||
if (git_env_bool("GIT_TRACE_REDACT", 1))
|
||||
reader.options |= PACKET_READ_REDACT_URI_PATH;
|
||||
if (process_section_header(&reader, "packfile-uris", 1))
|
||||
receive_packfile_uris(&reader, &packfile_uris);
|
||||
/* We don't expect more URIs. Reset to avoid expensive URI check. */
|
||||
reader.options &= ~PACKET_READ_REDACT_URI_PATH;
|
||||
|
||||
process_section_header(&reader, "packfile", 0);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user