TMAegisBeta
Thêm quy tắc cho gitlab

GitLab

TMA-GITLAB-1.1.17

Ensure branch deletions are denied

Trung bìnhCấp 1Tự độnggitlab

Mô tả

Ensure that users with only push access are incapable of deleting a protected branch. When enabling deletion of a protected branch, any user with at least push access to the repository can delete a branch. This can be potentially dangerous, as a simple human mistake or a hacked account can lead to data loss if a branch is deleted. It is therefore crucial to prevent such incidents by denying protected branch deletion.

Cách kiểm tra

Phương pháp kiểm tra: Lệnh shell

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
Đầu ra mong đợi
compliant

Cách khắc phục

Phương pháp khắc phục: Hướng dẫn hoặc bản vá hạ tầng

For each repository that is being used, protect a branch in order to block the option to delete branches. To protect a branch for one project: 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. Group owners can create protected branches at the group level. These settings are inherited by all projects in the group and can’t be overridden by project settings. If a specific branch is configured with Allowed to force push settings at both the group and project levels, the Allowed to force push setting at the project level is ignored in favor of the group level setting. Prerequisites: - You must have the Owner role in the group. To protect a branch for all the projects in a group: 1. On the left sidebar, select Search or go to and find your group. 2. Select Settings > Repository. 3. Expand Protected branches. 4. Select Add protected...

Thuộc tính

Hệ điều hành
Bất kỳ
Thẻ
branch-protectiondevsecopsgitlab
Tham chiếu
CIS GitLab Benchmark v1.0.1 - 1.1.17 Ensure branch deletions are denied

Kiểm tra máy này

Chạy lệnh này trên máy bạn được phép kiểm tra. Lần quét chỉ ở chế độ đọc.

shell
tmaegis scan --target gitlab