Commit b7a55159 authored by Ethan Urie's avatar Ethan Urie

Merge branch 'kenneth-clarify-push-rules-committer-email' into 'master'

Specify that the committer email is checked

See merge request gitlab-org/gitlab!83675
parents e4080de6 0ca0adea
......@@ -2564,7 +2564,7 @@ POST /projects/:id/push_rule
| `id` | integer or string | **{check-circle}** Yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding). |
| `author_email_regex` | string | **{dotted-circle}** No | All commit author emails must match this, for example `@my-company.com$`. |
| `branch_name_regex` | string | **{dotted-circle}** No | All branch names must match this, for example `(feature|hotfix)\/*`. |
| `commit_committer_check` | boolean | **{dotted-circle}** No | Users can only push commits to this repository that were committed with one of their own verified emails. |
| `commit_committer_check` | boolean | **{dotted-circle}** No | Users can only push commits to this repository if the committer email is one of their own verified emails. |
| `commit_message_negative_regex` | string | **{dotted-circle}** No | No commit message is allowed to match this, for example `ssh\:\/\/`. |
| `commit_message_regex` | string | **{dotted-circle}** No | All commit messages must match this, for example `Fixed \d+\..*`. |
| `deny_delete_tag` | boolean | **{dotted-circle}** No | Deny deleting a tag. |
......@@ -2587,7 +2587,7 @@ PUT /projects/:id/push_rule
| `id` | integer or string | **{check-circle}** Yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding). |
| `author_email_regex` | string | **{dotted-circle}** No | All commit author emails must match this, for example `@my-company.com$`. |
| `branch_name_regex` | string | **{dotted-circle}** No | All branch names must match this, for example `(feature|hotfix)\/*`. |
| `commit_committer_check` | boolean | **{dotted-circle}** No | Users can only push commits to this repository that were committed with one of their own verified emails. |
| `commit_committer_check` | boolean | **{dotted-circle}** No | Users can only push commits to this repository if the committer email is one of their own verified emails. |
| `commit_message_negative_regex` | string | **{dotted-circle}** No | No commit message is allowed to match this, for example `ssh\:\/\/`. |
| `commit_message_regex` | string | **{dotted-circle}** No | All commit messages must match this, for example `Fixed \d+\..*`. |
| `deny_delete_tag` | boolean | **{dotted-circle}** No | Deny deleting a tag. |
......
......@@ -13,7 +13,7 @@ module PushRulesHelper
def commit_committer_check_description(push_rule)
message = s_("ProjectSettings|Users can only push commits to this repository "\
"that were committed with one of their own verified emails.")
"if the committer email is one of their own verified emails.")
push_rule_update_description(message, push_rule, :commit_committer_check)
end
......
......@@ -7,7 +7,7 @@ module EE
class CommitCheck < ::Gitlab::Checks::BaseSingleChecker
ERROR_MESSAGES = {
committer_not_verified: "Committer email '%{committer_email}' is not verified.",
committer_not_allowed: "You cannot push commits for '%{committer_email}'. You can only push commits that were committed with one of your own verified emails."
committer_not_allowed: "You cannot push commits for '%{committer_email}'. You can only push commits if the committer email is one of your own verified emails."
}.freeze
LOG_MESSAGE = "Checking if commits follow defined push rules..."
......
......@@ -9,7 +9,7 @@ RSpec.describe PushRulesHelper do
let(:project_owner) { push_rule.project.first_owner }
let(:possible_help_texts) do
{
commit_committer_check_base_help: /Users can only push commits to this repository that were committed with one of their own verified emails/,
commit_committer_check_base_help: /Users can only push commits to this repository if the committer email is one of their own verified emails/,
reject_unsigned_commits_base_help: /Only signed commits can be pushed to this repository/,
default_admin_help: /This setting will be applied to all projects unless overridden by an admin/,
setting_can_be_overridden: /This setting is applied on the server level and can be overridden by an admin/,
......
......@@ -191,7 +191,7 @@ RSpec.describe EE::Gitlab::Checks::PushRules::CommitCheck do
expect { subject.validate! }
.to raise_error(Gitlab::GitAccess::ForbiddenError,
"You cannot push commits for '#{user_email}'. You can only push commits that were committed with one of your own verified emails.")
"You cannot push commits for '#{user_email}'. You can only push commits if the committer email is one of your own verified emails.")
end
end
......@@ -225,7 +225,7 @@ RSpec.describe EE::Gitlab::Checks::PushRules::CommitCheck do
expect { subject.validate! }
.to raise_error(Gitlab::GitAccess::ForbiddenError,
"You cannot push commits for 'some@mail.com'. You can only push commits that were committed with one of your own verified emails.")
"You cannot push commits for 'some@mail.com'. You can only push commits if the committer email is one of your own verified emails.")
end
end
end
......
......@@ -29698,7 +29698,7 @@ msgstr ""
msgid "ProjectSettings|Users can copy the repository to a new project."
msgstr ""
msgid "ProjectSettings|Users can only push commits to this repository that were committed with one of their own verified emails."
msgid "ProjectSettings|Users can only push commits to this repository if the committer email is one of their own verified emails."
msgstr ""
msgid "ProjectSettings|Users can request access"
......
......@@ -138,7 +138,7 @@ module QA
it 'rejects unverified emails', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347791' do
expect_no_error_on_push(file: standard_file)
expect_error_on_push(file: standard_file, user: @root,
error: 'You can only push commits that were committed with one of your own verified emails')
error: 'You can only push commits if the committer email is one of your own verified emails')
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment