dependabot-nuget 0.182.4 → 0.185.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dependabot/nuget/metadata_finder.rb +65 -1
- metadata +25 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 371e6d47e0d0c264bbc29fd3763bdf8d292b8d1b7b8e01924b7d1c39e8500841
|
4
|
+
data.tar.gz: 604bedfec7fd7187cbaeca4568a773bf03eb2859077202bffcb316d5e203c75c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 534a9efa904bf97bf0fd2615103f3e98ce14c29efb65e2d92b4bf523a35e14b768a059af0cd74727444c1ffb2a7cfbaa58181d13dc2e5561087652e816a0b8ec
|
7
|
+
data.tar.gz: c21499f7e83e3bf9eea738e4373ab752473294a119bd335a67c34655a4329ae014df748b0ef15aa6957fb2715a20d6544cea0e1aa737ccb1dafdbbb0b28b99d6
|
@@ -12,7 +12,71 @@ module Dependabot
|
|
12
12
|
def look_up_source
|
13
13
|
return Source.from_url(dependency_source_url) if dependency_source_url
|
14
14
|
|
15
|
-
look_up_source_in_nuspec(dependency_nuspec_file)
|
15
|
+
src_repo = look_up_source_in_nuspec(dependency_nuspec_file)
|
16
|
+
return src_repo if src_repo
|
17
|
+
|
18
|
+
# Fallback to getting source from the search result's projectUrl or licenseUrl.
|
19
|
+
# GitHub Packages doesn't support getting the `.nuspec`, switch to getting
|
20
|
+
# that instead once it is supported.
|
21
|
+
src_repo_from_project
|
22
|
+
rescue StandardError
|
23
|
+
# At this point in the process the PR is ready to be posted, we tried to gather commit
|
24
|
+
# and release notes, but have encountered an exception. So let's eat it since it's
|
25
|
+
# better to have a PR with no info than error out.
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def src_repo_from_project
|
30
|
+
source = dependency.requirements.find { |r| r&.fetch(:source) }&.fetch(:source)
|
31
|
+
return unless source
|
32
|
+
|
33
|
+
# Query the service index e.g. https://nuget.pkg.github.com/ORG/index.json
|
34
|
+
response = Excon.get(
|
35
|
+
source.fetch(:url),
|
36
|
+
idempotent: true,
|
37
|
+
**SharedHelpers.excon_defaults(headers: { **auth_header, "Accept" => "application/json" })
|
38
|
+
)
|
39
|
+
return unless response.status == 200
|
40
|
+
|
41
|
+
# Extract the query url e.g. https://nuget.pkg.github.com/ORG/query
|
42
|
+
search_base = extract_search_url(response.body)
|
43
|
+
return unless search_base
|
44
|
+
|
45
|
+
response = Excon.get(
|
46
|
+
search_base + "?q=#{dependency.name.downcase}&prerelease=true&semVerLevel=2.0.0",
|
47
|
+
idempotent: true,
|
48
|
+
**SharedHelpers.excon_defaults(headers: { **auth_header, "Accept" => "application/json" })
|
49
|
+
)
|
50
|
+
return unless response.status == 200
|
51
|
+
|
52
|
+
# Find a projectUrl or licenseUrl that look like a source URL
|
53
|
+
extract_source_repo(response.body)
|
54
|
+
rescue JSON::ParserError
|
55
|
+
# Ignored, this is expected for some registries that don't handle these request.
|
56
|
+
end
|
57
|
+
|
58
|
+
def extract_search_url(body)
|
59
|
+
JSON.parse(body).
|
60
|
+
fetch("resources", []).
|
61
|
+
find { |r| r.fetch("@type") == "SearchQueryService" }&.
|
62
|
+
fetch("@id")
|
63
|
+
end
|
64
|
+
|
65
|
+
def extract_source_repo(body)
|
66
|
+
JSON.parse(body).fetch("data", []).each do |search_result|
|
67
|
+
next unless search_result["id"].downcase == dependency.name.downcase
|
68
|
+
|
69
|
+
if search_result.key?("projectUrl")
|
70
|
+
source = Source.from_url(search_result.fetch("projectUrl"))
|
71
|
+
return source if source
|
72
|
+
end
|
73
|
+
if search_result.key?("licenseUrl")
|
74
|
+
source = Source.from_url(search_result.fetch("licenseUrl"))
|
75
|
+
return source if source
|
76
|
+
end
|
77
|
+
end
|
78
|
+
# failed to find a source URL
|
79
|
+
nil
|
16
80
|
end
|
17
81
|
|
18
82
|
def look_up_source_in_nuspec(nuspec)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-nuget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.185.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dependabot-common
|
@@ -16,28 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.185.0
|
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.
|
26
|
+
version: 0.185.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: debase
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.2.
|
33
|
+
version: 0.2.3
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: debase-ruby_core_source
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.10.14
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
54
|
+
version: 0.10.14
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: debug
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +128,14 @@ dependencies:
|
|
114
128
|
requirements:
|
115
129
|
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
131
|
+
version: 1.28.2
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
138
|
+
version: 1.28.2
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: ruby-debug-ide
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -253,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
267
|
- !ruby/object:Gem::Version
|
254
268
|
version: 2.7.0
|
255
269
|
requirements: []
|
256
|
-
rubygems_version: 3.
|
270
|
+
rubygems_version: 3.3.7
|
257
271
|
signing_key:
|
258
272
|
specification_version: 4
|
259
273
|
summary: ".NET (NuGet) support for dependabot"
|