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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
c2b33d3b
Commit
c2b33d3b
authored
8 years ago
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added import url exposer to construct URL withunencrypted credentials
parent
06b36c00
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
5 deletions
+24
-5
app/models/project_import_data.rb
app/models/project_import_data.rb
+1
-0
lib/gitlab/github_import/importer.rb
lib/gitlab/github_import/importer.rb
+1
-2
lib/gitlab/github_import/project_creator.rb
lib/gitlab/github_import/project_creator.rb
+2
-2
lib/gitlab/github_import/wiki_formatter.rb
lib/gitlab/github_import/wiki_formatter.rb
+3
-1
lib/gitlab/import_url_exposer.rb
lib/gitlab/import_url_exposer.rb
+17
-0
No files found.
app/models/project_import_data.rb
View file @
c2b33d3b
...
...
@@ -13,6 +13,7 @@ require 'file_size_validator'
class
ProjectImportData
<
ActiveRecord
::
Base
belongs_to
:project
attr_encrypted
:credentials
,
key:
Gitlab
::
Application
.
secrets
.
db_key_base
serialize
:credentials
,
JSON
serialize
:data
,
JSON
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/github_import/importer.rb
View file @
c2b33d3b
...
...
@@ -7,8 +7,7 @@ module Gitlab
def
initialize
(
project
)
@project
=
project
import_data
=
project
.
import_data
.
try
(
:data
)
github_session
=
import_data
[
"github_session"
]
if
import_data
github_session
=
project
.
import_data
.
credentials
if
import_data
@client
=
Client
.
new
(
github_session
[
"github_access_token"
])
@formatter
=
Gitlab
::
ImportFormatter
.
new
end
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/github_import/project_creator.rb
View file @
c2b33d3b
...
...
@@ -32,8 +32,8 @@ module Gitlab
def
create_import_data
(
project
)
project
.
create_import_data
(
credentials:
session_data
.
delete
(
:github_access_token
)
,
data:
{
"github_session"
=>
session_data
})
credentials:
{
github_access_token:
session_data
.
delete
(
:github_access_token
)
}
,
data:
{
github_session:
session_data
})
end
end
end
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/github_import/wiki_formatter.rb
View file @
c2b33d3b
...
...
@@ -12,7 +12,9 @@ module Gitlab
end
def
import_url
project
.
import_url
.
sub
(
/\.git\z/
,
".wiki.git"
)
import_url
=
Gitlab
::
ImportUrlExposer
.
expose
(
import_url:
project
.
import_url
,
credentials:
project
.
import_data
.
credentials
)
import_url
.
sub
(
/\.git\z/
,
".wiki.git"
)
end
end
end
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/import_url_exposer.rb
0 → 100644
View file @
c2b33d3b
module
Gitlab
# Exposes an import URL that includes the credentials unencrypted.
# Extracted to its own class to prevent unintended use.
module
ImportUrlExposer
extend
self
def
expose
(
import_url
:,
credentials:
)
import_url
.
sub
(
"//"
,
"//
#{
parsed_credentials
(
credentials
)
}
@"
)
end
private
def
parsed_credentials
(
credentials
)
credentials
.
values
.
join
(
":"
)
end
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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