On Thu, May 07, 2020 at 02:23:48PM -0700, Carlo Marcelo Arenas Belón wrote: > On Thu, May 07, 2020 at 04:59:09PM -0400, Jeff King wrote: > > On Wed, May 06, 2020 at 04:28:48PM -0700, Carlo Marcelo Arenas Belón wrote: > > > > > Subject: [RFC PATCH 5/4] credential: document encoding assumptions for values > > > > > > Because of the similarity on the names of the keys with what is defined > > > in RFC3986 is easy to assume the same rules would apply here. > > > > > > Make sure that the format and encoding is well defined to avoid helper > > > developers assuming incorrectly. > > > > I'm not sure this really clarifies anything, because it just says "no > > assumptions can be made". Which I guess is a statement, but I'm not sure > > what I'd do with it as a helper developer. > > not sure what part of the added lines you are referring to but I am happy > to provide some examples of what I would expect to clarify below from > what I'd seen from some helpers that I'd read the code from recently. > > as an example, I would expect the helper developer to start checking for > the locale and calling iconv in cases where it is not using utf-8, before > sending it to a storage that requires that (ex: osxkeychain), or utf-16 > (maybe in windows). > > osxkeychain will probably also check for protocol in a case insensitive > way to make sure it is not ignoring credentials that are not all lowercase > as it does now. Those things all seem reasonable. I just meant that reading: No assumptions of case insensitivity can be made on their contents and if a specific encoding is required (e.g. "UTF-8") then the byte contents should be re-encoded before use. didn't point me in a useful direction there. Reading it again, I'm still not sure if you're trying to say that helpers should match protocols case-insensitively or not. And TBH, I don't think it matters that much. It's a quality-of-implementation issue for helpers, and if nobody is complaining about their behavior, does it really matter? I'd be more concerned if doing the wrong thing involved a security vulnerability, but the worst case with case-insensitivity is probably that they _fail_ to match a credential when they should. Likewise for weird encodings, unless an attacker can somehow come up with a hostname byte sequence that a helper mistakes for another legitimate hostname, _and_ that can be used sensibly by git or curl. -Peff