Skip to content
Snippets Groups Projects

Only enumerate commits in pre-receive check if push came from Web

Merged Joe Woodward requested to merge backport/17-1-sh-bypass-commit-checks-fix into 17-1-stable-ee
2 files
+ 35
4
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -8,6 +8,7 @@ class CommitsCheck < ::Gitlab::Checks::BaseSingleChecker
def validate!
return if deletion?
return unless should_run_validations?
logger.log_timed(LOG_MESSAGE) do
commits.each do |commit|
@@ -18,6 +19,13 @@ def validate!
private
def should_run_validations?
# Enumerating commits can be expensive if there are large number
# of commits, and we only care about performing this check if the
# changes were made via the UI.
updated_from_web?
end
def check_signed_commit_authorship!(commit)
return unless signed_by_gitlab?(commit)
Loading