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
d0d87238
Commit
d0d87238
authored
Jan 03, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
546820e3
420442c5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
35 deletions
+45
-35
changelogs/unreleased/54844-report-syntax-dep-scan-ado.yml
changelogs/unreleased/54844-report-syntax-dep-scan-ado.yml
+5
-0
changelogs/unreleased/allow-basic-auth-on-go-get-middleware.yml
...logs/unreleased/allow-basic-auth-on-go-get-middleware.yml
+5
-0
doc/topics/autodevops/index.md
doc/topics/autodevops/index.md
+3
-0
lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
+2
-1
lib/gitlab/middleware/go.rb
lib/gitlab/middleware/go.rb
+12
-9
spec/lib/gitlab/middleware/go_spec.rb
spec/lib/gitlab/middleware/go_spec.rb
+18
-25
No files found.
changelogs/unreleased/54844-report-syntax-dep-scan-ado.yml
0 → 100644
View file @
d0d87238
---
title
:
Use reports syntax for Dependency scanning in Auto DevOps
merge_request
:
24081
author
:
type
:
added
changelogs/unreleased/allow-basic-auth-on-go-get-middleware.yml
0 → 100644
View file @
d0d87238
---
title
:
Allow basic authentication on go get middleware
merge_request
:
23497
author
:
Morty Choi @mortyccp
type
:
changed
doc/topics/autodevops/index.md
View file @
d0d87238
...
...
@@ -359,6 +359,9 @@ Any security warnings are also
NOTE:
**Note:**
The Auto Dependency Scanning stage will be skipped on licenses other than Ultimate.
NOTE:
**Note:**
The Auto Dependency Scanning job requires GitLab Runner 11.5 or above.
### Auto License Management **[ULTIMATE]**
> Introduced in [GitLab Ultimate][ee] 11.0.
...
...
lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
View file @
d0d87238
...
...
@@ -185,7 +185,8 @@ dependency_scanning:
-
setup_docker
-
dependency_scanning
artifacts
:
paths
:
[
gl-dependency-scanning-report.json
]
reports
:
dependency_scanning
:
gl-dependency-scanning-report.json
only
:
refs
:
-
branches
...
...
lib/gitlab/middleware/go.rb
View file @
d0d87238
...
...
@@ -6,6 +6,7 @@ module Gitlab
module
Middleware
class
Go
include
ActionView
::
Helpers
::
TagHelper
include
ActionController
::
HttpAuthentication
::
Basic
PROJECT_PATH_REGEX
=
%r{
\A
(
#{
Gitlab
::
PathRegex
.
full_namespace_route_regex
}
/
#{
Gitlab
::
PathRegex
.
project_route_regex
}
)/}
.
freeze
...
...
@@ -14,7 +15,7 @@ module Gitlab
end
def
call
(
env
)
request
=
Rack
::
Request
.
new
(
env
)
request
=
ActionDispatch
::
Request
.
new
(
env
)
render_go_doc
(
request
)
||
@app
.
call
(
env
)
end
...
...
@@ -110,21 +111,23 @@ module Gitlab
def
project_for_paths
(
paths
,
request
)
project
=
Project
.
where_full_path_in
(
paths
).
first
return
unless
Ability
.
allowed?
(
current_user
(
reques
t
),
:read_project
,
project
)
return
unless
Ability
.
allowed?
(
current_user
(
request
,
projec
t
),
:read_project
,
project
)
project
end
def
current_user
(
request
)
authenticator
=
Gitlab
::
Auth
::
RequestAuthenticator
.
new
(
request
)
user
=
authenticator
.
find_user_from_access_token
||
authenticator
.
find_user_from_warden
def
current_user
(
request
,
project
)
return
unless
has_basic_credentials?
(
request
)
return
unless
user
&
.
can?
(
:access_api
)
login
,
password
=
user_name_and_password
(
request
)
auth_result
=
Gitlab
::
Auth
.
find_for_git_client
(
login
,
password
,
project:
project
,
ip:
request
.
ip
)
return
unless
auth_result
.
success?
# Right now, the `api` scope is the only one that should be able to determine private project existence.
return
unless
authenticator
.
valid_access_token?
(
scopes:
[
:api
])
return
unless
auth_result
.
actor
&
.
can?
(
:access_git
)
user
return
unless
auth_result
.
authentication_abilities
.
include?
(
:read_project
)
auth_result
.
actor
end
end
end
...
...
spec/lib/gitlab/middleware/go_spec.rb
View file @
d0d87238
...
...
@@ -96,43 +96,36 @@ describe Gitlab::Middleware::Go do
it_behaves_like
'unauthorized'
end
end
context
'using warden'
do
before
do
env
[
'warden'
]
=
double
(
authenticate:
current_user
)
end
context
'when active'
do
it_behaves_like
'authenticated'
end
context
'when blocked'
do
context
'with user is blocked'
do
before
do
current_user
.
block
!
current_user
.
block
end
it_behaves_like
'unauthorized'
end
end
context
'using a personal access token'
do
let
(
:personal_access_token
)
{
create
(
:personal_access_token
,
user:
current_user
)
}
before
do
env
[
'HTTP_PRIVATE_TOKEN'
]
=
personal_access_token
.
token
end
context
'with api scope'
do
it_behaves_like
'authenticated'
end
context
'using basic auth'
do
context
'using a personal access token'
do
let
(
:personal_access_token
)
{
create
(
:personal_access_token
,
user:
current_user
)
}
context
'with read_user scope'
do
before
do
personal_access_token
.
update_attribute
(
:scopes
,
[
:read_user
])
env
[
'REMOTE_ADDR'
]
=
"192.168.0.1"
env
[
'HTTP_AUTHORIZATION'
]
=
ActionController
::
HttpAuthentication
::
Basic
.
encode_credentials
(
current_user
.
username
,
personal_access_token
.
token
)
end
it_behaves_like
'unauthorized'
context
'with api scope'
do
it_behaves_like
'authenticated'
end
context
'with read_user scope'
do
before
do
personal_access_token
.
update_attribute
(
:scopes
,
[
:read_user
])
end
it_behaves_like
'unauthorized'
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