Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f818d961
Commit
f818d961
authored
Jun 03, 2020
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename internal method to denylist
parent
08c606d5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
ee/app/models/push_rule.rb
ee/app/models/push_rule.rb
+1
-1
ee/lib/ee/gitlab/checks/diff_check.rb
ee/lib/ee/gitlab/checks/diff_check.rb
+1
-1
ee/spec/models/push_rule_spec.rb
ee/spec/models/push_rule_spec.rb
+1
-1
No files found.
ee/app/models/push_rule.rb
View file @
f818d961
...
@@ -78,7 +78,7 @@ class PushRule < ApplicationRecord
...
@@ -78,7 +78,7 @@ class PushRule < ApplicationRecord
data_match?
(
email
,
author_email_regex
)
data_match?
(
email
,
author_email_regex
)
end
end
def
filename_
black
listed?
(
file_path
)
def
filename_
deny
listed?
(
file_path
)
regex_list
=
[]
regex_list
=
[]
regex_list
.
concat
(
FILES_DENYLIST
)
if
prevent_secrets
regex_list
.
concat
(
FILES_DENYLIST
)
if
prevent_secrets
regex_list
<<
file_name_regex
if
file_name_regex
regex_list
<<
file_name_regex
if
file_name_regex
...
...
ee/lib/ee/gitlab/checks/diff_check.rb
View file @
f818d961
...
@@ -82,7 +82,7 @@ module EE
...
@@ -82,7 +82,7 @@ module EE
def
file_name_validation
def
file_name_validation
lambda
do
|
diff
|
lambda
do
|
diff
|
if
(
diff
.
renamed_file
||
diff
.
new_file
)
&&
blacklisted_regex
=
push_rule
.
filename_
black
listed?
(
diff
.
new_path
)
if
(
diff
.
renamed_file
||
diff
.
new_file
)
&&
blacklisted_regex
=
push_rule
.
filename_
deny
listed?
(
diff
.
new_path
)
return
unless
blacklisted_regex
.
present?
return
unless
blacklisted_regex
.
present?
"File name
#{
diff
.
new_path
}
was blacklisted by the pattern
#{
blacklisted_regex
}
."
"File name
#{
diff
.
new_path
}
was blacklisted by the pattern
#{
blacklisted_regex
}
."
...
...
ee/spec/models/push_rule_spec.rb
View file @
f818d961
...
@@ -132,7 +132,7 @@ describe PushRule do
...
@@ -132,7 +132,7 @@ describe PushRule do
commit_message_blocked?: :commit_message_negative_regex
,
commit_message_blocked?: :commit_message_negative_regex
,
branch_name_allowed?: :branch_name_regex
,
branch_name_allowed?: :branch_name_regex
,
author_email_allowed?: :author_email_regex
,
author_email_allowed?: :author_email_regex
,
filename_
black
listed?: :file_name_regex
filename_
deny
listed?: :file_name_regex
}
}
methods_and_regexes
.
each
do
|
method_name
,
regex_attr
|
methods_and_regexes
.
each
do
|
method_name
,
regex_attr
|
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment