dependabot-gradle 0.140.0 → 0.141.1

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: 8c10e93ed6824f1ff0c9a4bf32a46ba702f9d2380b577de8efa4ba066e5af07a
4
- data.tar.gz: d60bad161a4809828623cc6edbe3a3d4973ac032ba08e19141d214f6699fdc2d
3
+ metadata.gz: 4b3e9087c952024616b39e11e395e4a923296b0cbc94ede34cda99adcf0fc5a1
4
+ data.tar.gz: d68d70e32d8a6c223584c486862b01fe418b434ebe9645bc4341198f27c07443
5
5
  SHA512:
6
- metadata.gz: '0979a440f06b0662374bc26aac5c6bdae48bcadee99a776d1b60e29f8248957e4a161dd7522202ae96d35391f6e8a0cbd57035b5cfb835014a41d8e2047bd5ba'
7
- data.tar.gz: 6fa978f1b83b930d844b8bd253a496ce4ca5476a38f9985ae1b43246b653eb84a6f1fc704d1312ebdc96a4c992d58d1a9fb3905237744ea12acaecb3bea73879
6
+ metadata.gz: 62989a5291d8a4d8a43ae81bfa29a7523742286b2ae459041cd5ec948de3269349feb86575dd2bdc4693008e2d054ccb4a88f4c21745d0798cee8ebd475e82dc
7
+ data.tar.gz: bf0021b48256c7859417a86c19084b3a33a22c447dbfebfa8ed81a574d7a5c816c6ea650d1ad3c037f7bdea52f92b88bcff787f2e97ff850b5c30801e5aebbe1
@@ -5,6 +5,7 @@ require "dependabot/metadata_finders"
5
5
  require "dependabot/metadata_finders/base"
6
6
  require "dependabot/file_fetchers/base"
7
7
  require "dependabot/gradle/file_parser/repositories_finder"
8
+ require "dependabot/maven/utils/auth_headers_finder"
8
9
 
9
10
  module Dependabot
10
11
  module Gradle
@@ -112,7 +113,7 @@ module Dependabot
112
113
  "#{dependency.version}/"\
113
114
  "#{artifact_id}-#{dependency.version}.pom",
114
115
  idempotent: true,
115
- **SharedHelpers.excon_defaults(headers: auth_details)
116
+ **SharedHelpers.excon_defaults(headers: auth_headers)
116
117
  )
117
118
 
118
119
  @dependency_pom_file = Nokogiri::XML(response.body)
@@ -135,7 +136,7 @@ module Dependabot
135
136
  "#{version}/"\
136
137
  "#{artifact_id}-#{version}.pom",
137
138
  idempotent: true,
138
- **SharedHelpers.excon_defaults(headers: auth_details)
139
+ **SharedHelpers.excon_defaults(headers: auth_headers)
139
140
  )
140
141
 
141
142
  Nokogiri::XML(response.body)
@@ -170,21 +171,8 @@ module Dependabot
170
171
  plugin? && dependency.requirements.any? { |r| r.fetch(:groups).include? "kotlin" }
171
172
  end
172
173
 
173
- def auth_details
174
- cred =
175
- credentials.select { |c| c["type"] == "maven_repository" }.
176
- find do |c|
177
- cred_url = c.fetch("url").gsub(%r{/+$}, "")
178
- next false unless cred_url == maven_repo_url
179
-
180
- c.fetch("username", nil)
181
- end
182
-
183
- return {} unless cred
184
-
185
- token = cred.fetch("username") + ":" + cred.fetch("password")
186
- encoded_token = Base64.encode64(token).delete("\n")
187
- { "Authorization" => "Basic #{encoded_token}" }
174
+ def auth_headers
175
+ @auth_headers ||= Dependabot::Maven::Utils::AuthHeadersFinder.new(credentials).auth_headers(maven_repo_url)
188
176
  end
189
177
  end
190
178
  end
@@ -6,6 +6,7 @@ require "dependabot/gradle/file_parser/repositories_finder"
6
6
  require "dependabot/gradle/update_checker"
7
7
  require "dependabot/gradle/version"
8
8
  require "dependabot/gradle/requirement"
9
+ require "dependabot/maven/utils/auth_headers_finder"
9
10
 
10
11
  module Dependabot
11
12
  module Gradle
@@ -184,10 +185,8 @@ module Dependabot
184
185
  begin
185
186
  response = Excon.get(
186
187
  dependency_metadata_url(repository_details.fetch("url")),
187
- user: repository_details.fetch("username"),
188
- password: repository_details.fetch("password"),
189
188
  idempotent: true,
190
- **SharedHelpers.excon_defaults
189
+ **Dependabot::SharedHelpers.excon_defaults(headers: repository_details.fetch("auth_headers"))
191
190
  )
192
191
  check_response(response, repository_details.fetch("url"))
193
192
  Nokogiri::XML(response.body)
@@ -226,10 +225,10 @@ module Dependabot
226
225
 
227
226
  @repositories =
228
227
  details.reject do |repo|
229
- next if repo["password"]
228
+ next if repo["auth_headers"]
230
229
 
231
- # Reject this entry if an identical one with a password exists
232
- details.any? { |r| r["url"] == repo["url"] && r["password"] }
230
+ # Reject this entry if an identical one with non-empty auth_headers exists
231
+ details.any? { |r| r["url"] == repo["url"] && r["auth_headers"] != {} }
233
232
  end
234
233
  end
235
234
 
@@ -239,8 +238,7 @@ module Dependabot
239
238
  map do |cred|
240
239
  {
241
240
  "url" => cred.fetch("url").gsub(%r{/+$}, ""),
242
- "username" => cred.fetch("username", nil),
243
- "password" => cred.fetch("password", nil)
241
+ "auth_headers" => auth_headers(cred.fetch("url").gsub(%r{/+$}, ""))
244
242
  }
245
243
  end
246
244
  end
@@ -258,7 +256,7 @@ module Dependabot
258
256
  target_dependency_file: target_file
259
257
  ).repository_urls.
260
258
  map do |url|
261
- { "url" => url, "username" => nil, "password" => nil }
259
+ { "url" => url, "auth_headers" => {} }
262
260
  end
263
261
  end.uniq
264
262
  end
@@ -266,8 +264,7 @@ module Dependabot
266
264
  def plugin_repository_details
267
265
  [{
268
266
  "url" => GRADLE_PLUGINS_REPO,
269
- "username" => nil,
270
- "password" => nil
267
+ "auth_headers" => {}
271
268
  }] + dependency_repository_details
272
269
  end
273
270
 
@@ -333,6 +330,14 @@ module Dependabot
333
330
  def version_class
334
331
  Gradle::Version
335
332
  end
333
+
334
+ def auth_headers_finder
335
+ @auth_headers_finder ||= Dependabot::Maven::Utils::AuthHeadersFinder.new(credentials)
336
+ end
337
+
338
+ def auth_headers(maven_repo_url)
339
+ auth_headers_finder.auth_headers(maven_repo_url)
340
+ end
336
341
  end
337
342
  end
338
343
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-gradle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.140.0
4
+ version: 0.141.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-07 00:00:00.000000000 Z
11
+ date: 2021-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.140.0
19
+ version: 0.141.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.140.0
26
+ version: 0.141.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: dependabot-maven
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.141.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.141.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: byebug
29
43
  requirement: !ruby/object:Gem::Requirement