Gerrit集成Gitweb没有查看权限问题
-
情景复现
-
gerrit集成gitweb后,系统管理员有权限进去gitweb,其他成员进去都是not found。
-
问题分析
-
除了管理员之外,其他权限组成员都无法查看gitweb的信息。尝试给小组成员分配各个属性,包括可以查看数据库database的权限,问题依旧。
-
看来查看gitweb的权限与数据库访问并没有关系;翻墙出去在谷歌官网FAQ查找到了这么一段话:『This is due to a change on the level of security applied by GitServlet: now the GitWeb makes sure that the user has full access to ALL branches (refs/meta/config included) otherwise it returns a 404。
The problem is: repo owner and gerrit administrator has implicit access to refs/meta/config … and thus an extra bit is need on the if() checking permissions.』。 - 看来gitweb的权限需要具备ref/*节点下面的read权限,『Make read access to refs/meta/config by default exclusive to project owners 』这个设定做在了All-Projects的ACL设定里,所以缺省被所有的Project继承。
-
解决方案
-
在单独项目的ACL里为项目的用户组增加了对refs/meta/config的read权限。用户可以正常显示gitweb页面。
-
不良影响
-
原来gerrit是用git做自身的ACL管理的,因此所有对refs/meta/config有read权限的用户都可以在Project的Access页面里修改权限,修改后虽然不能直接submit,
但是可以作为patch提交review。而且通过gitweb就能够看到project.config和groups文件的全部内容,知道当前项目是如何设置权限的。 -
这样是否合适就仁者见仁智者见智了。另外,对于用户提交的关于权限修改的patch如果想commit的话需要对refs/meta/config做和refs/heads/*一样的权限设定,
也就说需要Label Code-Review,Label Verified,Submit三个权限才有可能commit patch。