]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Sync with 2.33.5
authorTaylor Blau <me@ttaylorr.com>
Thu, 6 Oct 2022 21:42:55 +0000 (17:42 -0400)
committerTaylor Blau <me@ttaylorr.com>
Thu, 6 Oct 2022 21:42:55 +0000 (17:42 -0400)
Signed-off-by: Taylor Blau <me@ttaylorr.com>
64 files changed:
Documentation/RelNotes/2.30.6.txt [new file with mode: 0644]
Documentation/RelNotes/2.31.5.txt [new file with mode: 0644]
Documentation/RelNotes/2.32.4.txt [new file with mode: 0644]
Documentation/RelNotes/2.33.5.txt [new file with mode: 0644]
Documentation/config/protocol.txt
alias.c
builtin/clone.c
shell.c
t/lib-submodule-update.sh
t/t1091-sparse-checkout-builtin.sh
t/t1092-sparse-checkout-compatibility.sh
t/t1500-rev-parse.sh
t/t2080-parallel-checkout-basics.sh
t/t2400-worktree-add.sh
t/t2403-worktree-move.sh
t/t2405-worktree-submodule.sh
t/t3200-branch.sh
t/t3420-rebase-autostash.sh
t/t3426-rebase-submodule.sh
t/t3512-cherry-pick-submodule.sh
t/t3600-rm.sh
t/t3906-stash-submodule.sh
t/t4059-diff-submodule-not-initialized.sh
t/t4060-diff-submodule-option-diff-format.sh
t/t4067-diff-partial-clone.sh
t/t4208-log-magic-pathspec.sh
t/t5510-fetch.sh
t/t5526-fetch-submodules.sh
t/t5545-push-options.sh
t/t5572-pull-submodule.sh
t/t5601-clone.sh
t/t5604-clone-reference.sh
t/t5614-clone-submodules-shallow.sh
t/t5616-partial-clone.sh
t/t5617-clone-submodules-remote.sh
t/t6008-rev-list-submodule.sh
t/t6134-pathspec-in-submodule.sh
t/t7001-mv.sh
t/t7064-wtstatus-pv2.sh
t/t7300-clean.sh
t/t7400-submodule-basic.sh
t/t7403-submodule-sync.sh
t/t7406-submodule-update.sh
t/t7407-submodule-foreach.sh
t/t7408-submodule-reference.sh
t/t7409-submodule-detached-work-tree.sh
t/t7411-submodule-config.sh
t/t7413-submodule-is-active.sh
t/t7414-submodule-mistakes.sh
t/t7416-submodule-dash-url.sh
t/t7417-submodule-path-url.sh
t/t7418-submodule-sparse-gitmodules.sh
t/t7419-submodule-set-branch.sh
t/t7420-submodule-set-url.sh
t/t7421-submodule-summary-add.sh
t/t7450-bad-git-dotfiles.sh
t/t7506-status-submodule.sh
t/t7507-commit-verbose.sh
t/t7800-difftool.sh
t/t7814-grep-recurse-submodules.sh
t/t9304-fast-import-marks.sh
t/t9350-fast-export.sh
t/t9850-shell.sh [new file with mode: 0755]
transport.c

diff --git a/Documentation/RelNotes/2.30.6.txt b/Documentation/RelNotes/2.30.6.txt
new file mode 100644 (file)
index 0000000..d649071
--- /dev/null
@@ -0,0 +1,60 @@
+Git v2.30.6 Release Notes
+=========================
+
+This release addresses the security issues CVE-2022-39253 and
+CVE-2022-39260.
+
+Fixes since v2.30.5
+-------------------
+
+ * CVE-2022-39253:
+   When relying on the `--local` clone optimization, Git dereferences
+   symbolic links in the source repository before creating hardlinks
+   (or copies) of the dereferenced link in the destination repository.
+   This can lead to surprising behavior where arbitrary files are
+   present in a repository's `$GIT_DIR` when cloning from a malicious
+   repository.
+
+   Git will no longer dereference symbolic links via the `--local`
+   clone mechanism, and will instead refuse to clone repositories that
+   have symbolic links present in the `$GIT_DIR/objects` directory.
+
+   Additionally, the value of `protocol.file.allow` is changed to be
+   "user" by default.
+
+ * CVE-2022-39260:
+   An overly-long command string given to `git shell` can result in
+   overflow in `split_cmdline()`, leading to arbitrary heap writes and
+   remote code execution when `git shell` is exposed and the directory
+   `$HOME/git-shell-commands` exists.
+
+   `git shell` is taught to refuse interactive commands that are
+   longer than 4MiB in size. `split_cmdline()` is hardened to reject
+   inputs larger than 2GiB.
+
+Credit for finding CVE-2022-39253 goes to Cory Snider of Mirantis. The
+fix was authored by Taylor Blau, with help from Johannes Schindelin.
+
+Credit for finding CVE-2022-39260 goes to Kevin Backhouse of GitHub.
+The fix was authored by Kevin Backhouse, Jeff King, and Taylor Blau.
+
+
+Jeff King (2):
+      shell: add basic tests
+      shell: limit size of interactive commands
+
+Kevin Backhouse (1):
+      alias.c: reject too-long cmdline strings in split_cmdline()
+
+Taylor Blau (11):
+      builtin/clone.c: disallow `--local` clones with symlinks
+      t/lib-submodule-update.sh: allow local submodules
+      t/t1NNN: allow local submodules
+      t/2NNNN: allow local submodules
+      t/t3NNN: allow local submodules
+      t/t4NNN: allow local submodules
+      t/t5NNN: allow local submodules
+      t/t6NNN: allow local submodules
+      t/t7NNN: allow local submodules
+      t/t9NNN: allow local submodules
+      transport: make `protocol.file.allow` be "user" by default
diff --git a/Documentation/RelNotes/2.31.5.txt b/Documentation/RelNotes/2.31.5.txt
new file mode 100644 (file)
index 0000000..0d87e6e
--- /dev/null
@@ -0,0 +1,5 @@
+Git v2.31.5 Release Notes
+=========================
+
+This release merges the security fix that appears in v2.30.6; see
+the release notes for that version for details.
diff --git a/Documentation/RelNotes/2.32.4.txt b/Documentation/RelNotes/2.32.4.txt
new file mode 100644 (file)
index 0000000..76c67b2
--- /dev/null
@@ -0,0 +1,5 @@
+Git v2.32.4 Release Notes
+=========================
+
+This release merges the security fix that appears in v2.30.6; see
+the release notes for that version for details.
diff --git a/Documentation/RelNotes/2.33.5.txt b/Documentation/RelNotes/2.33.5.txt
new file mode 100644 (file)
index 0000000..a636526
--- /dev/null
@@ -0,0 +1,5 @@
+Git v2.33.5 Release Notes
+=========================
+
+This release merges the security fix that appears in v2.30.6; see
+the release notes for that version for details.
index 756591d77b080ccfe5be5a26c899b65273cf4866..799389132f07b59e0280bbad612ec62c2bbc17dc 100644 (file)
@@ -1,10 +1,10 @@
 protocol.allow::
        If set, provide a user defined default policy for all protocols which
        don't explicitly have a policy (`protocol.<name>.allow`).  By default,
