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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
1744c742
Commit
1744c742
authored
Jul 15, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to access Container Registry for Public and Internal projects
parent
50abec8c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
139 additions
and
26 deletions
+139
-26
CHANGELOG
CHANGELOG
+1
-0
app/models/ability.rb
app/models/ability.rb
+2
-1
spec/features/security/project/internal_access_spec.rb
spec/features/security/project/internal_access_spec.rb
+19
-0
spec/features/security/project/private_access_spec.rb
spec/features/security/project/private_access_spec.rb
+19
-0
spec/features/security/project/public_access_spec.rb
spec/features/security/project/public_access_spec.rb
+19
-0
spec/services/auth/container_registry_authentication_service_spec.rb
...es/auth/container_registry_authentication_service_spec.rb
+79
-25
No files found.
CHANGELOG
View file @
1744c742
...
...
@@ -79,6 +79,7 @@ v 8.10.0 (unreleased)
- Don't garbage collect commits that have related DB records like comments
- More descriptive message for git hooks and file locks
- Handle custom Git hook result in GitLab UI
- Allow to access Container Registry for Public and Internal projects
- Allow '?', or '&' for label names
- Fix importer for GitHub Pull Requests when a branch was reused across Pull Requests
- Add date when user joined the team on the member page
...
...
app/models/ability.rb
View file @
1744c742
...
...
@@ -204,7 +204,8 @@ class Ability
:download_code
,
:fork_project
,
:read_commit_status
,
:read_pipeline
:read_pipeline
,
:read_container_image
]
end
...
...
spec/features/security/project/internal_access_spec.rb
View file @
1744c742
...
...
@@ -426,4 +426,23 @@ describe "Internal Project Access", feature: true do
it
{
is_expected
.
to
be_denied_for
:external
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
describe
"GET /:project_path/container_registry"
do
before
do
stub_container_registry_tags
(
'latest'
)
stub_container_registry_config
(
enabled:
true
)
end
subject
{
namespace_project_container_registry_index_path
(
project
.
namespace
,
project
)
}
it
{
is_expected
.
to
be_allowed_for
:admin
}
it
{
is_expected
.
to
be_allowed_for
owner
}
it
{
is_expected
.
to
be_allowed_for
master
}
it
{
is_expected
.
to
be_allowed_for
developer
}
it
{
is_expected
.
to
be_allowed_for
reporter
}
it
{
is_expected
.
to
be_allowed_for
guest
}
it
{
is_expected
.
to
be_allowed_for
:user
}
it
{
is_expected
.
to
be_denied_for
:external
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
end
spec/features/security/project/private_access_spec.rb
View file @
1744c742
...
...
@@ -362,4 +362,23 @@ describe "Private Project Access", feature: true do
it
{
is_expected
.
to
be_denied_for
:external
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
describe
"GET /:project_path/container_registry"
do
before
do
stub_container_registry_tags
(
'latest'
)
stub_container_registry_config
(
enabled:
true
)
end
subject
{
namespace_project_container_registry_index_path
(
project
.
namespace
,
project
)
}
it
{
is_expected
.
to
be_allowed_for
:admin
}
it
{
is_expected
.
to
be_allowed_for
owner
}
it
{
is_expected
.
to
be_allowed_for
master
}
it
{
is_expected
.
to
be_allowed_for
developer
}
it
{
is_expected
.
to
be_allowed_for
reporter
}
it
{
is_expected
.
to
be_denied_for
guest
}
it
{
is_expected
.
to
be_denied_for
:user
}
it
{
is_expected
.
to
be_denied_for
:external
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
end
spec/features/security/project/public_access_spec.rb
View file @
1744c742
...
...
@@ -426,4 +426,23 @@ describe "Public Project Access", feature: true do
it
{
is_expected
.
to
be_denied_for
:external
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
describe
"GET /:project_path/container_registry"
do
before
do
stub_container_registry_tags
(
'latest'
)
stub_container_registry_config
(
enabled:
true
)
end
subject
{
namespace_project_container_registry_index_path
(
project
.
namespace
,
project
)
}
it
{
is_expected
.
to
be_allowed_for
:admin
}
it
{
is_expected
.
to
be_allowed_for
owner
}
it
{
is_expected
.
to
be_allowed_for
master
}
it
{
is_expected
.
to
be_allowed_for
developer
}
it
{
is_expected
.
to
be_allowed_for
reporter
}
it
{
is_expected
.
to
be_allowed_for
guest
}
it
{
is_expected
.
to
be_allowed_for
:user
}
it
{
is_expected
.
to
be_allowed_for
:external
}
it
{
is_expected
.
to
be_allowed_for
:visitor
}
end
end
spec/services/auth/container_registry_authentication_service_spec.rb
View file @
1744c742
...
...
@@ -87,9 +87,11 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
end
context
'user authorization'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:current_user
)
{
create
(
:user
)
}
context
'for private project'
do
let
(
:project
)
{
create
(
:empty_project
)
}
context
'allow to use scope-less authentication'
do
it_behaves_like
'a valid token'
end
...
...
@@ -135,6 +137,58 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
end
end
context
'for public project'
do
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
context
'allow anyone to pull images'
do
let
(
:current_params
)
do
{
scope:
"repository:
#{
project
.
path_with_namespace
}
:pull"
}
end
it_behaves_like
'a pullable'
end
context
'disallow anyone to push images'
do
let
(
:current_params
)
do
{
scope:
"repository:
#{
project
.
path_with_namespace
}
:push"
}
end
it_behaves_like
'an inaccessible'
end
end
context
'for internal project'
do
let
(
:project
)
{
create
(
:empty_project
,
:internal
)
}
context
'for internal user'
do
context
'allow anyone to pull images'
do
let
(
:current_params
)
do
{
scope:
"repository:
#{
project
.
path_with_namespace
}
:pull"
}
end
it_behaves_like
'a pullable'
end
context
'disallow anyone to push images'
do
let
(
:current_params
)
do
{
scope:
"repository:
#{
project
.
path_with_namespace
}
:push"
}
end
it_behaves_like
'an inaccessible'
end
end
context
'for external user'
do
let
(
:current_user
)
{
create
(
:user
,
external:
true
)
}
let
(
:current_params
)
do
{
scope:
"repository:
#{
project
.
path_with_namespace
}
:pull,push"
}
end
it_behaves_like
'an inaccessible'
end
end
end
context
'project authorization'
do
let
(
:current_project
)
{
create
(
:empty_project
)
}
...
...
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