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
c61e4166
Commit
c61e4166
authored
Jul 23, 2021
by
Siddharth Asthana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the offenses introduced by Style/RegexpLiteralMixedPreserve
Changelog: other EE: true
parent
d26b12d6
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
16 additions
and
27 deletions
+16
-27
.rubocop_manual_todo.yml
.rubocop_manual_todo.yml
+0
-11
ee/app/models/status_page/project_setting.rb
ee/app/models/status_page/project_setting.rb
+1
-1
ee/app/presenters/vulnerability_presenter.rb
ee/app/presenters/vulnerability_presenter.rb
+1
-1
ee/lib/api/geo_nodes.rb
ee/lib/api/geo_nodes.rb
+1
-1
ee/lib/gitlab/vulnerabilities/standard_vulnerability.rb
ee/lib/gitlab/vulnerabilities/standard_vulnerability.rb
+1
-1
lib/api/invitations.rb
lib/api/invitations.rb
+2
-2
lib/gitlab/ci/pipeline/expression/lexeme/pattern.rb
lib/gitlab/ci/pipeline/expression/lexeme/pattern.rb
+1
-1
lib/gitlab/metrics/requests_rack_middleware.rb
lib/gitlab/metrics/requests_rack_middleware.rb
+1
-1
lib/gitlab/metrics/subscribers/active_record.rb
lib/gitlab/metrics/subscribers/active_record.rb
+1
-1
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+5
-5
lib/gitlab/utils.rb
lib/gitlab/utils.rb
+1
-1
lib/product_analytics/tracker.rb
lib/product_analytics/tracker.rb
+1
-1
No files found.
.rubocop_manual_todo.yml
View file @
c61e4166
...
@@ -2600,17 +2600,6 @@ Gitlab/FeatureAvailableUsage:
...
@@ -2600,17 +2600,6 @@ Gitlab/FeatureAvailableUsage:
# WIP See https://gitlab.com/gitlab-org/gitlab/-/issues/327490
# WIP See https://gitlab.com/gitlab-org/gitlab/-/issues/327490
Style/RegexpLiteralMixedPreserve
:
Style/RegexpLiteralMixedPreserve
:
Exclude
:
Exclude
:
-
'
ee/app/models/status_page/project_setting.rb'
-
'
ee/app/presenters/vulnerability_presenter.rb'
-
'
ee/lib/api/geo_nodes.rb'
-
'
ee/lib/gitlab/vulnerabilities/standard_vulnerability.rb'
-
'
lib/api/invitations.rb'
-
'
lib/gitlab/ci/pipeline/expression/lexeme/pattern.rb'
-
'
lib/gitlab/metrics/requests_rack_middleware.rb'
-
'
lib/gitlab/metrics/subscribers/active_record.rb'
-
'
lib/gitlab/regex.rb'
-
'
lib/gitlab/utils.rb'
-
'
lib/product_analytics/tracker.rb'
-
'
qa/qa/page/project/settings/advanced.rb'
-
'
qa/qa/page/project/settings/advanced.rb'
-
'
qa/spec/service/docker_run/gitlab_runner_spec.rb'
-
'
qa/spec/service/docker_run/gitlab_runner_spec.rb'
-
'
rubocop/cop/gitlab/duplicate_spec_location.rb'
-
'
rubocop/cop/gitlab/duplicate_spec_location.rb'
...
...
ee/app/models/status_page/project_setting.rb
View file @
c61e4166
...
@@ -5,7 +5,7 @@ module StatusPage
...
@@ -5,7 +5,7 @@ module StatusPage
# AWS validations. See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/25863#note_295772553
# AWS validations. See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/25863#note_295772553
AWS_BUCKET_NAME_REGEXP
=
/\A[a-z0-9][a-z0-9\-.]*\z/
.
freeze
AWS_BUCKET_NAME_REGEXP
=
/\A[a-z0-9][a-z0-9\-.]*\z/
.
freeze
AWS_ACCESS_KEY_REGEXP
=
/\A[A-Z0-9]{20}\z/
.
freeze
AWS_ACCESS_KEY_REGEXP
=
/\A[A-Z0-9]{20}\z/
.
freeze
AWS_SECRET_KEY_REGEXP
=
/\A[A-Za-z0-9\/+=]{40}\z/
.
freeze
AWS_SECRET_KEY_REGEXP
=
%r{
\A
[A-Za-z0-9/+=]{40}
\z
}
.
freeze
self
.
table_name
=
'status_page_settings'
self
.
table_name
=
'status_page_settings'
...
...
ee/app/presenters/vulnerability_presenter.rb
View file @
c61e4166
...
@@ -71,7 +71,7 @@ class VulnerabilityPresenter < Gitlab::View::Presenter::Delegated
...
@@ -71,7 +71,7 @@ class VulnerabilityPresenter < Gitlab::View::Presenter::Delegated
def
path_with_line_number
(
path
)
def
path_with_line_number
(
path
)
return
unless
path
return
unless
path
path
=
path
.
gsub
(
/^\//
,
''
)
path
=
path
.
gsub
(
%r{^/}
,
''
)
add_line_numbers
(
path
,
finding
.
location
[
'start_line'
],
finding
.
location
[
'end_line'
])
add_line_numbers
(
path
,
finding
.
location
[
'start_line'
],
finding
.
location
[
'end_line'
])
end
end
...
...
ee/lib/api/geo_nodes.rb
View file @
c61e4166
...
@@ -25,7 +25,7 @@ module API
...
@@ -25,7 +25,7 @@ module API
end
end
def
update_geo_nodes_endpoint?
def
update_geo_nodes_endpoint?
request
.
put?
&&
request
.
path
.
match?
(
/\/geo_nodes\/\d+/
)
request
.
put?
&&
request
.
path
.
match?
(
%r{/geo_nodes/
\d
+}
)
end
end
end
end
...
...
ee/lib/gitlab/vulnerabilities/standard_vulnerability.rb
View file @
c61e4166
...
@@ -31,7 +31,7 @@ module Gitlab
...
@@ -31,7 +31,7 @@ module Gitlab
path
=
@data
[
:blob_path
]
||
@data
.
dig
(
:location
,
:blob_path
)
path
=
@data
[
:blob_path
]
||
@data
.
dig
(
:location
,
:blob_path
)
return
unless
path
return
unless
path
path
.
gsub
(
/^\//
,
''
)
path
.
gsub
(
%r{^/}
,
''
)
end
end
def
location_link
def
location_link
...
...
lib/api/invitations.rb
View file @
c61e4166
...
@@ -59,7 +59,7 @@ module API
...
@@ -59,7 +59,7 @@ module API
optional
:access_level
,
type:
Integer
,
values:
Gitlab
::
Access
.
all_values
,
desc:
'A valid access level (defaults: `30`, developer access level)'
optional
:access_level
,
type:
Integer
,
values:
Gitlab
::
Access
.
all_values
,
desc:
'A valid access level (defaults: `30`, developer access level)'
optional
:expires_at
,
type:
DateTime
,
desc:
'Date string in ISO 8601 format (`YYYY-MM-DDTHH:MM:SSZ`)'
optional
:expires_at
,
type:
DateTime
,
desc:
'Date string in ISO 8601 format (`YYYY-MM-DDTHH:MM:SSZ`)'
end
end
put
":id/invitations/:email"
,
requirements:
{
email:
/[^\/]+/
}
do
put
":id/invitations/:email"
,
requirements:
{
email:
%r{[^/]+}
}
do
source
=
find_source
(
source_type
,
params
.
delete
(
:id
))
source
=
find_source
(
source_type
,
params
.
delete
(
:id
))
invite_email
=
params
[
:email
]
invite_email
=
params
[
:email
]
authorize_admin_source!
(
source_type
,
source
)
authorize_admin_source!
(
source_type
,
source
)
...
@@ -88,7 +88,7 @@ module API
...
@@ -88,7 +88,7 @@ module API
params
do
params
do
requires
:email
,
type:
String
,
desc:
'The email address of the invitation'
requires
:email
,
type:
String
,
desc:
'The email address of the invitation'
end
end
delete
":id/invitations/:email"
,
requirements:
{
email:
/[^\/]+/
}
do
delete
":id/invitations/:email"
,
requirements:
{
email:
%r{[^/]+}
}
do
source
=
find_source
(
source_type
,
params
[
:id
])
source
=
find_source
(
source_type
,
params
[
:id
])
invite_email
=
params
[
:email
]
invite_email
=
params
[
:email
]
authorize_admin_source!
(
source_type
,
source
)
authorize_admin_source!
(
source_type
,
source
)
...
...
lib/gitlab/ci/pipeline/expression/lexeme/pattern.rb
View file @
c61e4166
...
@@ -11,7 +11,7 @@ module Gitlab
...
@@ -11,7 +11,7 @@ module Gitlab
PATTERN
=
%r{^
\/
([^
\/
]|
\\
/)+[^
\\
]
\/
[ismU]*}
.
freeze
PATTERN
=
%r{^
\/
([^
\/
]|
\\
/)+[^
\\
]
\/
[ismU]*}
.
freeze
def
initialize
(
regexp
)
def
initialize
(
regexp
)
super
(
regexp
.
gsub
(
/\\\//
,
'/'
))
super
(
regexp
.
gsub
(
%r{
\\
/}
,
'/'
))
unless
Gitlab
::
UntrustedRegexp
::
RubySyntax
.
valid?
(
@value
)
unless
Gitlab
::
UntrustedRegexp
::
RubySyntax
.
valid?
(
@value
)
raise
Lexer
::
SyntaxError
,
'Invalid regular expression!'
raise
Lexer
::
SyntaxError
,
'Invalid regular expression!'
...
...
lib/gitlab/metrics/requests_rack_middleware.rb
View file @
c61e4166
...
@@ -13,7 +13,7 @@ module Gitlab
...
@@ -13,7 +13,7 @@ module Gitlab
"put"
=>
%w(200 202 204 400 401 403 404 405 406 409 410 422 500)
"put"
=>
%w(200 202 204 400 401 403 404 405 406 409 410 422 500)
}.
freeze
}.
freeze
HEALTH_ENDPOINT
=
/^\/-\/(liveness|readiness|health|metrics)\/?$/
.
freeze
HEALTH_ENDPOINT
=
%r{^/-/(liveness|readiness|health|metrics)/?$}
.
freeze
FEATURE_CATEGORY_DEFAULT
=
'unknown'
FEATURE_CATEGORY_DEFAULT
=
'unknown'
...
...
lib/gitlab/metrics/subscribers/active_record.rb
View file @
c61e4166
...
@@ -9,7 +9,7 @@ module Gitlab
...
@@ -9,7 +9,7 @@ module Gitlab
IGNORABLE_SQL
=
%w{BEGIN COMMIT}
.
freeze
IGNORABLE_SQL
=
%w{BEGIN COMMIT}
.
freeze
DB_COUNTERS
=
%i{db_count db_write_count db_cached_count}
.
freeze
DB_COUNTERS
=
%i{db_count db_write_count db_cached_count}
.
freeze
SQL_COMMANDS_WITH_COMMENTS_REGEX
=
/\A(\/\*.*\*\/\s)?((?!(.*[^\w'"](DELETE|UPDATE|INSERT INTO)[^\w'"])))(WITH.*)?(SELECT)((?!(FOR UPDATE|FOR SHARE)).)*$/
i
.
freeze
SQL_COMMANDS_WITH_COMMENTS_REGEX
=
%r{
\A
(/
\*
.*
\*
/
\s
)?((?!(.*[^
\w
'"](DELETE|UPDATE|INSERT INTO)[^
\w
'"])))(WITH.*)?(SELECT)((?!(FOR UPDATE|FOR SHARE)).)*$}
i
.
freeze
SQL_DURATION_BUCKET
=
[
0.05
,
0.1
,
0.25
].
freeze
SQL_DURATION_BUCKET
=
[
0.05
,
0.1
,
0.25
].
freeze
TRANSACTION_DURATION_BUCKET
=
[
0.1
,
0.25
,
1
].
freeze
TRANSACTION_DURATION_BUCKET
=
[
0.1
,
0.25
,
1
].
freeze
...
...
lib/gitlab/regex.rb
View file @
c61e4166
...
@@ -184,19 +184,19 @@ module Gitlab
...
@@ -184,19 +184,19 @@ module Gitlab
# - Must not have a scheme, such as http:// or https://
# - Must not have a scheme, such as http:// or https://
# - Must not have a port number, such as :8080 or :8443
# - Must not have a port number, such as :8080 or :8443
@go_package_regex
||=
/
@go_package_regex
||=
%r{
\b
(?# word boundary)
\b
(?# word boundary)
(?<domain>
(?<domain>
[0-9a-z](?:(?:-|[0-9a-z]){0,61}[0-9a-z])? (?# first domain)
[0-9a-z](?:(?:-|[0-9a-z]){0,61}[0-9a-z])? (?# first domain)
(?:
\.
[0-9a-z](?:(?:-|[0-9a-z]){0,61}[0-9a-z])?)* (?# inner domains)
(?:
\.
[0-9a-z](?:(?:-|[0-9a-z]){0,61}[0-9a-z])?)* (?# inner domains)
\.
[a-z]{2,} (?# top-level domain)
\.
[a-z]{2,} (?# top-level domain)
)
)
(?<path>
\
/(?:
(?<path>/(?:
[-
\
/$_.+!*'(),0-9a-z] (?# plain URL character)
[-/$_.+!*'(),0-9a-z] (?# plain URL character)
| %[0-9a-f]{2})* (?# URL encoded character)
| %[0-9a-f]{2})* (?# URL encoded character)
)? (?# path)
)? (?# path)
\b
(?# word boundary)
\b
(?# word boundary)
/
ix
.
freeze
}
ix
.
freeze
end
end
def
generic_package_version_regex
def
generic_package_version_regex
...
@@ -416,7 +416,7 @@ module Gitlab
...
@@ -416,7 +416,7 @@ module Gitlab
end
end
def
base64_regex
def
base64_regex
@base64_regex
||=
/(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?/
.
freeze
@base64_regex
||=
%r{(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?}
.
freeze
end
end
def
feature_flag_regex
def
feature_flag_regex
...
...
lib/gitlab/utils.rb
View file @
c61e4166
...
@@ -13,7 +13,7 @@ module Gitlab
...
@@ -13,7 +13,7 @@ module Gitlab
return
unless
path
.
is_a?
(
String
)
return
unless
path
.
is_a?
(
String
)
path
=
decode_path
(
path
)
path
=
decode_path
(
path
)
path_regex
=
/(\A(\.{1,2})\z|\A\.\.[\/\\]|[\/\\]\.\.\z|[\/\\]\.\.[\/\\]|\n)/
path_regex
=
%r{(
\A
(
\.
{1,2})
\z
|
\A\.\.
[/
\\
]|[/
\\
]
\.\.\z
|[/
\\
]
\.\.
[/
\\
]|
\n
)}
if
path
.
match?
(
path_regex
)
if
path
.
match?
(
path_regex
)
raise
PathTraversalAttackError
,
'Invalid path'
raise
PathTraversalAttackError
,
'Invalid path'
...
...
lib/product_analytics/tracker.rb
View file @
c61e4166
...
@@ -6,6 +6,6 @@ module ProductAnalytics
...
@@ -6,6 +6,6 @@ module ProductAnalytics
URL
=
Gitlab
.
config
.
gitlab
.
url
+
'/-/sp.js'
URL
=
Gitlab
.
config
.
gitlab
.
url
+
'/-/sp.js'
# The collector URL minus protocol and /i
# The collector URL minus protocol and /i
COLLECTOR_URL
=
Gitlab
.
config
.
gitlab
.
url
.
sub
(
/\Ahttps?\:\/\//
,
''
)
+
'/-/collector'
COLLECTOR_URL
=
Gitlab
.
config
.
gitlab
.
url
.
sub
(
%r{
\A
https?
\:
//}
,
''
)
+
'/-/collector'
end
end
end
end
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