-       if unset, known-safe protocols (http, https, git, ssh, file) have a
+       if unset, known-safe protocols (http, https, git, ssh) have a
        default policy of `always`, known-dangerous protocols (ext) have a
-       default policy of `never`, and all other protocols have a default
-       policy of `user`.  Supported policies:
+       default policy of `never`, and all other protocols (including file)
+       have a default policy of `user`.  Supported policies:
 +
 --
 
diff --git a/alias.c b/alias.c
index c4715380205b5f8dd032b16ade846842fa3c23b9..00abde081739436236aa077412c3b5b686144f42 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -46,14 +46,16 @@ void list_aliases(struct string_list *list)
 
 #define SPLIT_CMDLINE_BAD_ENDING 1
 #define SPLIT_CMDLINE_UNCLOSED_QUOTE 2
+#define SPLIT_CMDLINE_ARGC_OVERFLOW 3
 static const char *split_cmdline_errors[] = {
        N_("cmdline ends with \\"),
-       N_("unclosed quote")
+       N_("unclosed quote"),
+       N_("too many arguments"),
 };
 
 int split_cmdline(char *cmdline, const char ***argv)
 {
-       int src, dst, count = 0, size = 16;
+       size_t src, dst, count = 0, size = 16;
        char quoted = 0;
 
        ALLOC_ARRAY(*argv, size);
@@ -96,6 +98,11 @@ int split_cmdline(char *cmdline, const char ***argv)
                return -SPLIT_CMDLINE_UNCLOSED_QUOTE;
        }
 
+       if (count >= INT_MAX) {
+               FREE_AND_NULL(*argv);
+               return -SPLIT_CMDLINE_ARGC_OVERFLOW;
+       }
+
        ALLOC_GROW(*argv, count + 1, size);
        (*argv)[count] = NULL;
 
index fb377b27657c4048a04c85ddb82e15a950db5a7d..8bee0fa9f818b0266216e76d2e0ac77da67cb275 100644 (file)
@@ -310,13 +310,11 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest,
        int src_len, dest_len;
        struct dir_iterator *iter;
        int iter_status;
-       unsigned int flags;
        struct strbuf realpath = STRBUF_INIT;
 
        mkdir_if_missing(dest->buf, 0777);
 
-       flags = DIR_ITERATOR_PEDANTIC | DIR_ITERATOR_FOLLOW_SYMLINKS;
-       iter = dir_iterator_begin(src->buf, flags);
+       iter = dir_iterator_begin(src->buf, DIR_ITERATOR_PEDANTIC);
 
        if (!iter)
                die_errno(_("failed to start iterator over '%s'"), src->buf);
@@ -332,6 +330,10 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest,
                strbuf_setlen(dest, dest_len);
                strbuf_addstr(dest, iter->relative_path);
 
+               if (S_ISLNK(iter->st.st_mode))
+                       die(_("symlink '%s' exists, refusing to clone with --local"),
+                           iter->relative_path);
+
                if (S_ISDIR(iter->st.st_mode)) {
                        mkdir_if_missing(dest->buf, 0777);
                        continue;
diff --git a/shell.c b/shell.c
index 811e13b9c9597e9c89bf773a1065819d48a2277c..7ff4109db7058b5677be2fa8775f699b54e4d4f1 100644 (file)
--- a/shell.c
+++ b/shell.c
@@ -47,6 +47,8 @@ static void cd_to_homedir(void)
                die("could not chdir to user's home directory");
 }
 
