summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2011-10-24 08:20:35 -0400
committerJames Moger <james.moger@gitblit.com>2011-10-24 08:20:35 -0400
commitd40adc7553bc900328afa918f45b6d9e9c3087fb (patch)
tree28fc559fc9403f79d974687e89ae7a935a94c06d /tests
parentfe326255202dcfac8b0991ca9d28e3cf4bcc4fe6 (diff)
downloadgitblit-d40adc7553bc900328afa918f45b6d9e9c3087fb.tar.gz
gitblit-d40adc7553bc900328afa918f45b6d9e9c3087fb.zip
Fixed security hole when cloning repository with TortoiseGit (issue 28)
Diffstat (limited to 'tests')
-rw-r--r--tests/com/gitblit/tests/GitServletTest.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/com/gitblit/tests/GitServletTest.java b/tests/com/gitblit/tests/GitServletTest.java
index 0ede7cab..6a839742 100644
--- a/tests/com/gitblit/tests/GitServletTest.java
+++ b/tests/com/gitblit/tests/GitServletTest.java
@@ -12,6 +12,7 @@ import junit.framework.TestCase;
import org.eclipse.jgit.api.CloneCommand;
import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
import org.eclipse.jgit.util.FileUtils;
import com.gitblit.GitBlitServer;
@@ -50,7 +51,9 @@ public class GitServletTest extends TestCase {
}
public void testClone() throws Exception {
- FileUtils.delete(folder, FileUtils.RECURSIVE);
+ if (folder.exists()) {
+ FileUtils.delete(folder, FileUtils.RECURSIVE);
+ }
CloneCommand clone = Git.cloneRepository();
clone.setURI(MessageFormat.format("http://localhost:{0,number,#}/git/ticgit.git", port));
clone.setDirectory(folder);
@@ -71,4 +74,18 @@ public class GitServletTest extends TestCase {
git.push().setPushAll().call();
git.getRepository().close();
}
+
+ public void testBogusLoginClone() throws Exception {
+ File folder = new File(GitBlitSuite.REPOSITORIES, "working/gitblit");
+ if (folder.exists()) {
+ FileUtils.delete(folder, FileUtils.RECURSIVE);
+ }
+ CloneCommand clone = Git.cloneRepository();
+ clone.setURI(MessageFormat.format("http://localhost:{0,number,#}/git/gitblit.git", port));
+ clone.setDirectory(folder);
+ clone.setBare(false);
+ clone.setCloneAllBranches(true);
+ clone.setCredentialsProvider(new UsernamePasswordCredentialsProvider("bogus", "bogus"));
+ clone.call();
+ }
}