Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
9738d795
Commit
9738d795
authored
May 16, 2018
by
Dimitris Koutsogiorgas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Warn if '
git://
' protocol is used as the source of a pod
parent
a72ce8bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
12 deletions
+32
-12
CHANGELOG.md
CHANGELOG.md
+4
-0
pod_source_installer.rb
lib/cocoapods/installer/pod_source_installer.rb
+18
-10
pod_source_installer_spec.rb
spec/unit/installer/pod_source_installer_spec.rb
+10
-2
No files found.
CHANGELOG.md
View file @
9738d795
...
@@ -8,6 +8,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -8,6 +8,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
##### Enhancements
*
Warn if 'git://' protocol is used as the source of a pod
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#7705
](
https://github.com/CocoaPods/CocoaPods/issues/7705
)
*
Remove all PBX state from targets, improve project generation performance
*
Remove all PBX state from targets, improve project generation performance
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#7610
](
https://github.com/CocoaPods/CocoaPods/pull/7610
)
[
#7610
](
https://github.com/CocoaPods/CocoaPods/pull/7610
)
...
...
lib/cocoapods/installer/pod_source_installer.rb
View file @
9738d795
...
@@ -8,6 +8,8 @@ module Pod
...
@@ -8,6 +8,8 @@ module Pod
# @note This class needs to consider all the activated specs of a Pod.
# @note This class needs to consider all the activated specs of a Pod.
#
#
class
PodSourceInstaller
class
PodSourceInstaller
UNENCRYPTED_PROTOCOLS
=
%w(http git)
.
freeze
# @return [Sandbox] The installation target.
# @return [Sandbox] The installation target.
#
#
attr_reader
:sandbox
attr_reader
:sandbox
...
@@ -110,18 +112,24 @@ module Pod
...
@@ -110,18 +112,24 @@ module Pod
end
end
end
end
# Verify the source of the spec is secure, which is used to
# Verify the source of the spec is secure, which is used to show a warning to the user if that isn't the case
# show a warning to the user if that isn't the case
# This method doesn't verify all protocols, but currently only prohibits unencrypted 'http://' and 'git://''
# This method doesn't verify all protocols, but currently
# connections.
# only prohibits unencrypted http:// connections
#
# @return [void]
#
#
def
verify_source_is_secure
(
root_spec
)
def
verify_source_is_secure
(
root_spec
)
return
if
root_spec
.
source
.
nil?
||
root_spec
.
source
[
:http
].
nil?
return
if
root_spec
.
source
.
nil?
||
(
root_spec
.
source
[
:http
].
nil?
&&
root_spec
.
source
[
:git
].
nil?
)
http_source
=
URI
(
root_spec
.
source
[
:http
])
source
=
if
!
root_spec
.
source
[
:http
].
nil?
return
if
http_source
.
scheme
==
'https'
||
http_source
.
scheme
==
'file'
URI
(
root_spec
.
source
[
:http
].
to_s
)
UI
.
warn
"'
#{
root_spec
.
name
}
' uses the unencrypted http protocol to transfer the Pod. "
\
elsif
!
root_spec
.
source
[
:git
].
nil?
'Please be sure you\'re in a safe network with only trusted hosts in there. '
\
URI
(
root_spec
.
source
[
:git
].
to_s
)
'Please reach out to the library author to notify them of this security issue.'
end
if
UNENCRYPTED_PROTOCOLS
.
include?
(
source
.
scheme
)
UI
.
warn
"'
#{
root_spec
.
name
}
' uses the unencrypted '
#{
source
.
scheme
}
' protocol to transfer the Pod. "
\
'Please be sure you\'re in a safe network with only trusted hosts. '
\
'Otherwise, please reach out to the library author to notify them of this security issue.'
end
end
end
def
download_request
def
download_request
...
...
spec/unit/installer/pod_source_installer_spec.rb
View file @
9738d795
...
@@ -46,12 +46,20 @@ module Pod
...
@@ -46,12 +46,20 @@ module Pod
UI
.
warnings
.
length
.
should
.
equal
(
0
)
UI
.
warnings
.
length
.
should
.
equal
(
0
)
end
end
it
'shows a warning if the source is unencrypted
(e.g. http)
'
do
it
'shows a warning if the source is unencrypted
with http://
'
do
@spec
.
source
=
{
:http
=>
'http://orta.io/sdk.zip'
}
@spec
.
source
=
{
:http
=>
'http://orta.io/sdk.zip'
}
dummy_response
=
Pod
::
Downloader
::
Response
.
new
dummy_response
=
Pod
::
Downloader
::
Response
.
new
Downloader
.
stubs
(
:download
).
returns
(
dummy_response
)
Downloader
.
stubs
(
:download
).
returns
(
dummy_response
)
@installer
.
install!
@installer
.
install!
UI
.
warnings
.
should
.
include
'Please reach out to the library author to notify them of this security issue'
UI
.
warnings
.
should
.
include
'uses the unencrypted \'http\' protocol'
end
it
'shows a warning if the source is unencrypted with git://'
do
@spec
.
source
=
{
:git
=>
'git://git.orta.io/orta.git'
}
dummy_response
=
Pod
::
Downloader
::
Response
.
new
Downloader
.
stubs
(
:download
).
returns
(
dummy_response
)
@installer
.
install!
UI
.
warnings
.
should
.
include
'uses the unencrypted \'git\' protocol'
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