GitLab
TMA-GITLAB-1.1.15
Ensure pushing or merging of new code is restricted to specific individuals or teams
说明
Ensure that only trusted users can push or merge new code to protected branches. Requiring that only trusted users may push or merge new changes reduces the risk of unverified code, especially malicious code, to a protected branch by reducing the number of trusted users who are capable of doing such.
检查方式
审计方法: Shell 命令
command -v glab >/dev/null 2>&1 || exit 1
glab auth status >/dev/null 2>&1 || exit 1
proj=$(glab repo view -F json 2>/dev/null) || exit 1
printf "%s" "$proj" | grep -q '"id":' && echo compliant || echo non-compliant- 预期输出
compliant
修复方式
修复方法: 操作指南或基础设施补丁
Prerequisites: You must have at least the Maintainer role in the group. For every code repository in use, allow only trusted and responsible users to push or merge new code by performing the following: 1. On the left sidebar, select Search or go to and find your project. 2. Select Settings > Repository. 3. Expand Protected branches. 4. Select Add protected branch. 5. From the Branch dropdown list, select the branch you want to protect. 6. From the Allowed to merge list, select a role that can merge into this branch. 7. From the Allowed to push and merge list, select a role that can push to this branch.
属性
- 操作系统
- 任意
- 标签
- devsecopsgitlab
- 参考
- CIS GitLab Benchmark v1.0.1 - 1.1.15 Ensure pushing or merging of new code is restricted to specific individuals or teams
检查本机
请在您有权审计的机器上运行此命令。扫描为只读操作。
tmaegis scan --target gitlab --level 2