This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/allura.git
commit 68b8d44c0361b6936173d497b626f905f83bcd18 Author: Dave Brondsema <[email protected]> AuthorDate: Mon May 11 13:42:09 2026 -0400 [#8603] validate URLs on clone tasks too (e.g. if task delayed from form usage, and DNS changes) --- Allura/allura/tasks/repo_tasks.py | 4 ++++ ForgeSVN/forgesvn/tests/test_tasks.py | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Allura/allura/tasks/repo_tasks.py b/Allura/allura/tasks/repo_tasks.py index e73a6d0b2..aa86ebc01 100644 --- a/Allura/allura/tasks/repo_tasks.py +++ b/Allura/allura/tasks/repo_tasks.py @@ -24,6 +24,8 @@ from allura.lib.decorators import task from allura.lib.repository import RepositoryApp +from allura.lib import validators as v + import git from git import SymbolicReference @@ -37,6 +39,8 @@ def init(**kwargs): def clone(cloned_from_path, cloned_from_name, cloned_from_url): from allura import model as M try: + v.NonPrivateUrl().to_python(cloned_from_url) + c.app.repo.init_as_clone( cloned_from_path, cloned_from_name, diff --git a/ForgeSVN/forgesvn/tests/test_tasks.py b/ForgeSVN/forgesvn/tests/test_tasks.py index 8df3e80d1..93e4827c2 100644 --- a/ForgeSVN/forgesvn/tests/test_tasks.py +++ b/ForgeSVN/forgesvn/tests/test_tasks.py @@ -59,12 +59,20 @@ def test_init(self): def test_clone(self): ns = M.Notification.query.find().count() - with mock.patch.object(c.app.repo, 'init_as_clone') as f: - repo_tasks.clone('foo', 'bar', 'baz') + with mock.patch.object(c.app.repo, 'init_as_clone', autospec=True) as f: + repo_tasks.clone('foo', 'bar', 'http://example.com/baz') M.main_orm_session.flush() - f.assert_called_with('foo', 'bar', 'baz') + f.assert_called_with('foo', 'bar', 'http://example.com/baz') assert ns + 1 == M.Notification.query.find().count() + def test_clone_internal(self): + ns = M.Notification.query.find().count() + with mock.patch.object(c.app.repo, 'init_as_clone', autospec=True) as f: + repo_tasks.clone('foo', 'bar', 'http://localhost/baz') + M.main_orm_session.flush() + f.assert_not_called() + assert M.MonQTask.query.get(task_name='allura.tasks.event_tasks.event', args='repo_clone_task_failed') + def test_refresh(self): with mock.patch.object(c.app.repo, 'refresh') as f: repo_tasks.refresh()
