Re: [PATCH 08/10] fast-export: add a "data" callback parameter to anonymize_str()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 24, 2020, 19:58 UTC
- Message-ID
- <xmqqzh8s5j7u.fsf@gitster.c.googlers.com>
- In-Reply-To
- <20200623152503.GH1435482@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 7 quoted lines
> The anonymize_str() function takes a generator callback, but there's no > way to pass extra context to it. Let's add the usual "void *data" > parameter to the generator interface and pass it along. > > This is mildly annoying for existing callers, all of which pass NULL, > but is necessary to avoid extra globals in some cases we'll add in a > subsequent patch.
Show 8 quoted lines
> While we're touching each of these callbacks, we can further observe > that none of them use the existing orig/len parameters at all. This > makes sense, since the point is for their output to have no discernable > basis in the original (my original version had some notion that we might > use a one-way function to obfuscate the names, but it was never > implemented). So let's drop those extra parameters. If a caller really > wants to do something with them, it can pass a struct through the new > data parameter.
I guess it was giving a perfect proof that the anonymization is good---you cannot leak the info in data you did not even look at ;-).
And we must keep passing the <orig,len> pair to the anonymize API, of course, because that would be used as a look-up key for the customized/seeded mapping, which makes sense. But of course it is not necessary to pass them to the lower-level "generate" callbacks.