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
abee680a
Commit
abee680a
authored
May 20, 2021
by
David Fernandez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the check_maven_path_first feature flag
Update the related specs Changelog: other
parent
15448f95
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
266 additions
and
378 deletions
+266
-378
config/feature_flags/development/check_maven_path_first.yml
config/feature_flags/development/check_maven_path_first.yml
+0
-8
lib/api/maven_packages.rb
lib/api/maven_packages.rb
+0
-2
spec/requests/api/maven_packages_spec.rb
spec/requests/api/maven_packages_spec.rb
+266
-368
No files found.
config/feature_flags/development/check_maven_path_first.yml
deleted
100644 → 0
View file @
15448f95
---
name
:
check_maven_path_first
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59241
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/327487
milestone
:
'
13.11'
type
:
development
group
:
group::package
default_enabled
:
true
lib/api/maven_packages.rb
View file @
abee680a
...
@@ -24,8 +24,6 @@ module API
...
@@ -24,8 +24,6 @@ module API
helpers
do
helpers
do
def
path_exists?
(
path
)
def
path_exists?
(
path
)
# return true when FF disabled so that processing the request is not stopped
return
true
unless
Feature
.
enabled?
(
:check_maven_path_first
,
default_enabled: :yaml
)
return
false
if
path
.
blank?
return
false
if
path
.
blank?
Packages
::
Maven
::
Metadatum
.
with_path
(
path
)
Packages
::
Maven
::
Metadatum
.
with_path
(
path
)
...
...
spec/requests/api/maven_packages_spec.rb
View file @
abee680a
...
@@ -48,13 +48,9 @@ RSpec.describe API::MavenPackages do
...
@@ -48,13 +48,9 @@ RSpec.describe API::MavenPackages do
end
end
shared_examples
'rejecting the request for non existing maven path'
do
|
expected_status: :not_found
|
shared_examples
'rejecting the request for non existing maven path'
do
|
expected_status: :not_found
|
before
do
it
'rejects the request'
do
if
Feature
.
enabled?
(
:check_maven_path_first
,
default_enabled: :yaml
)
expect
(
::
Packages
::
Maven
::
PackageFinder
).
not_to
receive
(
:new
)
expect
(
::
Packages
::
Maven
::
PackageFinder
).
not_to
receive
(
:new
)
end
end
it
'rejects the request'
do
subject
subject
expect
(
response
).
to
have_gitlab_http_status
(
expected_status
)
expect
(
response
).
to
have_gitlab_http_status
(
expected_status
)
...
@@ -166,7 +162,6 @@ RSpec.describe API::MavenPackages do
...
@@ -166,7 +162,6 @@ RSpec.describe API::MavenPackages do
end
end
describe
'GET /api/v4/packages/maven/*path/:file_name'
do
describe
'GET /api/v4/packages/maven/*path/:file_name'
do
shared_examples
'handling all conditions'
do
context
'a public project'
do
context
'a public project'
do
subject
{
download_file
(
file_name:
package_file
.
file_name
)
}
subject
{
download_file
(
file_name:
package_file
.
file_name
)
}
...
@@ -297,23 +292,6 @@ RSpec.describe API::MavenPackages do
...
@@ -297,23 +292,6 @@ RSpec.describe API::MavenPackages do
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
end
end
end
context
'with check_maven_path_first enabled'
do
before
do
stub_feature_flags
(
check_maven_path_first:
true
)
end
it_behaves_like
'handling all conditions'
end
context
'with check_maven_path_first disabled'
do
before
do
stub_feature_flags
(
check_maven_path_first:
false
)
end
it_behaves_like
'handling all conditions'
end
def
download_file
(
file_name
:,
params:
{},
request_headers:
headers
,
path:
maven_metadatum
.
path
)
def
download_file
(
file_name
:,
params:
{},
request_headers:
headers
,
path:
maven_metadatum
.
path
)
get
api
(
"/packages/maven/
#{
path
}
/
#{
file_name
}
"
),
params:
params
,
headers:
request_headers
get
api
(
"/packages/maven/
#{
path
}
/
#{
file_name
}
"
),
params:
params
,
headers:
request_headers
...
@@ -329,22 +307,6 @@ RSpec.describe API::MavenPackages do
...
@@ -329,22 +307,6 @@ RSpec.describe API::MavenPackages do
let
(
:url
)
{
"/packages/maven/
#{
path
}
/
#{
package_file
.
file_name
}
"
}
let
(
:url
)
{
"/packages/maven/
#{
path
}
/
#{
package_file
.
file_name
}
"
}
it_behaves_like
'processing HEAD requests'
,
instance_level:
true
it_behaves_like
'processing HEAD requests'
,
instance_level:
true
context
'with check_maven_path_first enabled'
do
before
do
stub_feature_flags
(
check_maven_path_first:
true
)
end
it_behaves_like
'processing HEAD requests'
,
instance_level:
true
end
context
'with check_maven_path_first disabled'
do
before
do
stub_feature_flags
(
check_maven_path_first:
false
)
end
it_behaves_like
'processing HEAD requests'
,
instance_level:
true
end
end
end
describe
'GET /api/v4/groups/:id/-/packages/maven/*path/:file_name'
do
describe
'GET /api/v4/groups/:id/-/packages/maven/*path/:file_name'
do
...
@@ -353,7 +315,6 @@ RSpec.describe API::MavenPackages do
...
@@ -353,7 +315,6 @@ RSpec.describe API::MavenPackages do
group
.
add_developer
(
user
)
group
.
add_developer
(
user
)
end
end
shared_examples
'handling all conditions'
do
context
'a public project'
do
context
'a public project'
do
subject
{
download_file
(
file_name:
package_file
.
file_name
)
}
subject
{
download_file
(
file_name:
package_file
.
file_name
)
}
...
@@ -559,23 +520,6 @@ RSpec.describe API::MavenPackages do
...
@@ -559,23 +520,6 @@ RSpec.describe API::MavenPackages do
end
end
end
end
end
end
end
context
'with check_maven_path_first enabled'
do
before
do
stub_feature_flags
(
check_maven_path_first:
true
)
end
it_behaves_like
'handling all conditions'
end
context
'with check_maven_path_first disabled'
do
before
do
stub_feature_flags
(
check_maven_path_first:
false
)
end
it_behaves_like
'handling all conditions'
end
def
download_file
(
file_name
:,
params:
{},
request_headers:
headers
,
path:
maven_metadatum
.
path
,
group_id:
group
.
id
)
def
download_file
(
file_name
:,
params:
{},
request_headers:
headers
,
path:
maven_metadatum
.
path
,
group_id:
group
.
id
)
get
api
(
"/groups/
#{
group_id
}
/-/packages/maven/
#{
path
}
/
#{
file_name
}
"
),
params:
params
,
headers:
request_headers
get
api
(
"/groups/
#{
group_id
}
/-/packages/maven/
#{
path
}
/
#{
file_name
}
"
),
params:
params
,
headers:
request_headers
...
@@ -590,25 +534,10 @@ RSpec.describe API::MavenPackages do
...
@@ -590,25 +534,10 @@ RSpec.describe API::MavenPackages do
let
(
:path
)
{
package
.
maven_metadatum
.
path
}
let
(
:path
)
{
package
.
maven_metadatum
.
path
}
let
(
:url
)
{
"/groups/
#{
group
.
id
}
/-/packages/maven/
#{
path
}
/
#{
package_file
.
file_name
}
"
}
let
(
:url
)
{
"/groups/
#{
group
.
id
}
/-/packages/maven/
#{
path
}
/
#{
package_file
.
file_name
}
"
}
context
'with check_maven_path_first enabled'
do
before
do
stub_feature_flags
(
check_maven_path_first:
true
)
end
it_behaves_like
'processing HEAD requests'
end
context
'with check_maven_path_first disabled'
do
before
do
stub_feature_flags
(
check_maven_path_first:
false
)
end
it_behaves_like
'processing HEAD requests'
it_behaves_like
'processing HEAD requests'
end
end
end
describe
'GET /api/v4/projects/:id/packages/maven/*path/:file_name'
do
describe
'GET /api/v4/projects/:id/packages/maven/*path/:file_name'
do
shared_examples
'handling all conditions'
do
context
'a public project'
do
context
'a public project'
do
subject
{
download_file
(
file_name:
package_file
.
file_name
)
}
subject
{
download_file
(
file_name:
package_file
.
file_name
)
}
...
@@ -676,23 +605,6 @@ RSpec.describe API::MavenPackages do
...
@@ -676,23 +605,6 @@ RSpec.describe API::MavenPackages do
it_behaves_like
'rejecting the request for non existing maven path'
it_behaves_like
'rejecting the request for non existing maven path'
end
end
end
end
end
context
'with check_maven_path_first enabled'
do
before
do
stub_feature_flags
(
check_maven_path_first:
true
)
end
it_behaves_like
'handling all conditions'
end
context
'with check_maven_path_first disabled'
do
before
do
stub_feature_flags
(
check_maven_path_first:
false
)
end
it_behaves_like
'handling all conditions'
end
def
download_file
(
file_name
:,
params:
{},
request_headers:
headers
,
path:
maven_metadatum
.
path
)
def
download_file
(
file_name
:,
params:
{},
request_headers:
headers
,
path:
maven_metadatum
.
path
)
get
api
(
"/projects/
#{
project
.
id
}
/packages/maven/"
\
get
api
(
"/projects/
#{
project
.
id
}
/packages/maven/"
\
...
@@ -708,22 +620,8 @@ RSpec.describe API::MavenPackages do
...
@@ -708,22 +620,8 @@ RSpec.describe API::MavenPackages do
let
(
:path
)
{
package
.
maven_metadatum
.
path
}
let
(
:path
)
{
package
.
maven_metadatum
.
path
}
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/packages/maven/
#{
path
}
/
#{
package_file
.
file_name
}
"
}
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/packages/maven/
#{
path
}
/
#{
package_file
.
file_name
}
"
}
context
'with check_maven_path_first enabled'
do
before
do
stub_feature_flags
(
check_maven_path_first:
true
)
end
it_behaves_like
'processing HEAD requests'
end
context
'with check_maven_path_first disabled'
do
before
do
stub_feature_flags
(
check_maven_path_first:
false
)
end
it_behaves_like
'processing HEAD requests'
it_behaves_like
'processing HEAD requests'
end
end
end
describe
'PUT /api/v4/projects/:id/packages/maven/*path/:file_name/authorize'
do
describe
'PUT /api/v4/projects/:id/packages/maven/*path/:file_name/authorize'
do
it
'rejects a malicious request'
do
it
'rejects a malicious request'
do
...
...
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