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
59740023
Commit
59740023
authored
Jun 29, 2020
by
Mehmet Emin INAC
Committed by
GitLab Release Tools Bot
Jun 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Security fix project authorizations for security dashboard
parent
b65821c5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
2 deletions
+21
-2
ee/app/models/instance_security_dashboard.rb
ee/app/models/instance_security_dashboard.rb
+5
-0
ee/changelogs/unreleased/security-fix_project_authorizations_for_security_dashboard.yml
...ity-fix_project_authorizations_for_security_dashboard.yml
+5
-0
ee/lib/ee/gitlab/access.rb
ee/lib/ee/gitlab/access.rb
+6
-0
ee/spec/models/instance_security_dashboard_spec.rb
ee/spec/models/instance_security_dashboard_spec.rb
+5
-2
No files found.
ee/app/models/instance_security_dashboard.rb
View file @
59740023
...
...
@@ -58,5 +58,10 @@ class InstanceSecurityDashboard
.
where
(
users_security_dashboard_projects:
{
user_id:
user
.
id
})
.
where
(
project_authorizations:
{
user_id:
user
.
id
})
.
where
(
'users_security_dashboard_projects.project_id = project_authorizations.project_id'
)
.
where
(
access_level:
authorized_access_levels
)
end
def
authorized_access_levels
Gitlab
::
Access
.
vulnerability_access_levels
.
values
end
end
ee/changelogs/unreleased/security-fix_project_authorizations_for_security_dashboard.yml
0 → 100644
View file @
59740023
---
title
:
Fix project authorizations for instance security dashboard
merge_request
:
author
:
type
:
security
ee/lib/ee/gitlab/access.rb
View file @
59740023
...
...
@@ -10,6 +10,12 @@ module EE
module
Access
extend
ActiveSupport
::
Concern
ADMIN
=
60
class_methods
do
def
vulnerability_access_levels
@vulnerability_access_levels
||=
options_with_owner
.
except
(
'Guest'
)
end
end
end
end
end
ee/spec/models/instance_security_dashboard_spec.rb
View file @
59740023
...
...
@@ -5,14 +5,17 @@ require 'spec_helper'
RSpec
.
describe
InstanceSecurityDashboard
do
let_it_be
(
:project1
)
{
create
(
:project
)
}
let_it_be
(
:project2
)
{
create
(
:project
)
}
let_it_be
(
:project3
)
{
create
(
:project
)
}
let_it_be
(
:pipeline1
)
{
create
(
:ci_pipeline
,
project:
project1
)
}
let_it_be
(
:pipeline2
)
{
create
(
:ci_pipeline
,
project:
project2
)
}
let_it_be
(
:pipeline3
)
{
create
(
:ci_pipeline
,
project:
project3
)
}
let
(
:project_ids
)
{
[
project1
.
id
]
}
let
(
:user
)
{
create
(
:user
)
}
before
do
project1
.
add_developer
(
user
)
user
.
security_dashboard_projects
<<
[
project1
,
project2
]
project3
.
add_guest
(
user
)
user
.
security_dashboard_projects
<<
[
project1
,
project2
,
project3
]
end
subject
{
described_class
.
new
(
user
,
project_ids:
project_ids
)
}
...
...
@@ -92,7 +95,7 @@ RSpec.describe InstanceSecurityDashboard do
let
(
:user
)
{
create
(
:auditor
)
}
it
"returns all projects on the user's dashboard"
do
expect
(
subject
.
projects
).
to
contain_exactly
(
project1
,
project2
)
expect
(
subject
.
projects
).
to
contain_exactly
(
project1
,
project2
,
project3
)
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