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
9ea885f2
Commit
9ea885f2
authored
Mar 30, 2020
by
Michelle Gill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return only safe urls for mirrors
parent
1218d19e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
4 deletions
+18
-4
app/serializers/remote_mirror_entity.rb
app/serializers/remote_mirror_entity.rb
+1
-1
changelogs/unreleased/security-mirror-urls.yml
changelogs/unreleased/security-mirror-urls.yml
+5
-0
ee/app/serializers/ee/project_mirror_entity.rb
ee/app/serializers/ee/project_mirror_entity.rb
+1
-1
ee/spec/serializers/project_mirror_entity_spec.rb
ee/spec/serializers/project_mirror_entity_spec.rb
+5
-1
spec/serializers/remote_mirror_entity_spec.rb
spec/serializers/remote_mirror_entity_spec.rb
+6
-1
No files found.
app/serializers/remote_mirror_entity.rb
View file @
9ea885f2
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
class
RemoteMirrorEntity
<
Grape
::
Entity
class
RemoteMirrorEntity
<
Grape
::
Entity
expose
:id
expose
:id
expose
:url
expose
:
safe_url
,
as: :
url
expose
:enabled
expose
:enabled
expose
:auth_method
expose
:auth_method
...
...
changelogs/unreleased/security-mirror-urls.yml
0 → 100644
View file @
9ea885f2
---
title
:
Return only safe urls for mirrors
merge_request
:
author
:
type
:
security
ee/app/serializers/ee/project_mirror_entity.rb
View file @
9ea885f2
...
@@ -6,7 +6,7 @@ module EE
...
@@ -6,7 +6,7 @@ module EE
prepended
do
prepended
do
expose
:mirror
expose
:mirror
expose
:import_url
expose
:
safe_import_url
,
as: :
import_url
expose
:username_only_import_url
expose
:username_only_import_url
expose
:mirror_user_id
expose
:mirror_user_id
expose
:mirror_trigger_builds
expose
:mirror_trigger_builds
...
...
ee/spec/serializers/project_mirror_entity_spec.rb
View file @
9ea885f2
...
@@ -18,7 +18,7 @@ describe ProjectMirrorEntity do
...
@@ -18,7 +18,7 @@ describe ProjectMirrorEntity do
is_expected
.
to
eq
(
is_expected
.
to
eq
(
id:
project
.
id
,
id:
project
.
id
,
mirror:
true
,
mirror:
true
,
import_url:
project
.
import_url
,
import_url:
project
.
safe_
import_url
,
username_only_import_url:
project
.
username_only_import_url
,
username_only_import_url:
project
.
username_only_import_url
,
mirror_user_id:
project
.
mirror_user_id
,
mirror_user_id:
project
.
mirror_user_id
,
mirror_trigger_builds:
project
.
mirror_trigger_builds
,
mirror_trigger_builds:
project
.
mirror_trigger_builds
,
...
@@ -36,6 +36,10 @@ describe ProjectMirrorEntity do
...
@@ -36,6 +36,10 @@ describe ProjectMirrorEntity do
remote_mirrors_attributes:
[]
remote_mirrors_attributes:
[]
)
)
end
end
it
'excludes password information'
do
expect
(
subject
[
:import_url
]).
not_to
include
(
'password'
)
end
end
end
context
'SSH public-key authentication'
do
context
'SSH public-key authentication'
do
...
...
spec/serializers/remote_mirror_entity_spec.rb
View file @
9ea885f2
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
require
'spec_helper'
require
'spec_helper'
describe
RemoteMirrorEntity
do
describe
RemoteMirrorEntity
do
let
(
:project
)
{
create
(
:project
,
:repository
,
:remote_mirror
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
:remote_mirror
,
url:
"https://test:password@gitlab.com"
)
}
let
(
:remote_mirror
)
{
project
.
remote_mirrors
.
first
}
let
(
:remote_mirror
)
{
project
.
remote_mirrors
.
first
}
let
(
:entity
)
{
described_class
.
new
(
remote_mirror
)
}
let
(
:entity
)
{
described_class
.
new
(
remote_mirror
)
}
...
@@ -15,4 +15,9 @@ describe RemoteMirrorEntity do
...
@@ -15,4 +15,9 @@ describe RemoteMirrorEntity do
:ssh_known_hosts
,
:ssh_public_key
,
:ssh_known_hosts_fingerprints
:ssh_known_hosts
,
:ssh_public_key
,
:ssh_known_hosts_fingerprints
)
)
end
end
it
'does not expose password information'
do
expect
(
subject
[
:url
]).
not_to
include
(
'password'
)
expect
(
subject
[
:url
]).
to
eq
(
remote_mirror
.
safe_url
)
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