Use GitLab Runner and metrics to monitor deployed application for not commited code. Tools like hofund or expose metrics (f.e for prometheus) with git information about dirtiness of repository.
Example:
hofund_git_info{branch="master",build_host="DESKTOP-AAAAA",build_time="2023-02-19T11:22:34+0100",commit_id="0d32d0f",dirty="true",} 1.0
Based on this metric, you can create alerts informing that some application is running with changes that has not been authorized.
Create merge request templates which will introduce
controls (f.e. in form of checkboxes) to verify all important elements where meet. One of
this elements can be [ ] issue is connected to this MR
.
See also merge request commit templates as interesting feature to implement this control and create company-wide standard for commit messages.
Next element, that implements this control is commit message template for push rules which
requires from commit author to meet rules (f.e commit message must contain expression like issue#1234
)
Using tools like logchange to create
standard for creating CHANGELOG.md
encourage developers to link associated tasks with given change. GitLab also
provides tool to manage changelogs.
Implemented at:
src/controls/code_changes/approval_required.py
1.1.4 Ensure previous approvals are dismissed when updates are introduced to a code change proposal (Manual)
Implemented at:
src/controls/code_changes/approval_dismissed.py
I don't understand this rule or what should be checked to perform audit. Is it enough that main branch is protected, noone can push to it and Developers and Maintainers can merge?
Implemented at:
src/controls/code_changes/codeowners_file_exists.py
Implemented at:
src/controls/code_changes/codeowners_approval.py
Implemented at:
src/controls/code_changes/stale_branches.py
This rule also checks if Pipelines must succeed (only_allow_merge_if_pipeline_succeeds)
is enabled.
What about allow_merge_on_skipped_pipeline
? In some cases some BOTs use skipped pipelines to
perform some actions that would create recursive pipelines, and that's why skipped pipelines are useful.
Implemented at:
src/controls/code_changes/checks_have_passed_before_merging.py
This rule also checks if Enable merged results pipelines
and Enable merge trains
is enabled.
Implemented at:
src/controls/code_changes/branches_are_up_to_date.py
Implemented at:
src/controls/code_changes/open_comments_resolved_before_merge.py
GitLab uses Merge Request
instead of Pull Request
(wrong expression used in document)
Additionally, (besides Reject unsigned commits
), GitLab allows to check:
Reject unverified users
Reject inconsistent user name
Check whether the commit author is a GitLab user
Implemented at:
src/controls/code_changes/commit_user_verification.py
This rule should also check if Squash commits when merging
is Encourage
or Require
to keep
main branch clean.
Implemented at:
src/controls/code_changes/linear_history.py
Only available from Admin GUI.
1.1.15 Ensure pushing or merging of new code is restricted to specific individuals or teams (Manual)
This rule in this implementation checks following conditions:
- Pushing should be set to
No One
- Merging should be set to
Maintainers and Developers
Maybe in future this tool will allow to define custom values for these rules to adjust to various companies polices
Implemented at:
src/controls/code_changes/pushing_or_merging_restriction.py
Implemented at:
src/controls/code_changes/force_push_denied.py
Implemented at:
src/controls/code_changes/branch_deleteion_denied.py
Not implemented.
Only available from Admin GUI.
Implemented at:
src/controls/code_changes/default_branch_protected.py
Why this is only recommended for public repositories?
Implemented at:
src/controls/repository_management/security_file_available.py
Only available from Admin GUI.
Creating repositories inside group requires Maintainer or Developer role?
Why this control audit and remediation are about Sign-up restrictions
?
Number of owners and maintainers is below 10 (TODO configure in future)
GitLab allows to change ability to delete project only to administrators.
Implemented at:
src/controls/repository_management/repository_deletion_limited.py
Implemented at:
src/controls/repository_management/issue_deletion_limited.py
This implementation allows no forks.
Implemented at:
src/controls/repository_management/repository_forks.py
Only available from Admin GUI.
Implemented as suggest in docs 180 days (6 months), maybe allow to configure in future.
Implemented at:
src/controls/repository_management/inactive_repositories.py
Only available from Admin GUI.