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
5956f00b
Commit
5956f00b
authored
Sep 02, 2020
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent private repo from being accessed via internal API
parent
3934a31b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
changelogs/unreleased/security-kubernetes-agent-internal-api.yml
...ogs/unreleased/security-kubernetes-agent-internal-api.yml
+5
-0
lib/api/internal/kubernetes.rb
lib/api/internal/kubernetes.rb
+1
-1
spec/requests/api/internal/kubernetes_spec.rb
spec/requests/api/internal/kubernetes_spec.rb
+11
-1
No files found.
changelogs/unreleased/security-kubernetes-agent-internal-api.yml
0 → 100644
View file @
5956f00b
---
title
:
Prevent private repo from being accessed via internal Kubernetes API
merge_request
:
author
:
type
:
security
lib/api/internal/kubernetes.rb
View file @
5956f00b
...
...
@@ -85,7 +85,7 @@ module API
# TODO sort out authorization for real
# https://gitlab.com/gitlab-org/gitlab/-/issues/220912
if
!
project
||
!
project
.
public?
unless
Ability
.
allowed?
(
nil
,
:download_code
,
project
)
not_found!
end
...
...
spec/requests/api/internal/kubernetes_spec.rb
View file @
5956f00b
...
...
@@ -166,6 +166,16 @@ RSpec.describe API::Internal::Kubernetes do
)
)
end
context
'repository is for project members only'
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository_private
)
}
it
'returns 404'
do
send_request
(
params:
{
id:
project
.
id
},
headers:
{
'Authorization'
=>
"Bearer
#{
agent_token
.
token
}
"
})
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
context
'project is private'
do
...
...
@@ -190,7 +200,7 @@ RSpec.describe API::Internal::Kubernetes do
context
'project does not exist'
do
it
'returns 404'
do
send_request
(
params:
{
id:
0
},
headers:
{
'Authorization'
=>
"Bearer
#{
agent_token
.
token
}
"
})
send_request
(
params:
{
id:
non_existing_record_id
},
headers:
{
'Authorization'
=>
"Bearer
#{
agent_token
.
token
}
"
})
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
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