summaryrefslogtreecommitdiff
path: root/git/objects/submodule/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2022-12-29 08:09:28 +0100
committerGitHub <noreply@github.com>2022-12-29 08:09:28 +0100
commit678a8fe08dd466fcfe8676294b52887955138960 (patch)
treee0cb96633dc1c1cf8c362e2097140d75f60447f6 /git/objects/submodule/base.py
parentae6a6e4b088a35c0fc7b17940722c8a515f7bee7 (diff)
parentf4f2658d5d308b3fb9162e50cd4c7b346e7a0a47 (diff)
downloadgitpython-678a8fe08dd466fcfe8676294b52887955138960.tar.gz
Merge pull request #1521 from stsewd/block-insecure-options
Block insecure options and protocols by default
Diffstat (limited to 'git/objects/submodule/base.py')
-rw-r--r--git/objects/submodule/base.py36
1 files changed, 33 insertions, 3 deletions
diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py
index bdcdf1ec..9aa9deb2 100644
--- a/git/objects/submodule/base.py
+++ b/git/objects/submodule/base.py
@@ -272,7 +272,16 @@ class Submodule(IndexObject, TraversableIterableObj):
# end
@classmethod
- def _clone_repo(cls, repo: "Repo", url: str, path: PathLike, name: str, **kwargs: Any) -> "Repo":
+ def _clone_repo(
+ cls,
+ repo: "Repo",
+ url: str,
+ path: PathLike,
+ name: str,
+ allow_unsafe_options: bool = False,
+ allow_unsafe_protocols: bool = False,
+ **kwargs: Any,
+ ) -> "Repo":
""":return: Repo instance of newly cloned repository
:param repo: our parent repository
:param url: url to clone from
@@ -289,7 +298,13 @@ class Submodule(IndexObject, TraversableIterableObj):
module_checkout_path = osp.join(str(repo.working_tree_dir), path)
# end
- clone = git.Repo.clone_from(url, module_checkout_path, **kwargs)
+ clone = git.Repo.clone_from(
+ url,
+ module_checkout_path,
+ allow_unsafe_options=allow_unsafe_options,
+ allow_unsafe_protocols=allow_unsafe_protocols,
+ **kwargs,
+ )
if cls._need_gitfile_submodules(repo.git):
cls._write_git_file_and_module_config(module_checkout_path, module_abspath)
# end
@@ -359,6 +374,8 @@ class Submodule(IndexObject, TraversableIterableObj):
depth: Union[int, None] = None,
env: Union[Mapping[str, str], None] = None,
clone_multi_options: Union[Sequence[TBD], None] = None,
+ allow_unsafe_options: bool = False,
+ allow_unsafe_protocols: bool = False,
) -> "Submodule":
"""Add a new submodule to the given repository. This will alter the index
as well as the .gitmodules file, but will not create a new commit.
@@ -475,7 +492,16 @@ class Submodule(IndexObject, TraversableIterableObj):
kwargs["multi_options"] = clone_multi_options
# _clone_repo(cls, repo, url, path, name, **kwargs):
- mrepo = cls._clone_repo(repo, url, path, name, env=env, **kwargs)
+ mrepo = cls._clone_repo(
+ repo,
+ url,
+ path,
+ name,
+ env=env,
+ allow_unsafe_options=allow_unsafe_options,
+ allow_unsafe_protocols=allow_unsafe_protocols,
+ **kwargs,
+ )
# END verify url
## See #525 for ensuring git urls in config-files valid under Windows.
@@ -520,6 +546,8 @@ class Submodule(IndexObject, TraversableIterableObj):
keep_going: bool = False,
env: Union[Mapping[str, str], None] = None,
clone_multi_options: Union[Sequence[TBD], None] = None,
+ allow_unsafe_options: bool = False,
+ allow_unsafe_protocols: bool = False,
) -> "Submodule":
"""Update the repository of this submodule to point to the checkout
we point at with the binsha of this instance.
@@ -643,6 +671,8 @@ class Submodule(IndexObject, TraversableIterableObj):
n=True,
env=env,
multi_options=clone_multi_options,
+ allow_unsafe_options=allow_unsafe_options,
+ allow_unsafe_protocols=allow_unsafe_protocols,
)
# END handle dry-run
progress.update(