diff options
author | 无闻 <u@gogs.io> | 2015-02-17 23:09:53 -0500 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2015-02-17 23:09:53 -0500 |
commit | 58e28e5d9d0754305179be76aec06e2ae796d915 (patch) | |
tree | a16185c28567718c97de6174bd075a28fe8bb1e2 | |
parent | cd6a2b78a752605d808c6392ce78b92d4759fede (diff) | |
parent | f9454cc32c94780eb4c49753fc0ccd9b60b1deb7 (diff) | |
download | gitea-58e28e5d9d0754305179be76aec06e2ae796d915.tar.gz gitea-58e28e5d9d0754305179be76aec06e2ae796d915.zip |
Merge pull request #958 from phsmit/fix_mirror_access
Make sure that a mirror can't be written to by http or ssh
-rw-r--r-- | cmd/serve.go | 5 | ||||
-rw-r--r-- | routers/repo/http.go | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/cmd/serve.go b/cmd/serve.go index e8e5c186c7..9e34b95c5a 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -164,6 +164,11 @@ func runServ(c *cli.Context) { println("You have no right to write this repository") log.GitLogger.Fatal(2, "User %s has no right to write repository %s", user.Name, repoPath) } + + if repo.IsMirror { + println("You can't write to a mirror repository") + log.GitLogger.Fatal(2, "User %s tried to write to a mirror repository %s", user.Name, repoPath) + } case isRead: if !repo.IsPrivate { break diff --git a/routers/repo/http.go b/routers/repo/http.go index 034b5a7b5e..d47d73ef05 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -158,6 +158,11 @@ func Http(ctx *middleware.Context) { return } } + + if !isPull && repo.IsMirror { + ctx.Handle(401, "can't push to mirror", nil) + return + } } } |