smart_proxy_openscap 0.12.0 → 0.12.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/.github/workflows/release.yml +20 -0
- data/.github/workflows/test.yml +1 -1
- data/lib/smart_proxy_openscap/arf_html.rb +1 -1
- data/lib/smart_proxy_openscap/arf_parser.rb +23 -23
- data/lib/smart_proxy_openscap/storage_fs.rb +12 -1
- data/lib/smart_proxy_openscap/version.rb +1 -1
- metadata +4 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 404a103b2ff24e1b3ff89bf63f548abd7269386df14b87225034fc52a30626e3
|
4
|
+
data.tar.gz: 1121a51545bdff52152bb63339b0be18b65a22241795e5e2b3423a5495295082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2fcf76c1a4742ba1d1d1b2b0883a5e9cc942f6f0bcb5740390f56e7f38ed95b50288cf7a07dc5b75779543821d6a6e7acd3ef0865097b0c083d102b6ddc40f8
|
7
|
+
data.tar.gz: c95f37095c506b144d9573b6f45fbbd540641828ad73762ead1a4845ddc2708ef42c863572e1579016be2118e1e0e870e330c0c9a5bed02b67fbefc1b760005e
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
# Pattern matched against refs/tags
|
6
|
+
tags:
|
7
|
+
- '**'
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
release:
|
11
|
+
name: Release gem
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
environment: release
|
14
|
+
if: github.repository_owner == 'theforeman'
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
id-token: write
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- uses: voxpupuli/ruby-release@v0
|
data/.github/workflows/test.yml
CHANGED
@@ -22,10 +22,7 @@ module Proxy
|
|
22
22
|
raise Proxy::OpenSCAP::ReportDecompressError, "Failed to decompress received report bzip, cause: #{e.message}"
|
23
23
|
end
|
24
24
|
arf_file = ::OpenscapParser::TestResultFile.new(decompressed)
|
25
|
-
rules = arf_file.benchmark.rules.
|
26
|
-
memo[rule.id] = rule
|
27
|
-
memo
|
28
|
-
end
|
25
|
+
rules = arf_file.benchmark.rules.to_h { |rule| [rule.id, rule] }
|
29
26
|
|
30
27
|
arf_digest = Digest::SHA256.hexdigest(arf_data)
|
31
28
|
report = parse_results(rules, arf_file.test_result, arf_digest)
|
@@ -37,18 +34,16 @@ module Proxy
|
|
37
34
|
private
|
38
35
|
|
39
36
|
def parse_results(rules, test_result, arf_digest)
|
40
|
-
results = test_result.rule_results
|
41
37
|
set_values = test_result.set_values
|
42
|
-
report = {}
|
43
|
-
report[:logs] = []
|
44
38
|
passed = 0
|
45
39
|
failed = 0
|
46
40
|
othered = 0
|
47
|
-
|
41
|
+
|
42
|
+
logs = test_result.rule_results.filter_map do |result|
|
48
43
|
next if result.result == 'notapplicable' || result.result == 'notselected'
|
44
|
+
|
49
45
|
# get rules and their results
|
50
46
|
rule_data = rules[result.id]
|
51
|
-
report[:logs] << populate_result_data(result.id, result.result, rule_data, set_values)
|
52
47
|
# create metrics for the results
|
53
48
|
case result.result
|
54
49
|
when 'pass', 'fixed'
|
@@ -58,24 +53,29 @@ module Proxy
|
|
58
53
|
else
|
59
54
|
othered += 1
|
60
55
|
end
|
56
|
+
|
57
|
+
populate_result_data(result.id, result.result, rule_data, set_values)
|
61
58
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
59
|
+
|
60
|
+
{
|
61
|
+
logs: logs,
|
62
|
+
digest: arf_digest,
|
63
|
+
metrics: { :passed => passed, :failed => failed, :othered => othered },
|
64
|
+
score: test_result.score,
|
65
|
+
}
|
66
66
|
end
|
67
67
|
|
68
68
|
def populate_result_data(result_id, rule_result, rule_data, set_values)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
69
|
+
{
|
70
|
+
source: result_id,
|
71
|
+
result: rule_result,
|
72
|
+
title: rule_data.title,
|
73
|
+
description: rule_data.description,
|
74
|
+
rationale: rule_data.rationale,
|
75
|
+
references: rule_data.references.map { |ref| { :href => ref.href, :title => ref.label }},
|
76
|
+
fixes: populate_fixes(rule_data.fixes, set_values),
|
77
|
+
severity: rule_data.severity,
|
78
|
+
}
|
79
79
|
end
|
80
80
|
|
81
81
|
def populate_fixes(fixes, set_values)
|
@@ -27,6 +27,11 @@ module Proxy::OpenSCAP
|
|
27
27
|
move "#{source}/#{digest}", StoreCorruptedError
|
28
28
|
end
|
29
29
|
|
30
|
+
def move_from_spool(digest, spooldir)
|
31
|
+
path = Dir.glob("#{spooldir}/#{@namespace}/#{@cname}/*/#{@date}/#{digest}").first
|
32
|
+
move path, StoreSpoolError
|
33
|
+
end
|
34
|
+
|
30
35
|
def get_arf_xml(digest)
|
31
36
|
get_arf_file(digest)[:xml]
|
32
37
|
end
|
@@ -45,8 +50,14 @@ module Proxy::OpenSCAP
|
|
45
50
|
|
46
51
|
def get_path(digest)
|
47
52
|
full_path = @path + digest
|
48
|
-
|
53
|
+
if !File.file?(full_path) || File.zero?(full_path)
|
54
|
+
logger.info "File not found in storage, trying to get it from spool"
|
55
|
+
path_to_spool = Proxy::OpenSCAP::Plugin.settings.spooldir
|
56
|
+
move_from_spool(digest, path_to_spool)
|
57
|
+
end
|
49
58
|
full_path
|
59
|
+
rescue StoreSpoolError
|
60
|
+
raise FileNotFound, "Can't find path #{full_path}"
|
50
61
|
end
|
51
62
|
|
52
63
|
def spool_errors
|
metadata
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_openscap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Šimon Lukašík
|
8
8
|
- Shlomi Zadok
|
9
9
|
- Marek Hulan
|
10
|
-
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2025-04-09 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rake
|
@@ -91,6 +90,7 @@ executables:
|
|
91
90
|
extensions: []
|
92
91
|
extra_rdoc_files: []
|
93
92
|
files:
|
93
|
+
- ".github/workflows/release.yml"
|
94
94
|
- ".github/workflows/test.yml"
|
95
95
|
- ".rubocop.yml"
|
96
96
|
- ".rubocop_todo.yml"
|
@@ -153,7 +153,6 @@ homepage: https://github.com/theforeman/smart_proxy_openscap
|
|
153
153
|
licenses:
|
154
154
|
- GPL-3.0-or-later
|
155
155
|
metadata: {}
|
156
|
-
post_install_message:
|
157
156
|
rdoc_options: []
|
158
157
|
require_paths:
|
159
158
|
- lib
|
@@ -172,8 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
171
|
version: '0'
|
173
172
|
requirements:
|
174
173
|
- oscap
|
175
|
-
rubygems_version: 3.2
|
176
|
-
signing_key:
|
174
|
+
rubygems_version: 3.6.2
|
177
175
|
specification_version: 4
|
178
176
|
summary: OpenSCAP plug-in for Foreman's smart-proxy.
|
179
177
|
test_files: []
|