license_finder 5.11.1 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +25 -0
- data/CONTRIBUTING.md +1 -1
- data/Dockerfile +9 -14
- data/LICENSE +1 -1
- data/README.md +18 -18
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/license_finder_pip.py +6 -2
- data/ci/pipelines/pull-request.yml.erb +14 -0
- data/ci/pipelines/release.yml.erb +24 -0
- data/lib/license_finder/cli.rb +2 -2
- data/lib/license_finder/cli/approvals.rb +1 -0
- data/lib/license_finder/cli/dependencies.rb +3 -2
- data/lib/license_finder/cli/main.rb +8 -8
- data/lib/license_finder/cli/makes_decisions.rb +3 -0
- data/lib/license_finder/cli/permitted_licenses.rb +32 -0
- data/lib/license_finder/cli/restricted_licenses.rb +32 -0
- data/lib/license_finder/core.rb +1 -1
- data/lib/license_finder/decision_applier.rb +6 -6
- data/lib/license_finder/decisions.rb +19 -19
- data/lib/license_finder/license_aggregator.rb +2 -2
- data/lib/license_finder/package.rb +15 -15
- data/lib/license_finder/package_manager.rb +1 -0
- data/lib/license_finder/package_managers/bundler.rb +3 -1
- data/lib/license_finder/package_managers/composer.rb +1 -1
- data/lib/license_finder/package_managers/pip.rb +11 -19
- data/lib/license_finder/package_managers/pipenv.rb +63 -0
- data/lib/license_finder/package_utils/pypi.rb +41 -0
- data/lib/license_finder/packages/merged_package.rb +2 -2
- data/lib/license_finder/reports/templates/html_report.erb +2 -2
- data/lib/license_finder/reports/templates/markdown_report.erb +2 -2
- data/lib/license_finder/scanner.rb +4 -2
- data/lib/license_finder/shared_helpers/common_path.rb +3 -1
- data/license_finder.gemspec +5 -6
- metadata +15 -14
- data/lib/license_finder/cli/blacklist.rb +0 -32
- data/lib/license_finder/cli/whitelist.rb +0 -32
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
require 'openssl'
|
5
|
+
|
6
|
+
module LicenseFinder
|
7
|
+
class PyPI
|
8
|
+
CONNECTION_ERRORS = [
|
9
|
+
EOFError,
|
10
|
+
Errno::ECONNREFUSED,
|
11
|
+
Errno::ECONNRESET,
|
12
|
+
Errno::ECONNRESET,
|
13
|
+
Errno::EHOSTUNREACH,
|
14
|
+
Errno::EINVAL,
|
15
|
+
Net::OpenTimeout,
|
16
|
+
Net::ProtocolError,
|
17
|
+
Net::ReadTimeout,
|
18
|
+
OpenSSL::OpenSSLError,
|
19
|
+
OpenSSL::SSL::SSLError,
|
20
|
+
SocketError,
|
21
|
+
Timeout::Error
|
22
|
+
].freeze
|
23
|
+
|
24
|
+
class << self
|
25
|
+
def definition(name, version)
|
26
|
+
response = request("https://pypi.org/pypi/#{name}/#{version}/json")
|
27
|
+
response.is_a?(Net::HTTPSuccess) ? JSON.parse(response.body).fetch('info', {}) : {}
|
28
|
+
rescue *CONNECTION_ERRORS
|
29
|
+
{}
|
30
|
+
end
|
31
|
+
|
32
|
+
def request(location, limit = 10)
|
33
|
+
uri = URI(location)
|
34
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
35
|
+
http.use_ssl = true
|
36
|
+
response = http.get(uri.request_uri).response
|
37
|
+
response.is_a?(Net::HTTPRedirection) && limit.positive? ? request(response['location'], limit - 1) : response
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -12,8 +12,8 @@ module LicenseFinder
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def_delegators :@dependency, :name, :version, :authors, :summary, :description, :homepage, :children, :parents,
|
15
|
-
:groups, :
|
16
|
-
:approved_manually!, :approved?, :
|
15
|
+
:groups, :permitted, :restricted, :manual_approval, :install_path, :licenses, :approved_manually?,
|
16
|
+
:approved_manually!, :approved?, :permitted!, :permitted?, :restricted!, :restricted?, :hash,
|
17
17
|
:activations, :missing, :license_names_from_spec, :decided_licenses, :licensing, :decide_on_license,
|
18
18
|
:license_files, :package_manager, :missing?, :log_activation, :notice_files
|
19
19
|
|
@@ -65,10 +65,10 @@
|
|
65
65
|
<% end -%>
|
66
66
|
<time datetime="<%= dependency.manual_approval.safe_when.utc.iso8601 %>"><%= dependency.manual_approval.safe_when.to_date %></time>
|
67
67
|
</small>
|
68
|
-
<% elsif dependency.
|
68
|
+
<% elsif dependency.permitted? -%>
|
69
69
|
<p>
|
70
70
|
<%= license_links(dependency) %>
|
71
|
-
|
71
|
+
permitted
|
72
72
|
<span class="badge badge-success">✓</span>
|
73
73
|
</p>
|
74
74
|
<% else -%>
|
@@ -37,8 +37,8 @@ As of <%= Time.now.strftime("%B %e, %Y %l:%M%P") %>. <%= dependencies.size %> to
|
|
37
37
|
><%= dependency.manual_approval.why %>
|
38
38
|
|
39
39
|
><cite> <%= dependency.manual_approval.who %> <%= dependency.manual_approval.safe_when.to_date %></cite>
|
40
|
-
<% elsif dependency.
|
41
|
-
<%= license_links(dependency) %>
|
40
|
+
<% elsif dependency.permitted? -%>
|
41
|
+
<%= license_links(dependency) %> permitted
|
42
42
|
<% else -%>
|
43
43
|
<%= license_links(dependency) %> _**unapproved**_
|
44
44
|
<% end -%>
|
@@ -2,8 +2,10 @@
|
|
2
2
|
|
3
3
|
module LicenseFinder
|
4
4
|
class Scanner
|
5
|
-
PACKAGE_MANAGERS = [
|
6
|
-
|
5
|
+
PACKAGE_MANAGERS = [
|
6
|
+
GoModules, GoDep, GoWorkspace, Go15VendorExperiment, Glide, Gvt, Govendor, Trash, Dep, Bundler, NPM, Pip,
|
7
|
+
Yarn, Bower, Maven, Gradle, CocoaPods, Rebar, Nuget, Carthage, Mix, Conan, Sbt, Cargo, Dotnet, Composer, Pipenv
|
8
|
+
].freeze
|
7
9
|
|
8
10
|
class << self
|
9
11
|
def remove_subprojects(paths)
|
@@ -20,7 +20,9 @@ module CommonPathHelper
|
|
20
20
|
|
21
21
|
longest_common_path = potential_path
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
|
+
longest_common_path = full_paths if longest_common_path.split('/').length == 1
|
25
|
+
(common_paths << longest_common_path).flatten!
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
data/license_finder.gemspec
CHANGED
@@ -9,7 +9,6 @@ Gem::Specification.new do |s|
|
|
9
9
|
|
10
10
|
s.authors = [
|
11
11
|
'Ryan Collins',
|
12
|
-
'Vikram Yadav',
|
13
12
|
'Daniil Kouznetsov',
|
14
13
|
'Andy Shen',
|
15
14
|
'Shane Lattanzio',
|
@@ -37,8 +36,8 @@ Gem::Specification.new do |s|
|
|
37
36
|
s.description = <<-DESCRIPTION
|
38
37
|
LicenseFinder works with your package managers to find
|
39
38
|
dependencies, detect the licenses of the packages in them, compare
|
40
|
-
those licenses against a user-defined
|
41
|
-
actionable exception report.
|
39
|
+
those licenses against a user-defined list of permitted licenses,
|
40
|
+
and give you an actionable exception report.
|
42
41
|
DESCRIPTION
|
43
42
|
|
44
43
|
s.license = 'MIT'
|
@@ -53,13 +52,13 @@ Gem::Specification.new do |s|
|
|
53
52
|
s.add_development_dependency 'addressable', '2.7.0'
|
54
53
|
s.add_development_dependency 'capybara', '~> 3.15.0'
|
55
54
|
s.add_development_dependency 'cocoapods', '>= 1.0.0' if RUBY_PLATFORM =~ /darwin/
|
56
|
-
s.add_development_dependency 'fakefs', '~> 0.
|
57
|
-
s.add_development_dependency 'mime-types', '3.3'
|
55
|
+
s.add_development_dependency 'fakefs', '~> 1.0.0'
|
56
|
+
s.add_development_dependency 'mime-types', '3.3.1'
|
58
57
|
s.add_development_dependency 'pry'
|
59
58
|
s.add_development_dependency 'rake'
|
60
59
|
s.add_development_dependency 'rspec', '~> 3'
|
61
60
|
s.add_development_dependency 'rspec-its'
|
62
|
-
s.add_development_dependency 'rubocop', '~> 0.
|
61
|
+
s.add_development_dependency 'rubocop', '~> 0.79.0'
|
63
62
|
s.add_development_dependency 'rubocop-performance', '~> 1.5.0'
|
64
63
|
s.add_development_dependency 'webmock', '~> 3.5'
|
65
64
|
|
metadata
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: license_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Collins
|
8
|
-
- Vikram Yadav
|
9
8
|
- Daniil Kouznetsov
|
10
9
|
- Andy Shen
|
11
10
|
- Shane Lattanzio
|
@@ -27,7 +26,7 @@ authors:
|
|
27
26
|
autorequire:
|
28
27
|
bindir: bin
|
29
28
|
cert_chain: []
|
30
|
-
date:
|
29
|
+
date: 2020-01-22 00:00:00.000000000 Z
|
31
30
|
dependencies:
|
32
31
|
- !ruby/object:Gem::Dependency
|
33
32
|
name: bundler
|
@@ -153,28 +152,28 @@ dependencies:
|
|
153
152
|
requirements:
|
154
153
|
- - "~>"
|
155
154
|
- !ruby/object:Gem::Version
|
156
|
-
version: 0.
|
155
|
+
version: 1.0.0
|
157
156
|
type: :development
|
158
157
|
prerelease: false
|
159
158
|
version_requirements: !ruby/object:Gem::Requirement
|
160
159
|
requirements:
|
161
160
|
- - "~>"
|
162
161
|
- !ruby/object:Gem::Version
|
163
|
-
version: 0.
|
162
|
+
version: 1.0.0
|
164
163
|
- !ruby/object:Gem::Dependency
|
165
164
|
name: mime-types
|
166
165
|
requirement: !ruby/object:Gem::Requirement
|
167
166
|
requirements:
|
168
167
|
- - '='
|
169
168
|
- !ruby/object:Gem::Version
|
170
|
-
version:
|
169
|
+
version: 3.3.1
|
171
170
|
type: :development
|
172
171
|
prerelease: false
|
173
172
|
version_requirements: !ruby/object:Gem::Requirement
|
174
173
|
requirements:
|
175
174
|
- - '='
|
176
175
|
- !ruby/object:Gem::Version
|
177
|
-
version:
|
176
|
+
version: 3.3.1
|
178
177
|
- !ruby/object:Gem::Dependency
|
179
178
|
name: pry
|
180
179
|
requirement: !ruby/object:Gem::Requirement
|
@@ -237,14 +236,14 @@ dependencies:
|
|
237
236
|
requirements:
|
238
237
|
- - "~>"
|
239
238
|
- !ruby/object:Gem::Version
|
240
|
-
version: 0.
|
239
|
+
version: 0.79.0
|
241
240
|
type: :development
|
242
241
|
prerelease: false
|
243
242
|
version_requirements: !ruby/object:Gem::Requirement
|
244
243
|
requirements:
|
245
244
|
- - "~>"
|
246
245
|
- !ruby/object:Gem::Version
|
247
|
-
version: 0.
|
246
|
+
version: 0.79.0
|
248
247
|
- !ruby/object:Gem::Dependency
|
249
248
|
name: rubocop-performance
|
250
249
|
requirement: !ruby/object:Gem::Requirement
|
@@ -304,8 +303,8 @@ dependencies:
|
|
304
303
|
description: |2
|
305
304
|
LicenseFinder works with your package managers to find
|
306
305
|
dependencies, detect the licenses of the packages in them, compare
|
307
|
-
those licenses against a user-defined
|
308
|
-
actionable exception report.
|
306
|
+
those licenses against a user-defined list of permitted licenses,
|
307
|
+
and give you an actionable exception report.
|
309
308
|
email:
|
310
309
|
- labs-commoncode@pivotal.io
|
311
310
|
executables:
|
@@ -349,7 +348,6 @@ files:
|
|
349
348
|
- lib/license_finder/cli.rb
|
350
349
|
- lib/license_finder/cli/approvals.rb
|
351
350
|
- lib/license_finder/cli/base.rb
|
352
|
-
- lib/license_finder/cli/blacklist.rb
|
353
351
|
- lib/license_finder/cli/dependencies.rb
|
354
352
|
- lib/license_finder/cli/ignored_dependencies.rb
|
355
353
|
- lib/license_finder/cli/ignored_groups.rb
|
@@ -357,8 +355,9 @@ files:
|
|
357
355
|
- lib/license_finder/cli/main.rb
|
358
356
|
- lib/license_finder/cli/makes_decisions.rb
|
359
357
|
- lib/license_finder/cli/patched_thor.rb
|
358
|
+
- lib/license_finder/cli/permitted_licenses.rb
|
360
359
|
- lib/license_finder/cli/project_name.rb
|
361
|
-
- lib/license_finder/cli/
|
360
|
+
- lib/license_finder/cli/restricted_licenses.rb
|
362
361
|
- lib/license_finder/configuration.rb
|
363
362
|
- lib/license_finder/core.rb
|
364
363
|
- lib/license_finder/decision_applier.rb
|
@@ -417,6 +416,7 @@ files:
|
|
417
416
|
- lib/license_finder/package_managers/npm.rb
|
418
417
|
- lib/license_finder/package_managers/nuget.rb
|
419
418
|
- lib/license_finder/package_managers/pip.rb
|
419
|
+
- lib/license_finder/package_managers/pipenv.rb
|
420
420
|
- lib/license_finder/package_managers/rebar.rb
|
421
421
|
- lib/license_finder/package_managers/sbt.rb
|
422
422
|
- lib/license_finder/package_managers/trash.rb
|
@@ -429,6 +429,7 @@ files:
|
|
429
429
|
- lib/license_finder/package_utils/maven_dependency_finder.rb
|
430
430
|
- lib/license_finder/package_utils/notice_files.rb
|
431
431
|
- lib/license_finder/package_utils/possible_license_file.rb
|
432
|
+
- lib/license_finder/package_utils/pypi.rb
|
432
433
|
- lib/license_finder/package_utils/sbt_dependency_finder.rb
|
433
434
|
- lib/license_finder/packages/bower_package.rb
|
434
435
|
- lib/license_finder/packages/bundler_package.rb
|
@@ -490,7 +491,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
490
491
|
- !ruby/object:Gem::Version
|
491
492
|
version: '0'
|
492
493
|
requirements: []
|
493
|
-
rubygems_version: 3.
|
494
|
+
rubygems_version: 3.1.2
|
494
495
|
signing_key:
|
495
496
|
specification_version: 4
|
496
497
|
summary: Audit the OSS licenses of your application's dependencies.
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module LicenseFinder
|
4
|
-
module CLI
|
5
|
-
class Blacklist < Base
|
6
|
-
extend Subcommand
|
7
|
-
include MakesDecisions
|
8
|
-
|
9
|
-
desc 'list', 'List all the blacklisted licenses'
|
10
|
-
def list
|
11
|
-
say 'Blacklisted Licenses:', :blue
|
12
|
-
say_each(decisions.blacklisted, &:name)
|
13
|
-
end
|
14
|
-
|
15
|
-
auditable
|
16
|
-
desc 'add LICENSE...', 'Add one or more licenses to the blacklist'
|
17
|
-
def add(*licenses)
|
18
|
-
assert_some licenses
|
19
|
-
modifying { licenses.each { |l| decisions.blacklist(l, txn) } }
|
20
|
-
say "Added #{licenses.join(', ')} to the license blacklist"
|
21
|
-
end
|
22
|
-
|
23
|
-
auditable
|
24
|
-
desc 'remove LICENSE...', 'Remove one or more licenses from the blacklist'
|
25
|
-
def remove(*licenses)
|
26
|
-
assert_some licenses
|
27
|
-
modifying { licenses.each { |l| decisions.unblacklist(l, txn) } }
|
28
|
-
say "Removed #{licenses.join(', ')} from the license blacklist"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module LicenseFinder
|
4
|
-
module CLI
|
5
|
-
class Whitelist < Base
|
6
|
-
extend Subcommand
|
7
|
-
include MakesDecisions
|
8
|
-
|
9
|
-
desc 'list', 'List all the whitelisted licenses'
|
10
|
-
def list
|
11
|
-
say 'Whitelisted Licenses:', :blue
|
12
|
-
say_each(decisions.whitelisted, &:name)
|
13
|
-
end
|
14
|
-
|
15
|
-
auditable
|
16
|
-
desc 'add LICENSE...', 'Add one or more licenses to the whitelist'
|
17
|
-
def add(*licenses)
|
18
|
-
assert_some licenses
|
19
|
-
modifying { licenses.each { |l| decisions.whitelist(l, txn) } }
|
20
|
-
say "Added #{licenses.join(', ')} to the license whitelist"
|
21
|
-
end
|
22
|
-
|
23
|
-
auditable
|
24
|
-
desc 'remove LICENSE...', 'Remove one or more licenses from the whitelist'
|
25
|
-
def remove(*licenses)
|
26
|
-
assert_some licenses
|
27
|
-
modifying { licenses.each { |l| decisions.unwhitelist(l, txn) } }
|
28
|
-
say "Removed #{licenses.join(', ')} from the license whitelist"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|