Re: [PATCH] transport: add core.allowProtocol config option
- From
- Brandon Williams <bmwill@google.com>
- Date
- Nov 3, 2016, 18:19 UTC
- Message-ID
- <20161103181954.GD182568@google.com>
- In-Reply-To
- <20161103175327.nn2yasvlsxsy22be@sigill.intra.peff.net>
On 11/03, Jeff King wrote:
Show 21 quoted lines
> +
> + /* unknown; let them be used only directly by the user */
> + return PROTOCOL_ALLOW_USER_ONLY;
> +}
> +
> int is_transport_allowed(const char *type)
> {
> - const struct string_list *allowed = protocol_whitelist();
> - return !allowed || string_list_has_string(allowed, type);
> + const struct string_list *whitelist = protocol_whitelist();
> + if (whitelist)
> + return string_list_has_string(whitelist, type);
> +
> + switch (get_protocol_config(type)) {
> + case PROTOCOL_ALLOW_ALWAYS:
> + return 1;
> + case PROTOCOL_ALLOW_NEVER:
> + return 0;
> + case PROTOCOL_ALLOW_USER_ONLY:
> + return git_env_bool("GIT_PROTOCOL_FROM_USER", 1);
> + }I know this is just a rough patch you wiped up but one question: With the 'user' state, how exactly do you envision this env variable working? Do we want the user to have to explicitly set GIT_PROTOCOL_FROM_USER in their environment and then have these other commands (like git-submodule) explicitly clear the env var or would we rather these subcommands set a variable indicating they aren't coming from the user and the deafult state (no var set) is a user run command?
-- Brandon Williams