+#define MAX_INTERACTIVE_COMMAND (4*1024*1024)
+
 static void run_shell(void)
 {
        int done = 0;
@@ -67,22 +69,46 @@ static void run_shell(void)
        run_command_v_opt(help_argv, RUN_SILENT_EXEC_FAILURE);
 
        do {
-               struct strbuf line = STRBUF_INIT;
                const char *prog;
                char *full_cmd;
                char *rawargs;
+               size_t len;
                char *split_args;
                const char **argv;
                int code;
                int count;
 
                fprintf(stderr, "git> ");
-               if (git_read_line_interactively(&line) == EOF) {
+
+               /*
+                * Avoid using a strbuf or git_read_line_interactively() here.
+                * We don't want to allocate arbitrary amounts of memory on
+                * behalf of a possibly untrusted client, and we're subject to
+                * OS limits on command length anyway.
+                */
+               fflush(stdout);
+               rawargs = xmalloc(MAX_INTERACTIVE_COMMAND);
+               if (!fgets(rawargs, MAX_INTERACTIVE_COMMAND, stdin)) {
                        fprintf(stderr, "\n");
-                       strbuf_release(&line);
+                       free(rawargs);
                        break;
                }
-               rawargs = strbuf_detach(&line, NULL);
+               len = strlen(rawargs);
+
+               /*
+                * If we truncated due to our input buffer size, reject the
+                * command. That's better than running bogus input, and
+                * there's a good chance it's just malicious garbage anyway.
+                */
+               if (len >= MAX_INTERACTIVE_COMMAND - 1)
+                       die("invalid command format: input too long");
+
+               if (len > 0 && rawargs[len - 1] == '\n') {
+                       if (--len > 0 && rawargs[len - 1] == '\r')
+                               --len;
+                       rawargs[len] = '\0';
+               }
+
                split_args = xstrdup(rawargs);
                count = split_cmdline(split_args, &argv);
                if (count < 0) {
index f7c7df0ca427b396ed757dd7e323d9eb03a366ff..25a5f3016f08d52c5e50722976399f61d6a25643 100644 (file)
@@ -197,6 +197,7 @@ test_git_directory_exists () {
 # the submodule repo if it doesn't exist and configures the most problematic
 # settings for diff.ignoreSubmodules.
 prolog () {
+       test_config_global protocol.file.allow always &&
        (test -d submodule_update_repo || create_lib_submodule_repo) &&
        test_config_global diff.ignoreSubmodules all &&
        test_config diff.ignoreSubmodules all
index 272ba1b566b3eaf43798f9ecfb1a77c26db3f59b..3db9fd3c8cb5ea108e88b11232e0a0c4e630dd02 100755 (executable)
@@ -472,7 +472,8 @@ test_expect_success 'interaction with submodules' '
        (
                cd super &&
                mkdir modules &&
-               git submodule add ../repo modules/child &&
+               git -c protocol.file.allow=always \
+                       submodule add ../repo modules/child &&
                git add . &&
                git commit -m "add submodule" &&
                git sparse-checkout init --cone &&
index 16fbd2c6db9db18456b6a02d443b2b518aafc9e0..c37e0f59bca02ef61c9da19adbb25141a3076483 100755 (executable)
@@ -675,6 +675,8 @@ test_expect_success 'submodule handling' '
        test_all_match git add modules &&
        test_all_match git commit -m "add modules directory" &&
 
+       test_config_global protocol.file.allow always &&
+
        run_on_all git submodule add "$(pwd)/initial-repo" modules/sub &&
        test_all_match git commit -m "add submodule" &&
 
index 1c2df08333bc600e4fc22f1f55c1d6950b876d67..2c429f9635cc2340307ba0ac82e0eed8808f7e85 100755 (executable)
@@ -225,7 +225,8 @@ test_expect_success 'showing the superproject correctly' '
        test_commit -C super test_commit &&
        test_create_repo sub &&
        test_commit -C sub test_commit &&
-       git -C super submodule add ../sub dir/sub &&
+       git -c protocol.file.allow=always \
+               -C super submodule add ../sub dir/sub &&
        echo $(pwd)/super >expect  &&
        git -C super/dir/sub rev-parse --show-superproject-working-tree >out &&
        test_cmp expect out &&
index 3e0f8c675f7bf8602bbfe0562e2a92b90a7dc925..393ba3545e71c46babe9e95b6e597b2282ab5636 100755 (executable)
@@ -41,6 +41,8 @@ TEST_NO_CREATE_REPO=1
 #  -                  m/m (file)
 #
 test_expect_success 'setup repo for checkout with various types of changes' '
+       test_config_global protocol.file.allow always &&
+
        git init sub &&
        (
                cd sub &&
@@ -140,6 +142,7 @@ do
        esac
 
        test_expect_success "$mode checkout on clone" '
+               test_config_global protocol.file.allow always &&
                repo=various_${mode}_clone &&
                set_checkout_config $workers $threshold &&
                test_checkout_workers $expected_workers \
index 37ad79470fb9e009e99447b04cc05673314e49e3..54b0eb6dce5a866c3939b93e88837be2b025c93f 100755 (executable)
@@ -614,6 +614,7 @@ test_expect_success '"add" should not fail because of another bad worktree' '
 '
 
 test_expect_success '"add" with uninitialized submodule, with submodule.recurse unset' '
+       test_config_global protocol.file.allow always &&
        test_create_repo submodule &&
        test_commit -C submodule first &&
        test_create_repo project &&
@@ -629,6 +630,7 @@ test_expect_success '"add" with uninitialized submodule, with submodule.recurse
 '
 
 test_expect_success '"add" with initialized submodule, with submodule.recurse unset' '
+       test_config_global protocol.file.allow always &&
        git -C project-clone submodule update --init &&
        git -C project-clone worktree add ../project-4
 '
index a4e1a178e0a00335affa95d566728e3085804b47..e8246eed9c60472fc259691213fdf0b3b4fd03d5 100755 (executable)
@@ -138,7 +138,8 @@ test_expect_success 'move a repo with uninitialized submodule' '
        (
                cd withsub &&
                test_commit initial &&
-               git submodule add "$PWD"/.git sub &&
+               git -c protocol.file.allow=always \
+                       submodule add "$PWD"/.git sub &&
                git commit -m withsub &&
                git worktree add second HEAD &&
                git worktree move second third
@@ -148,7 +149,7 @@ test_expect_success 'move a repo with uninitialized submodule' '
 test_expect_success 'not move a repo with initialized submodule' '
        (
                cd withsub &&
-               git -C third submodule update &&
+               git -c protocol.file.allow=always -C third submodule update &&
                test_must_fail git worktree move third forth
        )
 '
@@ -227,6 +228,7 @@ test_expect_success 'remove cleans up .git/worktrees when empty' '
 '
 
 test_expect_success 'remove a repo with uninitialized submodule' '
+       test_config_global protocol.file.allow always &&
        (
                cd withsub &&
                git worktree add to-remove HEAD &&
@@ -235,6 +237,7 @@ test_expect_success 'remove a repo with uninitialized submodule' '
 '
 
 test_expect_success 'not remove a repo with initialized submodule' '
+       test_config_global protocol.file.allow always &&
        (
                cd withsub &&
                git worktree add to-remove HEAD &&
index b172c26ca43291e61ed2d38f720047fdc8a9d785..11018f37c70c02e9052b36be9edb8b05211bcf8d 100755 (executable)
@@ -10,6 +10,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 base_path=$(pwd -P)
 
 test_expect_success 'setup: create origin repos'  '
+       git config --global protocol.file.allow always &&
        git init origin/sub &&
        test_commit -C origin/sub file1 &&
        git init origin/main &&
index e575ffb4ffb4c2d9c69da9b83706a7eecd01a6ef..354e625fbdbbdcd9ce4e864664e0c1cb31295c2d 100755 (executable)
@@ -282,6 +282,7 @@ test_expect_success 'deleting checked-out branch from repo that is a submodule'
        git init repo1 &&
        git init repo1/sub &&
        test_commit -C repo1/sub x &&
+       test_config_global protocol.file.allow always &&
        git -C repo1 submodule add ./sub &&
        git -C repo1 commit -m "adding sub" &&
 
index 43fcb68f27e439b5542e82a85bc77e401adc6e98..693934ee8be9600e6edda9e691b5415f8c153b34 100755 (executable)
@@ -310,7 +310,7 @@ test_expect_success 'autostash is saved on editor failure with conflict' '
 test_expect_success 'autostash with dirty submodules' '
        test_when_finished "git reset --hard && git checkout main" &&
        git checkout -b with-submodule &&
-       git submodule add ./ sub &&
+       git -c protocol.file.allow=always submodule add ./ sub &&
        test_tick &&
        git commit -m add-submodule &&
        echo changed >sub/file0 &&
index 0ad3a07bf470939a8fa53f38e83fa609f2d7371f..fb21f675bb94c143d10b754f8ff59472b44eb567 100755 (executable)
@@ -47,7 +47,8 @@ test_expect_success 'rebase interactive ignores modified submodules' '
        git init sub &&
        git -C sub commit --allow-empty -m "Initial commit" &&
        git init super &&
-       git -C super submodule add ../sub &&
+       git -c protocol.file.allow=always \
+               -C super submodule add ../sub &&
        git -C super config submodule.sub.ignore dirty &&
        >super/foo &&
        git -C super add foo &&
index c657840db33b6e8d4c47ece5c9eb0feba495825a..f22d1ddead1ac94de714f61fc10b87cc4bae3aec 100755 (executable)
@@ -16,6 +16,8 @@ fi
 test_submodule_switch "cherry-pick"
 
 test_expect_success 'unrelated submodule/file conflict is ignored' '
+       test_config_global protocol.file.allow always &&
+
        test_create_repo sub &&
 
        touch sub/file &&
index bb9ef35dac082e396d5cbcbdc83bc5394fb95a7c..a0eda54cde063258cf570f983355459a2aa6ffb8 100755 (executable)
@@ -336,7 +336,7 @@ test_expect_success 'rm removes empty submodules from work tree' '
 
 test_expect_success 'rm removes removed submodule from index and .gitmodules' '
        git reset --hard &&
-       git submodule update &&
+       git -c protocol.file.allow=always submodule update &&
        rm -rf submod &&
        git rm submod &&
        git status -s -uno --ignore-submodules=none >actual &&
@@ -642,6 +642,7 @@ cat >expect.deepmodified <<EOF
 EOF
 
 test_expect_success 'setup subsubmodule' '
+       test_config_global protocol.file.allow always &&
        git reset --hard &&
        git submodule update &&
        (
index a52e53dd2da481e3c24a82d9599a58c0d1c5ab43..0f7348ec21b8821cb6b7594919bbc637ec0a7236 100755 (executable)
@@ -36,7 +36,7 @@ setup_basic () {
        git init main &&
        (
                cd main &&
-               git submodule add ../sub &&
+               git -c protocol.file.allow=always submodule add ../sub &&
                test_commit main_file
        )
 }
index 49bca7b48d910fa1128435f121c849e45a7eefa6..d489230df89663620fda4a11b538fc740720a8aa 100755 (executable)
@@ -49,7 +49,7 @@ test_expect_success 'setup - submodules' '
 '
 
 test_expect_success 'setup - git submodule add' '
-       git submodule add ./sm2 sm1 &&
+       git -c protocol.file.allow=always submodule add ./sm2 sm1 &&
        commit_file sm1 .gitmodules &&
        git diff-tree -p --no-commit-id --submodule=log HEAD -- sm1 >actual &&
        cat >expected <<-EOF &&
index d86e38abd882220ec60d45b2a351d2947f7dcfcb..97c6424cd51714eeadffd5899c709a409b1cedd9 100755 (executable)
@@ -840,7 +840,7 @@ rm sm2
 mv sm2-bak sm2
 
 test_expect_success 'setup nested submodule' '
-       git -C sm2 submodule add ../sm2 nested &&
+       git -c protocol.file.allow=always -C sm2 submodule add ../sm2 nested &&
        git -C sm2 commit -a -m "nested sub" &&
        head10=$(git -C sm2 rev-parse --short --verify HEAD)
 '
index 804f2a82e8315d4f5936894adf7846769d2e201d..28f42a4046e08ed61fcf2f300b826c33136e9e98 100755 (executable)
@@ -77,6 +77,7 @@ test_expect_success 'diff skips same-OID blobs' '
 
 test_expect_success 'when fetching missing objects, diff skips GITLINKs' '
        test_when_finished "rm -rf sub server client trace" &&
+       test_config_global protocol.file.allow always &&
 
        test_create_repo sub &&
        test_commit -C sub first &&
index 7f0c1dcc0f0bfbfd746648f4fee1b7588a8f31b8..2e8f5ad7b822b2c33d1262c5576706f40de52692 100755 (executable)
@@ -124,6 +124,7 @@ test_expect_success 'command line pathspec parsing for "git log"' '
 
 test_expect_success 'tree_entry_interesting does not match past submodule boundaries' '
        test_when_finished "rm -rf repo submodule" &&
+       test_config_global protocol.file.allow always &&
        git init submodule &&
        test_commit -C submodule initial &&
        git init repo &&
index a0faf0dd94909392d7fa3b263b30b2bb41d7ca35..96b839d598f157645dfc16e6441419390b81cf0f 100755 (executable)
@@ -782,6 +782,7 @@ test_expect_success 'fetch.writeCommitGraph' '
 '
 
 test_expect_success 'fetch.writeCommitGraph with submodules' '
+       test_config_global protocol.file.allow always &&
        git clone dups super &&
        (
                cd super &&
index 2dc75b80db80964a6bcdbc3977be98f815b40dd0..4e8ea3a8dc0fc80e2ee436a331950cd6493746d0 100755 (executable)
@@ -41,6 +41,7 @@ add_upstream_commit() {
 }
 
 test_expect_success setup '
+       git config --global protocol.file.allow always &&
        mkdir deepsubmodule &&
        (
                cd deepsubmodule &&
index 214228349ad3995e49815850412e9c24bfc58065..a158e7d2c011f464c90ff69e7eda1c6ae0669ece 100755 (executable)
@@ -119,6 +119,7 @@ test_expect_success 'push options and submodules' '
        test_commit -C parent one &&
        git -C parent push --mirror up &&
 
+       test_config_global protocol.file.allow always &&
        git -C parent submodule add ../upstream workbench &&
        git -C parent/workbench remote add up ../../upstream &&
        git -C parent commit -m "add submodule" &&
index fa6b4cca65c8c687bf83f9eaf0ecb5568c9373f6..069c170572ffd0bdfc8b4aea72b61cdf56907d3e 100755 (executable)
@@ -52,6 +52,10 @@ then
 fi
 test_submodule_switch_func "git_pull_noff"
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'pull --recurse-submodule setup' '
        test_create_repo child &&
        test_commit -C child bar &&
index 83c24fc97a7b1f067f1c04bf93ba849e9ffff945..20aef0018c2d1d1059096833121c9c2e7838ef1d 100755 (executable)
@@ -742,6 +742,7 @@ test_expect_success 'batch missing blob request does not inadvertently try to fe
        echo aa >server/a &&
        echo bb >server/b &&
        # Also add a gitlink pointing to an arbitrary repository
+       test_config_global protocol.file.allow always &&
        git -C server submodule add "$(pwd)/repo_for_submodule" c &&
        git -C server add a b c &&
        git -C server commit -m x &&
index 24340e6d56e18d6a2a9082654c95ef58ac7ed196..2734e37e8804cd6944301e1d836af517fb1172b5 100755 (executable)
@@ -303,8 +303,6 @@ test_expect_success SYMLINKS 'setup repo with manually symlinked or unknown file
                ln -s ../an-object $obj &&
 
                cd ../ &&
-               find . -type f | sort >../../../T.objects-files.raw &&
-               find . -type l | sort >../../../T.objects-symlinks.raw &&
                echo unknown_content >unknown_file
        ) &&
        git -C T fsck &&
@@ -313,19 +311,27 @@ test_expect_success SYMLINKS 'setup repo with manually symlinked or unknown file
 
 
 test_expect_success SYMLINKS 'clone repo with symlinked or unknown files at objects/' '
-       for option in --local --no-hardlinks --shared --dissociate
+       # None of these options work when cloning locally, since T has
+       # symlinks in its `$GIT_DIR/objects` directory
+       for option in --local --no-hardlinks --dissociate
        do
-               git clone $option T T$option || return 1 &&
-               git -C T$option fsck || return 1 &&
-               git -C T$option rev-list --all --objects >T$option.objects &&
-               test_cmp T.objects T$option.objects &&
-               (
-                       cd T$option/.git/objects &&
-                       find . -type f | sort >../../../T$option.objects-files.raw &&
-                       find . -type l | sort >../../../T$option.objects-symlinks.raw
-               )
+               test_must_fail git clone $option T T$option 2>err || return 1 &&
+               test_i18ngrep "symlink.*exists" err || return 1
        done &&
 
+       # But `--shared` clones should still work, even when specifying
+       # a local path *and* that repository has symlinks present in its
+       # `$GIT_DIR/objects` directory.
+       git clone --shared T T--shared &&
+       git -C T--shared fsck &&
+       git -C T--shared rev-list --all --objects >T--shared.objects &&
+       test_cmp T.objects T--shared.objects &&
+       (
+               cd T--shared/.git/objects &&
+               find . -type f | sort >../../../T--shared.objects-files.raw &&
+               find . -type l | sort >../../../T--shared.objects-symlinks.raw
+       ) &&
+
        for raw in $(ls T*.raw)
        do
                sed -e "s!/../!/Y/!; s![0-9a-f]\{38,\}!Z!" -e "/commit-graph/d" \
@@ -333,26 +339,6 @@ test_expect_success SYMLINKS 'clone repo with symlinked or unknown files at obje
                sort $raw.de-sha-1 >$raw.de-sha || return 1
        done &&
 
-       cat >expected-files <<-EOF &&
-       ./Y/Z
-       ./Y/Z
-       ./Y/Z
-       ./a-loose-dir/Z
-       ./an-object
-       ./info/packs
-       ./pack/pack-Z.idx
-       ./pack/pack-Z.pack
-       ./packs/pack-Z.idx
-       ./packs/pack-Z.pack
-       ./unknown_file
-       EOF
-
-       for option in --local --no-hardlinks --dissociate
-       do
-               test_cmp expected-files T$option.objects-files.raw.de-sha || return 1 &&
-               test_must_be_empty T$option.objects-symlinks.raw.de-sha || return 1
-       done &&
-
        echo ./info/alternates >expected-files &&
        test_cmp expected-files T--shared.objects-files.raw &&
        test_must_be_empty T--shared.objects-symlinks.raw
index 5504b519c79c9b2b9d0ab7d036da1b8b56975a21..0c85ef834ab90e6fddec2ec510929df1d62acb1d 100755 (executable)
@@ -24,6 +24,7 @@ test_expect_success 'setup' '
 
 test_expect_success 'nonshallow clone implies nonshallow submodule' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git clone --recurse-submodules "file://$pwd/." super_clone &&
        git -C super_clone log --oneline >lines &&
        test_line_count = 3 lines &&
@@ -33,6 +34,7 @@ test_expect_success 'nonshallow clone implies nonshallow submodule' '
 
 test_expect_success 'shallow clone with shallow submodule' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git clone --recurse-submodules --depth 2 --shallow-submodules "file://$pwd/." super_clone &&
        git -C super_clone log --oneline >lines &&
        test_line_count = 2 lines &&
@@ -42,6 +44,7 @@ test_expect_success 'shallow clone with shallow submodule' '
 
 test_expect_success 'shallow clone does not imply shallow submodule' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git clone --recurse-submodules --depth 2 "file://$pwd/." super_clone &&
        git -C super_clone log --oneline >lines &&
        test_line_count = 2 lines &&
@@ -51,6 +54,7 @@ test_expect_success 'shallow clone does not imply shallow submodule' '
 
 test_expect_success 'shallow clone with non shallow submodule' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git clone --recurse-submodules --depth 2 --no-shallow-submodules "file://$pwd/." super_clone &&
        git -C super_clone log --oneline >lines &&
        test_line_count = 2 lines &&
@@ -60,6 +64,7 @@ test_expect_success 'shallow clone with non shallow submodule' '
 
 test_expect_success 'non shallow clone with shallow submodule' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git clone --recurse-submodules --no-local --shallow-submodules "file://$pwd/." super_clone &&
        git -C super_clone log --oneline >lines &&
        test_line_count = 3 lines &&
@@ -69,6 +74,7 @@ test_expect_success 'non shallow clone with shallow submodule' '
 
 test_expect_success 'clone follows shallow recommendation' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git config -f .gitmodules submodule.sub.shallow true &&
        git add .gitmodules &&
        git commit -m "recommend shallow for sub" &&
@@ -87,6 +93,7 @@ test_expect_success 'clone follows shallow recommendation' '
 
 test_expect_success 'get unshallow recommended shallow submodule' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git clone --no-local "file://$pwd/." super_clone &&
        (
                cd super_clone &&
@@ -103,6 +110,7 @@ test_expect_success 'get unshallow recommended shallow submodule' '
 
 test_expect_success 'clone follows non shallow recommendation' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git config -f .gitmodules submodule.sub.shallow false &&
        git add .gitmodules &&
        git commit -m "recommend non shallow for sub" &&
index cf3e82bdf5cc1c823709963402eb3396ba0ba01a..8b2605b55f0a7f8bafb64dcc7b14cf63fe2f56e3 100755 (executable)
@@ -174,6 +174,8 @@ test_expect_success 'partial clone with transfer.fsckobjects=1 works with submod
        test_config -C src_with_sub uploadpack.allowfilter 1 &&
        test_config -C src_with_sub uploadpack.allowanysha1inwant 1 &&
 
+       test_config_global protocol.file.allow always &&
+
        git -C src_with_sub submodule add "file://$(pwd)/submodule" mysub &&
        git -C src_with_sub commit -m "commit with submodule" &&
 
index e2dbb4eabae2aa141b3b1d5a1a5b0e4cdd9d0e65..5691f27405c060293ea400b551e86dc21e7aee91 100755 (executable)
@@ -10,6 +10,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 pwd=$(pwd)
 
 test_expect_success 'setup' '
+       git config --global protocol.file.allow always &&
        git checkout -b main &&
        test_commit commit1 &&
        mkdir sub &&
index 3153a0d891046421f53ea6543182c47ca750e07a..a0a070b404293a0c28400f73d8e7da5c7bb9cc48 100755 (executable)
@@ -26,7 +26,7 @@ test_expect_success 'setup' '
 
        : > super-file &&
        git add super-file &&
-       git submodule add "$(pwd)" sub &&
+       git -c protocol.file.allow=always submodule add "$(pwd)" sub &&
        git symbolic-ref HEAD refs/heads/super &&
        test_tick &&
        git commit -m super-initial &&
index 0f1cb49cedc645c5a9b0c56257d3aca4740d5cd3..7a8c9e32473b3f2cf48bc8465dfd05e62ce1ed51 100755 (executable)
@@ -9,7 +9,7 @@ test_expect_success 'setup a submodule' '
        : >pretzel/a &&
        git -C pretzel add a &&
        git -C pretzel commit -m "add a file" -- a &&
-       git submodule add ./pretzel sub &&
+       git -c protocol.file.allow=always submodule add ./pretzel sub &&
        git commit -a -m "add submodule" &&
        git submodule deinit --all
 '
index 963356ba5f9257c3691e67267ff1d0cfb86355ad..9865ecdac8e0964c53625d43e56b0aad87a8b05e 100755 (executable)
@@ -305,6 +305,7 @@ test_expect_success SYMLINKS 'check moved symlink' '
 rm -f moved symlink
 
 test_expect_success 'setup submodule' '
+       test_config_global protocol.file.allow always &&
        git commit -m initial &&
        git reset --hard &&
        git submodule add ./. sub &&
@@ -490,6 +491,7 @@ test_expect_success 'moving a submodule in nested directories' '
 '
 
 test_expect_success 'moving nested submodules' '
+       test_config_global protocol.file.allow always &&
        git commit -am "cleanup commit" &&
        mkdir sub_nested_nested &&
        (
index eeb0534163db176442d38d19d0afb186cd985666..5a0c5685bd087324674ca9189b0b1e6d68e47035 100755 (executable)
@@ -462,6 +462,7 @@ test_expect_success 'create and add submodule, submodule appears clean (A. S...)
        git checkout initial-branch &&
        git clone . sub_repo &&
        git clone . super_repo &&
+       test_config_global protocol.file.allow always &&
        (       cd super_repo &&
                git submodule add ../sub_repo sub1 &&
 
index 0399701e6276d67ac8736128f24e8f8bf94a6b12..c975eb54d234d77b2f13df2a96acd4cbefb93865 100755 (executable)
@@ -480,6 +480,7 @@ test_expect_success 'should not clean submodules' '
                git init &&
                test_commit msg hello.world
        ) &&
+       test_config_global protocol.file.allow always &&
        git submodule add ./repo/.git sub1 &&
        git commit -m "sub1" &&
        git branch before_sub2 &&
index cb1b8e35dbfa65d92636da5f9737c0ec8a1e26aa..ae3fc0143fdbaca00c4e0c646ffe075f6c9e58db 100755 (executable)
@@ -14,6 +14,10 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
 
+test_expect_success 'setup - enable local submodules' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'submodule deinit works on empty repository' '
        git submodule deinit --all
 '
index 7d2ac3322b50cc580d2212f40658cdda66204a16..ea92ef52a5eb9c593039614a6e42fa308a68b852 100755 (executable)
@@ -14,6 +14,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 . ./test-lib.sh
 
 test_expect_success setup '
+       git config --global protocol.file.allow always &&
+
        echo file >file &&
        git add file &&
        test_tick &&
index 11cccbb333b127436aebea313e0270acea812e87..53d419c0edbd246e3405875e3627aa968d7d83e4 100755 (executable)
@@ -25,6 +25,7 @@ compare_head()
 
 
 test_expect_success 'setup a submodule tree' '
+       git config --global protocol.file.allow always &&
        echo file > file &&
        git add file &&
        test_tick &&
index e2f110b786387035f6cc4fa31a21f9c380edb2f4..59bd150166793000ed60e70fc9e570519f53f055 100755 (executable)
@@ -16,6 +16,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 
 test_expect_success 'setup a submodule tree' '
+       git config --global protocol.file.allow always &&
        echo file > file &&
        git add file &&
        test_tick &&
index a3892f494b68c866b150fdead376942bff47541b..02feb8577962687a81d9bc03ea330fcec2c5b6ee 100755 (executable)
@@ -17,6 +17,10 @@ test_alternate_is_used () {
        test_cmp expect actual
 }
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'preparing first repository' '
        test_create_repo A &&
        (
index e17ac81a893e329828c5bfe1458f4db1a2fb4841..374ed481e9c64b9813a11b57c80f7b6f22c791e1 100755 (executable)
@@ -15,6 +15,10 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'submodule on detached working tree' '
        git init --bare remote &&
        test_create_repo bundle1 &&
index ad28e9388053c4009f4af3121788951f9e79d848..c583c4e373ad0de2a0b51080010da995646dff3a 100755 (executable)
@@ -12,6 +12,9 @@ from the database and from the worktree works.
 TEST_NO_CREATE_REPO=1
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
 test_expect_success 'submodule config cache setup' '
        mkdir submodule &&
        (cd submodule &&
index c8e7e983317610b54da89101bea8f7c59a4dcec3..c8b5ac2928f5a92a8a5c975b59a1ca7d3cf775a1 100755 (executable)
@@ -9,6 +9,7 @@ submodules which are "active" and interesting to the user.
 . ./test-lib.sh
 
 test_expect_success 'setup' '
+       git config --global protocol.file.allow always &&
        git init sub &&
        test_commit -C sub initial &&
        git init super &&
index f2e7df59cf24c254440a8bc1c7d5c195c8bfcd5b..cf95603d7d72042a0d5f21e477c900a2f23a8d40 100755 (executable)
@@ -30,7 +30,8 @@ test_expect_success 'no warning when updating entry' '
 
 test_expect_success 'submodule add does not warn' '
        test_when_finished "git rm -rf submodule .gitmodules" &&
-       git submodule add ./embed submodule 2>stderr &&
+       git -c protocol.file.allow=always \
+               submodule add ./embed submodule 2>stderr &&
        test_i18ngrep ! warning stderr
 '
 
index d21dc8b009f6d0d8e75368d01a984ac350155ba3..3ebd98598144c95165cc75870e6d586407add1c8 100755 (executable)
@@ -3,6 +3,10 @@
 test_description='check handling of disallowed .gitmodule urls'
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'create submodule with protected dash in url' '
        git init upstream &&
        git -C upstream commit --allow-empty -m base &&
index f0f6b9fa9e9a029bd8a17337beb402d1618ca948..2f4b25dfd7e3860e47c0acdd3a9eeabff7f5504e 100755 (executable)
@@ -6,6 +6,10 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'create submodule with dash in path' '
        git init upstream &&
        git -C upstream commit --allow-empty -m base &&
index f87e524d6d467fd723c083c105f092850051f566..0897516ca90b7b8035e451bd5eabca24528b7ab5 100755 (executable)
@@ -17,6 +17,10 @@ export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
 
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'sparse checkout setup which hides .gitmodules' '
        git init upstream &&
        git init submodule &&
index 3b925c302fc4e2194a2e0ad10c0b48823f2cf021..5357093e98ffbd1508d4e98c0e7ed904c789d119 100755 (executable)
@@ -12,6 +12,10 @@ as expected.
 TEST_NO_CREATE_REPO=1
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'submodule config cache setup' '
        mkdir submodule &&
        (cd submodule &&
index ef0cb6e8e185379dc853e16dcd7d2ea84ac8c9ff..d6bf62b3ac670fc0be8167150cdf79cbd9000a45 100755 (executable)
@@ -12,6 +12,10 @@ as expected.
 TEST_NO_CREATE_REPO=1
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'submodule config cache setup' '
        mkdir submodule &&
        (
index b070f13714a7ee194e513cffd143ef2b0039afe3..ce64d8b13721732a30d8739c72dfdba670060454 100755 (executable)
@@ -12,6 +12,10 @@ while making sure to add submodules using `git submodule add` instead of
 
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'summary test environment setup' '
        git init sm &&
        test_commit -C sm "add file" file file-content file-tag &&
index 41706c1c9ff91d4ac11d9af9f8acdd7f587b896d..c02008c3754e2db3b5b342805c7c495951ee2d5d 100755 (executable)
@@ -15,6 +15,10 @@ Such as:
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-pack.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'check names' '
        cat >expect <<-\EOF &&
        valid
index 3fcb44767f51052f637683a34cbb8a2f21c777cc..459300c40bb211c7735cbd333d89041688168daa 100755 (executable)
@@ -251,6 +251,7 @@ test_expect_success 'status with merge conflict in .gitmodules' '
        test_create_repo_with_commit sub1 &&
        test_tick &&
        test_create_repo_with_commit sub2 &&
+       test_config_global protocol.file.allow always &&
        (
                cd super &&
                prev=$(git rev-parse HEAD) &&
@@ -326,6 +327,7 @@ test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
 # sub2 will have an untracked file
 # sub3 will have an untracked repository
 test_expect_success 'setup superproject with untracked file in nested submodule' '
+       test_config_global protocol.file.allow always &&
        (
                cd super &&
                git clean -dfx &&
index ed2653d46fe6cd0ed1dd5dc2dfd73f7340b8fe31..bd0ae4b1eabab4062ec897529846f6ffb3a8fd5c 100755 (executable)
@@ -74,6 +74,7 @@ test_expect_success 'diff in message is retained with -v' '
 
 test_expect_success 'submodule log is stripped out too with -v' '
        git config diff.submodule log &&
+       test_config_global protocol.file.allow always &&
        git submodule add ./. sub &&
        git commit -m "sub added" &&
        (
index 096456292c0ad604d90c1d4d2aebb8aacf883d99..24297e26ca028bd0b36aa29803a51c6ddde73f0c 100755 (executable)
@@ -636,6 +636,7 @@ test_expect_success 'difftool --no-symlinks detects conflict ' '
 
 test_expect_success 'difftool properly honors gitlink and core.worktree' '
        test_when_finished rm -rf submod/ule &&
+       test_config_global protocol.file.allow always &&
        git submodule add ./. submod/ule &&
        test_config -C submod/ule diff.tool checktrees &&
        test_config -C submod/ule difftool.checktrees.cmd '\''
index 058e5d0c966dfd8fe816de8fdc6bcff7f93a70ac..a10b20c87f1fbe85e706165eb8eeedf325c63b42 100755 (executable)
@@ -196,6 +196,7 @@ test_expect_success !MINGW 'grep recurse submodule colon in name' '
        git -C "su:b" commit -m "add fi:le" &&
        test_tick &&
 
+       test_config_global protocol.file.allow always &&
        git -C parent submodule add "../su:b" "su:b" &&
        git -C parent commit -m "add submodule" &&
        test_tick &&
@@ -230,6 +231,7 @@ test_expect_success 'grep history with moved submoules' '
        git -C sub commit -m "add file" &&
        test_tick &&
 
+       test_config_global protocol.file.allow always &&
        git -C parent submodule add ../sub dir/sub &&
        git -C parent commit -m "add submodule" &&
        test_tick &&
@@ -274,6 +276,7 @@ test_expect_success 'grep using relative path' '
        mkdir parent/src &&
        echo "(1|2)d(3|4)" >parent/src/file2 &&
        git -C parent add src/file2 &&
+       test_config_global protocol.file.allow always &&
        git -C parent submodule add ../sub &&
        git -C parent commit -m "add files and submodule" &&
        test_tick &&
@@ -316,6 +319,7 @@ test_expect_success 'grep from a subdir' '
        mkdir parent/src &&
        echo "(1|2)d(3|4)" >parent/src/file &&
        git -C parent add src/file &&
+       test_config_global protocol.file.allow always &&
        git -C parent submodule add ../sub src/sub &&
        git -C parent submodule add ../sub sub &&
        git -C parent commit -m "add files and submodules" &&
index d4359dba21c9cff29da7f96541e7c2293da759f3..73f3ca2b115015569bbda92f4a9464de58c64783 100755 (executable)
@@ -25,6 +25,7 @@ test_expect_success 'import with large marks file' '
 '
 
 test_expect_success 'setup dump with submodule' '
+       test_config_global protocol.file.allow always &&
        git submodule add "$PWD" sub &&
        git commit -m "add submodule" &&
        git fast-export HEAD >dump
index 409b48e244224629a11ced5d9cbd99fd81f167ae..3e0b0398cf8eeb05b3eff0e65819dd87360655cc 100755 (executable)
@@ -268,6 +268,7 @@ test_expect_success 'signed-tags=warn-strip' '
 
 test_expect_success 'setup submodule' '
 
+       test_config_global protocol.file.allow always &&
        git checkout -f main &&
        mkdir sub &&
        (
@@ -293,6 +294,7 @@ test_expect_success 'setup submodule' '
 
 test_expect_success 'submodule fast-export | fast-import' '
 
+       test_config_global protocol.file.allow always &&
        SUBENT1=$(git ls-tree main^ sub) &&
        SUBENT2=$(git ls-tree main sub) &&
        rm -rf new &&
diff --git a/t/t9850-shell.sh b/t/t9850-shell.sh
new file mode 100755 (executable)
index 0000000..cfc71c3
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+test_description='git shell tests'
+. ./test-lib.sh
+
+test_expect_success 'shell allows upload-pack' '
+       printf 0000 >input &&
+       git upload-pack . <input >expect &&
+       git shell -c "git-upload-pack $SQ.$SQ" <input >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'shell forbids other commands' '
+       test_must_fail git shell -c "git config foo.bar baz"
+'
+
+test_expect_success 'shell forbids interactive use by default' '
+       test_must_fail git shell
+'
+
+test_expect_success 'shell allows interactive command' '
+       mkdir git-shell-commands &&
+       write_script git-shell-commands/ping <<-\EOF &&
+       echo pong
+       EOF
+       echo pong >expect &&
+       echo ping | git shell >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'shell complains of overlong commands' '
+       perl -e "print \"a\" x 2**12 for (0..2**19)" |
+       test_must_fail git shell 2>err &&
+       grep "too long" err
+'
+
+test_done
index e4f1decae2063ce8981344c19626141c8bcd866c..050c143a8d76762fcac2ae760ad9592a26606177 100644 (file)
@@ -995,8 +995,7 @@ static enum protocol_allow_config get_protocol_config(const char *type)
        if (!strcmp(type, "http") ||
            !strcmp(type, "https") ||
            !strcmp(type, "git") ||
-           !strcmp(type, "ssh") ||
-           !strcmp(type, "file"))
+           !strcmp(type, "ssh"))
                return PROTOCOL_ALLOW_ALWAYS;
 
        /* known scary; err on the side of caution */