package-audit 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/package/audit/const/cmd.rb +1 -1
- data/lib/package/audit/npm/vulnerability_finder.rb +6 -7
- data/lib/package/audit/ruby/gem_meta_data.rb +1 -1
- data/lib/package/audit/ruby/vulnerability_finder.rb +3 -1
- data/lib/package/audit/services/config_cleaner.rb +4 -1
- data/lib/package/audit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f5f9a3b6c50fcbebe1832c0559eddcd5a4e99c94779d1a251ad00c540df6c6b6
|
|
4
|
+
data.tar.gz: 84c02793f8d4b6a07099179fa5deee0ee473541668eb4b9212ea62b0e61d37d5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 197beea22db4bdc21106d235e6bf0d360d61c396498d516a1fbd8aa8cca2342348aa4bcdacbd08376199ad0ff0a0555f0e145a9d2d19d4a6e1e4f29a684c6a4f
|
|
7
|
+
data.tar.gz: 8540a1858d4ad3a094f20d77c174dafcbffe1b3af1fc1a9ead5806443efb314a7bbbcb77d7fb3ccc764aed0f921de9e71b588ea82283b06a4cf4bb1dfb3fc414
|
data/README.md
CHANGED
|
@@ -10,8 +10,6 @@ A useful tool for patch management and prioritization, `package-audit` produces
|
|
|
10
10
|
|
|
11
11
|
Supports **Ruby 2.6 → latest**, with the full Ruby matrix tested daily in CI.
|
|
12
12
|
|
|
13
|
-
[](https://www.buymeacoffee.com/vkononov)
|
|
14
|
-
|
|
15
13
|
## Supported Technologies
|
|
16
14
|
|
|
17
15
|
* Ruby
|
|
@@ -169,6 +167,8 @@ package-audit help [COMMAND]
|
|
|
169
167
|
|
|
170
168
|
The `package-audit` gem automatically searches for `.package-audit.yml` in the current directory or in the specified `DIR` if available. However, you have the option to override the default configuration file location by using the `--config` (or `-c`) flag.
|
|
171
169
|
|
|
170
|
+
When `--technology` is specified, stale exclusions are cleaned up only for the selected technologies. Configuration entries for other technologies are preserved.
|
|
171
|
+
|
|
172
172
|
#### Below is an example of a configuration file:
|
|
173
173
|
|
|
174
174
|
```YAML
|
|
@@ -3,7 +3,7 @@ module Package
|
|
|
3
3
|
module Const
|
|
4
4
|
module Cmd
|
|
5
5
|
BUNDLE_AUDIT = 'bundle-audit check --update'
|
|
6
|
-
BUNDLE_AUDIT_JSON =
|
|
6
|
+
BUNDLE_AUDIT_JSON = %w[bundle-audit check --update --quiet --format json].freeze
|
|
7
7
|
|
|
8
8
|
NPM_AUDIT = 'npm audit'
|
|
9
9
|
end
|
|
@@ -14,7 +14,7 @@ module Package
|
|
|
14
14
|
BULK_ADVISORY_URL = 'https://registry.npmjs.org/-/npm/v1/security/advisories/bulk'
|
|
15
15
|
BATCH_SIZE = 100
|
|
16
16
|
TIMEOUT = 30
|
|
17
|
-
VERSION_LINE = /^\s+"?version"
|
|
17
|
+
VERSION_LINE = /^\s+"?version"?(?::\s*|\s+)["']?([^"'\s]+)["']?\s*$/
|
|
18
18
|
|
|
19
19
|
def initialize(dir, pkgs)
|
|
20
20
|
@dir = dir
|
|
@@ -105,14 +105,13 @@ module Package
|
|
|
105
105
|
uri = URI(BULK_ADVISORY_URL)
|
|
106
106
|
response = make_request(uri, versions_by_name.to_json)
|
|
107
107
|
unless response.is_a?(Net::HTTPSuccess)
|
|
108
|
-
|
|
109
|
-
return {}
|
|
108
|
+
raise "Unable to fetch npm advisories (#{response.code} #{response.message})"
|
|
110
109
|
end
|
|
111
110
|
|
|
112
|
-
JSON.parse(response.body)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
advisories = JSON.parse(response.body)
|
|
112
|
+
raise 'Invalid npm advisory response' unless advisories.is_a?(Hash)
|
|
113
|
+
|
|
114
|
+
advisories
|
|
116
115
|
end
|
|
117
116
|
|
|
118
117
|
def make_request(uri, body)
|
|
@@ -11,7 +11,9 @@ module Package
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def run
|
|
14
|
-
json_result =
|
|
14
|
+
json_result = IO.popen(
|
|
15
|
+
[*Const::Cmd::BUNDLE_AUDIT_JSON, @dir.to_s], err: File::NULL, &:read
|
|
16
|
+
)
|
|
15
17
|
vulnerability_json_array = JSON.parse(json_result, symbolize_names: true)[:results]
|
|
16
18
|
vulnerability_json_array.each do |vulnerability_json|
|
|
17
19
|
update_meta_data(vulnerability_json)
|
|
@@ -62,7 +62,10 @@ module Package
|
|
|
62
62
|
cleaned
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
def clean_packages_for_technology(technology, packages)
|
|
65
|
+
def clean_packages_for_technology(technology, packages) # rubocop:disable Metrics/MethodLength
|
|
66
|
+
technologies = @options[Enum::Option::TECHNOLOGY]
|
|
67
|
+
return packages if technologies && !technologies.include?(technology)
|
|
68
|
+
|
|
66
69
|
return {} unless packages.is_a?(Hash)
|
|
67
70
|
|
|
68
71
|
current_packages = current_packages_for_technology(technology)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: package-audit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vadim Kononov
|
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
117
117
|
- !ruby/object:Gem::Version
|
|
118
118
|
version: '0'
|
|
119
119
|
requirements: []
|
|
120
|
-
rubygems_version: 4.0.
|
|
120
|
+
rubygems_version: 4.0.20
|
|
121
121
|
specification_version: 4
|
|
122
122
|
summary: CLI that reports outdated, deprecated and vulnerable dependencies in a project
|
|
123
123
|
test_files: []
|