license_finder 6.5.0 → 6.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cb023a2297b083354287a99cd5fb5cb5640fb6fe8e4c449f9407f9198f14dfe
4
- data.tar.gz: 7af5d367b73cb9447a78d83e49db2ca810a2d7a6315b313941acb99251bc11ed
3
+ metadata.gz: e7e3a83f4f274f851f8c7005b05cdfa4d453b44879bab381b59c00a0cf8066cc
4
+ data.tar.gz: 44bdd7d357c0bc8d4bc111489eb7102690d6cd4a04e92d4c064625b6a97f5591
5
5
  SHA512:
6
- metadata.gz: c6530566a1e99b1a8b5bdf36d7b9486c2cb95c112e856e7d69525ce139d0d14a1eab1d2ea538009338ce94a822cbe5faf99ae1d4ff5674f417abd25ba0845497
7
- data.tar.gz: b6fdc169ec59d8b84ae96a8ab5bbb25a7ce8ee2cc7de6d96acfc63347d00bfc5009a24cf743d39add5de78e21b3c56c52856baa76d05ba6a81996c974ad8074d
6
+ metadata.gz: 5f361eb0ae74e3cfa6ff1390951f8a1dc18c3f9da9b460e7ab373dba19b195f57b2e891640d595bc48bc37e598f565c537252b09a03f9fd3073c59011a50406c
7
+ data.tar.gz: a3e85a00c781671cfe1de68bc31a35876705904278bf0a34453ef65a5ac78a4761abb2ce4a537b3ce9d8f31c87733043acea612a8b876ae4944773d979f00005
@@ -1,3 +1,33 @@
1
+ # [6.8.0] / 2020-08-06
2
+
3
+ # [6.7.0] / 2020-07-23
4
+
5
+ # [6.6.2] / 2020-07-09
6
+
7
+ ### Added
8
+ * support for rebar3 - [b20e7444](https://github.com/pivotal/LicenseFinder/commit/b20e7444c147d8dbfa46eb4e8e549e03be751e02) - Jeff Jun
9
+ * Support for Go modules projects outside of the current working directory - [56b3bec6](https://github.com/pivotal/LicenseFinder/commit/56b3bec632b3884ce4cad538742b4a13c55fd7c5)
10
+
11
+ ### Changed
12
+ * Change Go modules to only report imported packages (as with other Go package managers) - [34361fda](https://github.com/pivotal/LicenseFinder/commit/34361fdab2dc3f197f7aec6408175018dee3b453) and [dffae4ab](https://github.com/pivotal/LicenseFinder/commit/dffae4ab95e34115b6a54bf681fc0966a8611f01)
13
+ * Detect Go modules based on `go.mod` (instead of `go.sum`) - [667f6be7](https://github.com/pivotal/LicenseFinder/commit/667f6be716504a53ccc2824daae08af085566546)
14
+
15
+ ### Fixed
16
+ * handle empty case for mix dependencies [#173637843] - [fc34b281](https://github.com/pivotal/LicenseFinder/commit/fc34b2813925a709addde675849e199b05fc4a23) - Jeff Jun
17
+
18
+ ### Removed
19
+ * support for rebar2 [#173637980] - [b20e7444](https://github.com/pivotal/LicenseFinder/commit/b20e7444c147d8dbfa46eb4e8e549e03be751e02) - Jeff Jun
20
+ * Removed the unnecessary prepare command for Go modules - [284cc5c8](https://github.com/pivotal/LicenseFinder/commit/284cc5c821270a6e56275e32bac836a3e451f46b)
21
+
22
+ # [6.6.1] / 2020-06-30
23
+
24
+ ### Changed
25
+ * Handle multiple solution files for nuget [#173021333] - [040d9559](https://github.com/pivotal/LicenseFinder/commit/040d9559a4bda07490255cc34c1a7891081bc511)
26
+ * matches license names from pypi api call with known licenses to avoid returning misformatted licenses [#173421573] - [6b96d746](https://github.com/pivotal/LicenseFinder/commit/6b96d74600034abcacee6ed2b322aa3abfaa0992) - Jeff Jun
27
+ * Update Nuget Package Manager prepare command - [6ac07066](https://github.com/pivotal/LicenseFinder/commit/6ac070668955bc034da1647658440ce5bb0d9bd2) - Jason Smith
28
+
29
+ # [6.6.0] / 2020-06-22
30
+
1
31
  # [6.5.0] / 2020-06-01
2
32
 
3
33
  ### Added
@@ -874,3 +904,8 @@ Bugfixes:
874
904
  [6.3.0]: https://github.com/pivotal/LicenseFinder/compare/v6.2.0...v6.3.0
875
905
  [6.4.0]: https://github.com/pivotal/LicenseFinder/compare/v6.3.0...v6.4.0
876
906
  [6.5.0]: https://github.com/pivotal/LicenseFinder/compare/v6.4.0...v6.5.0
907
+ [6.6.0]: https://github.com/pivotal/LicenseFinder/compare/v6.5.0...v6.6.0
908
+ [6.6.1]: https://github.com/pivotal/LicenseFinder/compare/v6.6.0...v6.6.1
909
+ [6.6.2]: https://github.com/pivotal/LicenseFinder/compare/v6.6.1...v6.6.2
910
+ [6.7.0]: https://github.com/pivotal/LicenseFinder/compare/v6.6.2...v6.7.0
911
+ [6.8.0]: https://github.com/pivotal/LicenseFinder/compare/v6.7.0...v6.8.0
data/Dockerfile CHANGED
@@ -48,11 +48,13 @@ ENV JAVA_HOME=/opt/jdk-12.0.2
48
48
  ENV PATH=$PATH:$JAVA_HOME/bin
49
49
  RUN java -version
50
50
 
51
- # install python and rebar
52
- RUN apt-get install -y python rebar
51
+ # install rebar3
52
+ RUN curl -o rebar3 https://s3.amazonaws.com/rebar3/rebar3 && \
53
+ sudo chmod +x rebar3 && \
54
+ sudo mv rebar3 /usr/local/bin/rebar3
53
55
 
54
- # install and update python-pip
55
- RUN apt-get install -y python-pip python3-pip && \
56
+ # install and update python and python-pip
57
+ RUN apt-get install -y python python-pip python3-pip && \
56
58
  pip2 install --no-cache-dir --upgrade pip==$PIP_INSTALL_VERSION && \
57
59
  pip3 install --no-cache-dir --upgrade pip==$PIP3_INSTALL_VERSION
58
60
 
@@ -157,7 +159,7 @@ RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 4F4EA0AAE5
157
159
  apt-get update &&\
158
160
  apt-get install -y php7.4-cli &&\
159
161
  php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" &&\
160
- php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" &&\
162
+ php -r "if (hash_file('sha384', 'composer-setup.php') === 'e5325b19b381bfd88ce90a5ddb7823406b2a38cff6bb704b0acc289a09c8128d4a8ce2bbafcd1fcbdc38666422fe2806') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" &&\
161
163
  php composer-setup.php &&\
162
164
  php -r "unlink('composer-setup.php');" &&\
163
165
  mv composer.phar /usr/bin/composer
data/README.md CHANGED
@@ -43,7 +43,7 @@ and give you an actionable exception report.
43
43
 
44
44
  ### Experimental project types
45
45
 
46
- * Erlang (via `rebar`)
46
+ * Erlang (via `rebar` and `Erlang.mk`)
47
47
  * Objective-C, Swift (via Carthage or CocoaPods \[0.39 and below. See [CocoaPods Specs Repo Sharding](http://blog.cocoapods.org/Sharding/)\])
48
48
  * Objective-C (+ CocoaPods 0.39 and below. See [CocoaPods Specs Repo Sharding](http://blog.cocoapods.org/Sharding/))
49
49
  * Elixir (via `mix`)
@@ -176,6 +176,7 @@ languages, as long as that language has a package definition in the project dire
176
176
  * `Podfile` (for `pod`)
177
177
  * `Cartfile` (for `carthage`)
178
178
  * `rebar.config` (for `rebar`)
179
+ * `Erlang.mk` or `erlang.mk` file (for `Erlang.mk`)
179
180
  * `mix.exs` (for `mix`)
180
181
  * `packages/` directory (for `nuget`)
181
182
  * `*.csproj` (for `dotnet`)
@@ -183,7 +184,7 @@ languages, as long as that language has a package definition in the project dire
183
184
  * `glide.lock` file (for `glide`)
184
185
  * `vendor/vendor.json` file (for `govendor`)
185
186
  * `Gopkg.lock` file (for `dep`)
186
- * `go.sum` file (for `go mod`)
187
+ * `go.mod` file (for `go mod`)
187
188
  * `vendor.conf` file (for `trash`)
188
189
  * `yarn.lock` file (for `yarn`)
189
190
  * `conanfile.txt` file (for `conan`)
@@ -327,7 +328,7 @@ you should manually research what the actual license is. When you
327
328
  have established the real license, you can record it with:
328
329
 
329
330
  ```sh
330
- $ license_finder dependencies add my_unknown_dependency MIT --homepage="www.unknown-code.org"
331
+ $ license_finder licenses add my_unknown_dependency MIT --homepage="www.unknown-code.org"
331
332
  ```
332
333
 
333
334
  This command would assign the MIT license to the dependency
@@ -379,6 +380,26 @@ items, even if someone attempts to manually approve or permit it. However,
379
380
  if a dependency has even one license that is not restricted, it can still be
380
381
  manually approved or permitted.
381
382
 
383
+ ## Decision inheritance
384
+
385
+ Add or remove decision files you want to inherit from - see `license_finder inherited_decisions help` for more information.
386
+
387
+ This allows you to have a centralized decision file for approved/restricted licenses. If you have multiple projects it's way easier to have one single place where you approved or restricted licenses defined.
388
+
389
+ Add one or more decision files to the inherited decisions
390
+ ```bash
391
+ license_finder inherited_decisions add DECISION_FILE
392
+ ```
393
+
394
+ Remove one or more decision files from the inherited decisions
395
+ ```bash
396
+ license_finder inherited_decisions remove DECISION_FILE
397
+ ```
398
+
399
+ List all the inherited decision files
400
+ ```bash
401
+ license_finder inherited_decisions list
402
+ ```
382
403
 
383
404
  ## Configuration
384
405
 
@@ -392,7 +413,7 @@ If you have a gradle project, you can invoke gradle with a custom script by
392
413
  passing (for example) `--gradle_command gradlew` to `license_finder` or
393
414
  `license_finder report`.
394
415
 
395
- Similarly you can invoke a custom rebar script with `--rebar_command rebar2`.
416
+ Similarly you can invoke a custom rebar script with `--rebar_command rebar`.
396
417
  If you store rebar dependencies in a custom directory (by setting `deps_dir` in
397
418
  `rebar.config`), set `--rebar_deps_dir`.
398
419
 
@@ -467,6 +488,8 @@ licenseConfigurations := Set("compile", "provided")
467
488
 
468
489
  ## Upgrading
469
490
 
491
+ To upgrade to `license_finder` version >= 6.0, you have to replace the terminology `whitelist` with `permit` and `blacklist` with `restrict` in your `dependency_decisions.yml`. See [Changelog](https://github.com/pivotal/LicenseFinder/blob/master/CHANGELOG.md#600--2020-01-22) for more details.
492
+
470
493
  To upgrade from `license_finder` version 1.2 to 2.0, see
471
494
  [`license_finder_upgrade`](https://github.com/mainej/license_finder_upgrade).
472
495
  To upgrade to 2.0 from a version lower than 1.2, first upgrade to 1.2, and run
data/Rakefile CHANGED
@@ -6,15 +6,6 @@ Bundler::GemHelper.install_tasks
6
6
  require './lib/license_finder/platform'
7
7
  require 'rspec/core/rake_task'
8
8
 
9
- namespace :spec do
10
- desc 'Run test tagged \'focus\''
11
- RSpec::Core::RakeTask.new(:focus) do |t|
12
- t.fail_on_error = true
13
- t.pattern = './spec/**/*_spec.rb'
14
- t.rspec_opts = %w[--color --tag focus]
15
- end
16
- end
17
-
18
9
  desc 'Run all specs in spec/'
19
10
  RSpec::Core::RakeTask.new(:spec) do |t|
20
11
  t.fail_on_error = true
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.5.0
1
+ 6.8.0
@@ -123,21 +123,31 @@ jobs:
123
123
 
124
124
  - name: bump-major
125
125
  plan:
126
- - put: semver-version
126
+ - get: semver-version
127
127
  tags: ["private-worker"]
128
128
  params: {bump: major}
129
+ - put: semver-version
130
+ tags: ["private-worker"]
131
+ params: {file: semver-version/version}
132
+
129
133
 
130
134
  - name: bump-minor
131
135
  plan:
132
- - put: semver-version
136
+ - get: semver-version
133
137
  tags: ["private-worker"]
134
138
  params: {bump: minor}
139
+ - put: semver-version
140
+ tags: ["private-worker"]
141
+ params: {file: semver-version/version}
135
142
 
136
143
  - name: bump-patch
137
144
  plan:
138
- - put: semver-version
145
+ - get: semver-version
139
146
  tags: ["private-worker"]
140
147
  params: {bump: patch}
148
+ - put: semver-version
149
+ tags: ["private-worker"]
150
+ params: {file: semver-version/version}
141
151
 
142
152
  - name: release
143
153
  disable_manual_trigger: true
@@ -20,6 +20,15 @@ module LicenseFinder
20
20
  say "Added #{decision_files.join(', ')} to the inherited decisions"
21
21
  end
22
22
 
23
+ auditable
24
+ desc 'add_with_auth URL AUTH_TYPE TOKEN_OR_ENV', 'Add a remote decision file that needs authentication'
25
+ def add_with_auth(*params)
26
+ url, auth_type, token_or_env = params
27
+ auth_info = { 'url' => url, 'authorization' => "#{auth_type} #{token_or_env}" }
28
+ modifying { decisions.add_decision [:inherit_from, auth_info] }
29
+ say "Added #{url} to the inherited decisions"
30
+ end
31
+
23
32
  auditable
24
33
  desc 'remove DECISION_FILE...', 'Remove one or more decision files from the inherited decisions'
25
34
  def remove(*decision_files)
@@ -27,6 +36,15 @@ module LicenseFinder
27
36
  modifying { decision_files.each { |filepath| decisions.remove_inheritance(filepath) } }
28
37
  say "Removed #{decision_files.join(', ')} from the inherited decisions"
29
38
  end
39
+
40
+ auditable
41
+ desc 'remove_with_auth URL AUTH_TYPE TOKEN_OR_ENV', 'Add a remote decision file that needs authentication'
42
+ def remove_with_auth(*params)
43
+ url, auth_type, token_or_env = params
44
+ auth_info = { 'url' => url, 'authorization' => "#{auth_type} #{token_or_env}" }
45
+ modifying { decisions.remove_inheritance(auth_info) }
46
+ say "Removed #{url} from the inherited decisions"
47
+ end
30
48
  end
31
49
  end
32
50
  end
@@ -35,7 +35,7 @@ module LicenseFinder
35
35
  end
36
36
 
37
37
  def rebar_deps_dir
38
- path = get(:rebar_deps_dir) || 'deps'
38
+ path = get(:rebar_deps_dir) || '_build/default/lib'
39
39
  project_path.join(path).expand_path
40
40
  end
41
41
 
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'open-uri'
4
+ require 'license_finder/license'
4
5
 
5
6
  module LicenseFinder
6
7
  class Decisions
@@ -39,6 +40,9 @@ module LicenseFinder
39
40
  end
40
41
 
41
42
  def permitted?(lic)
43
+ return lic.sub_licenses.any? { |sub_lic| @permitted.include?(sub_lic) } if lic.is_a?(OrLicense)
44
+ return lic.sub_licenses.all? { |sub_lic| @permitted.include?(sub_lic) } if lic.is_a?(AndLicense)
45
+
42
46
  @permitted.include?(lic)
43
47
  end
44
48
 
@@ -183,19 +187,37 @@ module LicenseFinder
183
187
  self
184
188
  end
185
189
 
186
- def inherit_from(filepath)
190
+ def inherit_from(filepath_info)
187
191
  decisions =
188
- if filepath =~ %r{^https?://}
189
- open_uri(filepath).read
192
+ if filepath_info.is_a?(Hash)
193
+ resolve_inheritance(filepath_info)
194
+ elsif filepath_info =~ %r{^https?://}
195
+ open_uri(filepath_info).read
190
196
  else
191
- Pathname(filepath).read
197
+ Pathname(filepath_info).read
192
198
  end
193
199
 
194
- add_decision [:inherit_from, filepath]
195
- @inherited_decisions << filepath
200
+ add_decision [:inherit_from, filepath_info]
201
+ @inherited_decisions << filepath_info
196
202
  restore_inheritance(decisions)
197
203
  end
198
204
 
205
+ def resolve_inheritance(filepath_info)
206
+ if (gem_name = filepath_info['gem'])
207
+ Pathname(gem_config_path(gem_name, filepath_info['path'])).read
208
+ else
209
+ open_uri(filepath_info['url'], filepath_info['authorization']).read
210
+ end
211
+ end
212
+
213
+ def gem_config_path(gem_name, relative_config_path)
214
+ spec = Gem::Specification.find_by_name(gem_name)
215
+ File.join(spec.gem_dir, relative_config_path)
216
+ rescue Gem::LoadError => e
217
+ raise Gem::LoadError,
218
+ "Unable to find gem #{gem_name}; is the gem installed? #{e}"
219
+ end
220
+
199
221
  def remove_inheritance(filepath)
200
222
  @decisions -= [[:inherit_from, filepath]]
201
223
  @inherited_decisions.delete(filepath)
@@ -213,17 +235,31 @@ module LicenseFinder
213
235
  self
214
236
  end
215
237
 
216
- def open_uri(uri)
238
+ def open_uri(uri, auth = nil)
239
+ header = {}
240
+ auth_header = resolve_authorization(auth)
241
+ header['Authorization'] = auth_header if auth_header
242
+
217
243
  # ruby < 2.5.0 URI.open is private
218
244
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.5.0')
219
245
  # rubocop:disable Security/Open
220
- open(uri)
246
+ open(uri, header)
221
247
  # rubocop:enable Security/Open
222
248
  else
223
- URI.open(uri)
249
+ URI.open(uri, header)
224
250
  end
225
251
  end
226
252
 
253
+ def resolve_authorization(auth)
254
+ return unless auth
255
+
256
+ token_env = auth.match(/\$(\S.*)/)
257
+ return auth unless token_env
258
+
259
+ token = ENV[token_env[1]]
260
+ auth.sub(token_env[0], token)
261
+ end
262
+
227
263
  #########
228
264
  # PERSIST
229
265
  #########
@@ -19,6 +19,9 @@ module LicenseFinder
19
19
 
20
20
  def find_by_name(name)
21
21
  name ||= 'unknown'
22
+ return OrLicense.new(name) if name.include?(OrLicense.operator)
23
+ return AndLicense.new(name) if name.include?(AndLicense.operator)
24
+
22
25
  all.detect { |l| l.matches_name? l.stripped_name(name) } || Definitions.build_unrecognized(name)
23
26
  end
24
27
 
@@ -61,6 +64,10 @@ module LicenseFinder
61
64
  name.hash
62
65
  end
63
66
 
67
+ def unrecognized_matcher?
68
+ matcher.is_a?(NoneMatcher)
69
+ end
70
+
64
71
  private
65
72
 
66
73
  attr_reader :short_name, :pretty_name, :other_names
@@ -70,4 +77,34 @@ module LicenseFinder
70
77
  ([short_name, pretty_name] + other_names).uniq
71
78
  end
72
79
  end
80
+ class AndLicense < License
81
+ def self.operator
82
+ ' AND '
83
+ end
84
+
85
+ def initialize(name, operator = AndLicense.operator)
86
+ @short_name = name
87
+ @pretty_name = name
88
+ @url = nil
89
+ @matcher = NoneMatcher.new
90
+ # removes heading and trailing parentesis and splits
91
+ name = name[1..-2] if name.start_with?('(')
92
+ names = name.split(operator)
93
+ @sub_licenses = names.map do |sub_name|
94
+ License.find_by_name(sub_name)
95
+ end
96
+ end
97
+
98
+ attr_reader :sub_licenses
99
+ end
100
+
101
+ class OrLicense < AndLicense
102
+ def self.operator
103
+ ' OR '
104
+ end
105
+
106
+ def initialize(name)
107
+ super(name, OrLicense.operator)
108
+ end
109
+ end
73
110
  end
@@ -19,13 +19,15 @@ module LicenseFinder
19
19
  lgpl,
20
20
  lgpl2_1,
21
21
  mit,
22
+ mpl1_1,
22
23
  mpl2,
23
24
  newbsd,
24
25
  ofl,
25
26
  python,
26
27
  ruby,
27
28
  simplifiedbsd,
28
- wtfpl
29
+ wtfpl,
30
+ zerobsd
29
31
  ]
30
32
  end
31
33
 
@@ -181,8 +183,32 @@ module LicenseFinder
181
183
  )
182
184
  end
183
185
 
186
+ def mpl1_1
187
+ header_regexp = /Mozilla Public Licen[sc]e.*Version 1\.1/im
188
+
189
+ header_regexp_matcher = Matcher.from_regex(header_regexp)
190
+ mpl1_1_tmpl = Template.named('MPL1_1')
191
+
192
+ matcher = AnyMatcher.new(
193
+ HeaderMatcher.new(header_regexp_matcher, 2),
194
+ Matcher.from_template(mpl1_1_tmpl)
195
+ )
196
+
197
+ License.new(
198
+ short_name: 'MPL1_1',
199
+ pretty_name: 'Mozilla Public License 1.1',
200
+ other_names: [
201
+ 'MPL-1.1',
202
+ 'Mozilla Public License, Version 1.1',
203
+ 'Mozilla Public License version 1.1'
204
+ ],
205
+ url: 'https://www.mozilla.org/media/MPL/1.1/index.0c5913925d40.txt',
206
+ matcher: matcher
207
+ )
208
+ end
209
+
184
210
  def mpl2
185
- header_regexp = /Mozilla Public Licen[sc]e, version 2.0/
211
+ header_regexp = /Mozilla Public Licen[sc]e, version 2\.0/
186
212
 
187
213
  matcher = AnyMatcher.new(
188
214
  Matcher.from_template(Template.named('MPL2')),
@@ -302,6 +328,27 @@ module LicenseFinder
302
328
  url: 'http://www.wtfpl.net/'
303
329
  )
304
330
  end
331
+
332
+ def zerobsd
333
+ matcher = AnyMatcher.new(
334
+ Matcher.from_template(Template.named('0BSD'))
335
+ )
336
+
337
+ License.new(
338
+ short_name: '0BSD',
339
+ pretty_name: 'BSD Zero Clause License',
340
+ other_names: [
341
+ '0-Clause BSD',
342
+ 'Zero-Clause BSD',
343
+ 'BSD-0-Clause',
344
+ 'BSD-Zero-Clause',
345
+ 'BSD 0-Clause',
346
+ 'BSD Zero-Clause'
347
+ ],
348
+ url: 'https://opensource.org/licenses/0BSD',
349
+ matcher: matcher
350
+ )
351
+ end
305
352
  end
306
353
  end
307
354
  end