mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 08:02:36 +09:00 
			
		
		
		
	Make sure that a mirror can't be written to by http or ssh
This commit is contained in:
		@@ -164,6 +164,11 @@ func runServ(c *cli.Context) {
 | 
				
			|||||||
			println("You have no right to write this repository")
 | 
								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)
 | 
								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:
 | 
						case isRead:
 | 
				
			||||||
		if !repo.IsPrivate {
 | 
							if !repo.IsPrivate {
 | 
				
			||||||
			break
 | 
								break
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -158,6 +158,11 @@ func Http(ctx *middleware.Context) {
 | 
				
			|||||||
					return
 | 
										return
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if !isPull && repo.IsMirror {
 | 
				
			||||||
 | 
									ctx.Handle(401, "can't push to mirror", nil)
 | 
				
			||||||
 | 
									return
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user