foreman_cve_scanner 0.0.2 → 0.5.0

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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -16
  3. data/Rakefile +2 -0
  4. data/app/controllers/api/v2/cve_scans_controller.rb +66 -0
  5. data/app/lib/actions/foreman_cve_scanner/cve_scanner_job.rb +3 -18
  6. data/app/models/concerns/foreman_cve_scanner/host_extensions.rb +16 -0
  7. data/app/models/foreman_cve_scanner/cve_scan.rb +15 -0
  8. data/app/models/host_status/cve_status.rb +71 -0
  9. data/app/services/foreman_cve_scanner/cve_report_scanner.rb +37 -35
  10. data/app/services/foreman_cve_scanner/scan_importer.rb +105 -0
  11. data/app/views/api/v2/cve_scans/base.json.rabl +5 -0
  12. data/app/views/api/v2/cve_scans/index.json.rabl +5 -0
  13. data/app/views/api/v2/cve_scans/latest.json.rabl +5 -0
  14. data/app/views/api/v2/cve_scans/main.json.rabl +7 -0
  15. data/app/views/api/v2/cve_scans/show.json.rabl +5 -0
  16. data/app/views/foreman_cve_scanner/job_templates/run_cve_scanner.erb +4 -2
  17. data/config/routes.rb +20 -0
  18. data/db/migrate/20260221000000_create_foreman_cve_scanner_cve_scans.rb +22 -0
  19. data/db/seeds.d/75_job_templates.rb +17 -0
  20. data/lib/foreman_cve_scanner/engine.rb +25 -3
  21. data/lib/foreman_cve_scanner/version.rb +3 -1
  22. data/lib/foreman_cve_scanner.rb +4 -1
  23. data/lib/tasks/foreman_cve_scanner_seeds.rake +12 -0
  24. data/lib/tasks/rubocop.rake +33 -0
  25. data/package.json +48 -0
  26. data/test/actions/foreman_cve_scanner/cve_scanner_job_test.rb +54 -0
  27. data/test/controllers/api/v2/cve_scans_controller_test.rb +78 -0
  28. data/test/models/host_status/cve_status_test.rb +65 -0
  29. data/test/services/foreman_cve_scanner/cve_report_scanner_test.rb +45 -17
  30. data/test/services/foreman_cve_scanner/scan_importer_test.rb +85 -0
  31. data/test/test_plugin_helper.rb +2 -0
  32. data/webpack/components/CveDetailsCard.js +258 -0
  33. data/webpack/components/CveFindingsModal.js +274 -0
  34. data/webpack/components/CveHistoryTable.js +58 -0
  35. data/webpack/components/CveOverviewCard.js +67 -0
  36. data/webpack/components/CveScansTab.js +192 -0
  37. data/webpack/components/CveSummaryCell.js +72 -0
  38. data/webpack/components/SeverityIcon.js +56 -0
  39. data/webpack/components/__tests__/CveDetailsCard.test.js +126 -0
  40. data/webpack/components/__tests__/CveFindingsModal.test.js +78 -0
  41. data/webpack/components/__tests__/CveScansTab.test.js +76 -0
  42. data/webpack/components/__tests__/cve_helpers.test.js +42 -0
  43. data/webpack/components/cve_helpers.js +35 -0
  44. data/webpack/components/cve_scans.scss +200 -0
  45. data/webpack/fills.js +1 -0
  46. data/webpack/fills_index.js +38 -0
  47. data/webpack/index.js +1 -0
  48. metadata +49 -5
@@ -0,0 +1,200 @@
1
+ .cve-summary {
2
+ align-items: center;
3
+ display: inline-flex;
4
+ gap: 0.35rem;
5
+ }
6
+
7
+ .cve-summary-count {
8
+ font-weight: 600;
9
+ }
10
+
11
+ .cve-section-title {
12
+ margin-top: 1rem;
13
+ margin-bottom: 0.5rem;
14
+ }
15
+
16
+ .cve-severity {
17
+ display: inline-flex;
18
+ }
19
+
20
+ .cve-severity--critical,
21
+ .cve-severity--high {
22
+ color: var(--pf-v5-global--danger-color--100);
23
+ }
24
+
25
+ .cve-severity--medium {
26
+ color: var(--pf-v5-global--warning-color--100);
27
+ }
28
+
29
+ .cve-severity--low {
30
+ color: var(--pf-v5-global--palette--blue-400);
31
+ }
32
+
33
+ .cve-severity--none {
34
+ color: var(--pf-v5-global--success-color--100);
35
+ }
36
+
37
+ .cve-summary-empty {
38
+ color: var(--pf-v5-global--disabled-color--200);
39
+ }
40
+
41
+ .cve-summary-link {
42
+ padding: 0;
43
+ margin: 0;
44
+ }
45
+
46
+ button.cve-summary {
47
+ background: none;
48
+ border: 0;
49
+ cursor: pointer;
50
+ font: inherit;
51
+ }
52
+
53
+ .cve-count {
54
+ align-items: center;
55
+ display: inline-flex;
56
+ gap: 0.35rem;
57
+ }
58
+
59
+ .cve-bubble {
60
+ align-items: center;
61
+ background: var(--pf-v5-global--palette--blue-200);
62
+ border-radius: 1em;
63
+ color: var(--pf-v5-global--palette--blue-600);
64
+ display: inline-flex;
65
+ font-weight: 600;
66
+ padding: 0 0.5rem;
67
+ }
68
+
69
+ .cve-total-bubble {
70
+ align-items: center;
71
+ border-radius: 1em;
72
+ display: inline-flex;
73
+ font-weight: 700;
74
+ padding: 0 0.5rem;
75
+ }
76
+
77
+ .cve-total-bubble--high {
78
+ background: var(--pf-v5-global--danger-color--100);
79
+ color: var(--pf-v5-global--BackgroundColor--100);
80
+ }
81
+
82
+ .cve-total-bubble--medium {
83
+ background: var(--pf-v5-global--warning-color--100);
84
+ color: var(--pf-v5-global--BackgroundColor--100);
85
+ }
86
+
87
+ .cve-total-bubble--low {
88
+ background: var(--pf-v5-global--palette--blue-400);
89
+ color: var(--pf-v5-global--BackgroundColor--100);
90
+ }
91
+
92
+ .cve-total-bubble--none {
93
+ background: var(--pf-v5-global--success-color--100);
94
+ color: var(--pf-v5-global--BackgroundColor--100);
95
+ }
96
+
97
+ .cve-counts {
98
+ display: grid;
99
+ gap: 0.35rem 1rem;
100
+ grid-template-columns: auto auto;
101
+ margin-top: 0.25rem;
102
+ }
103
+
104
+ .cve-counts--compact {
105
+ column-gap: 0.5rem;
106
+ row-gap: 0.25rem;
107
+ margin-top: 0.15rem;
108
+ }
109
+
110
+ .cve-filter-buttons {
111
+ display: flex;
112
+ flex-wrap: wrap;
113
+ gap: 0.5rem;
114
+ }
115
+
116
+ .cve-sort-indicator {
117
+ font-size: 0.85em;
118
+ }
119
+
120
+ .cve-sortable {
121
+ cursor: pointer;
122
+ }
123
+
124
+ .cve-filter-button.is-active {
125
+ box-shadow: 0 0 0 2px var(--pf-v5-global--primary-color--100) inset;
126
+ }
127
+
128
+ .cve-filter-button {
129
+ background: var(--pf-v5-global--BackgroundColor--100);
130
+ border: 1px solid var(--pf-v5-global--BorderColor--100);
131
+ border-radius: 2px;
132
+ color: var(--pf-v5-global--Color--100);
133
+ cursor: pointer;
134
+ font: inherit;
135
+ padding: 0.25rem 0.75rem;
136
+ }
137
+
138
+ .cve-modal-body {
139
+ position: relative;
140
+ min-height: 420px;
141
+ }
142
+
143
+ .cve-modal-filters {
144
+ position: relative;
145
+ z-index: 1;
146
+ }
147
+
148
+ .cve-more {
149
+ margin-top: 0.5rem;
150
+ }
151
+
152
+ .cve-truncate {
153
+ display: inline-block;
154
+ max-width: 220px;
155
+ overflow: hidden;
156
+ text-overflow: ellipsis;
157
+ vertical-align: bottom;
158
+ white-space: nowrap;
159
+ }
160
+
161
+ .cve-col-severity {
162
+ width: 28px;
163
+ }
164
+
165
+ .cve-col-published {
166
+ width: 210px;
167
+ }
168
+
169
+ .cve-col-name {
170
+ width: 200px;
171
+ }
172
+
173
+ .cve-col-version {
174
+ width: 180px;
175
+ }
176
+
177
+ .cve-col-fixed {
178
+ width: 160px;
179
+ }
180
+
181
+ .cve-col-status {
182
+ width: 90px;
183
+ }
184
+
185
+ .cve-col-id {
186
+ width: 150px;
187
+ }
188
+
189
+ .cve-col-title {
190
+ width: 240px;
191
+ }
192
+
193
+ .cve-summary--icon-only {
194
+ width: 18px;
195
+ }
196
+
197
+ .cve-col-published,
198
+ .cve-col-published * {
199
+ white-space: nowrap;
200
+ }
data/webpack/fills.js ADDED
@@ -0,0 +1 @@
1
+ import './fills_index';
@@ -0,0 +1,38 @@
1
+ /* eslint-disable import/no-unresolved */
2
+ import React from 'react';
3
+ import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
4
+ import { registerColumns } from 'foremanReact/components/HostsIndex/Columns/core';
5
+ import { translate as __ } from 'foremanReact/common/I18n';
6
+ import CveDetailsCard from './components/CveDetailsCard';
7
+ import CveScansTab from './components/CveScansTab';
8
+ import CveSummaryCell from './components/CveSummaryCell';
9
+
10
+ addGlobalFill(
11
+ 'host-tab-details-cards',
12
+ 'foreman-cve-scanner-details-card',
13
+ <CveDetailsCard key="foreman-cve-scanner-details-card" />,
14
+ 2200
15
+ );
16
+
17
+ addGlobalFill(
18
+ 'host-details-page-tabs',
19
+ 'CVE scans',
20
+ <CveScansTab key="foreman-cve-scanner-scans-tab" />,
21
+ 450,
22
+ { title: __('CVE scans') }
23
+ );
24
+
25
+ registerColumns([
26
+ {
27
+ columnName: 'cve_findings',
28
+ title: __('CVE'),
29
+ wrapper: hostDetails => (
30
+ <CveSummaryCell hostId={hostDetails?.id} hostName={hostDetails?.name} />
31
+ ),
32
+ weight: 450,
33
+ tableName: 'hosts',
34
+ categoryName: __('Security'),
35
+ categoryKey: 'security',
36
+ isSorted: false,
37
+ },
38
+ ]);
data/webpack/index.js ADDED
@@ -0,0 +1 @@
1
+ import './fills_index';
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_cve_scanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernhard Suttner
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-07-31 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: foreman_remote_execution
@@ -18,7 +18,7 @@ dependencies:
18
18
  version: '9.0'
19
19
  - - "<"
20
20
  - !ruby/object:Gem::Version
21
- version: '15'
21
+ version: '17'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -28,7 +28,7 @@ dependencies:
28
28
  version: '9.0'
29
29
  - - "<"
30
30
  - !ruby/object:Gem::Version
31
- version: '15'
31
+ version: '17'
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: rake
34
34
  requirement: !ruby/object:Gem::Requirement
@@ -67,18 +67,54 @@ files:
67
67
  - LICENSE
68
68
  - README.md
69
69
  - Rakefile
70
+ - app/controllers/api/v2/cve_scans_controller.rb
70
71
  - app/lib/actions/foreman_cve_scanner/cve_scanner_job.rb
72
+ - app/models/concerns/foreman_cve_scanner/host_extensions.rb
73
+ - app/models/foreman_cve_scanner/cve_scan.rb
74
+ - app/models/host_status/cve_status.rb
71
75
  - app/services/foreman_cve_scanner/cve_report_scanner.rb
76
+ - app/services/foreman_cve_scanner/scan_importer.rb
77
+ - app/views/api/v2/cve_scans/base.json.rabl
78
+ - app/views/api/v2/cve_scans/index.json.rabl
79
+ - app/views/api/v2/cve_scans/latest.json.rabl
80
+ - app/views/api/v2/cve_scans/main.json.rabl
81
+ - app/views/api/v2/cve_scans/show.json.rabl
72
82
  - app/views/foreman_cve_scanner/job_templates/install_cve_scanners.erb
73
83
  - app/views/foreman_cve_scanner/job_templates/run_cve_scanner.erb
84
+ - config/routes.rb
85
+ - db/migrate/20260221000000_create_foreman_cve_scanner_cve_scans.rb
86
+ - db/seeds.d/75_job_templates.rb
74
87
  - lib/foreman_cve_scanner.rb
75
88
  - lib/foreman_cve_scanner/engine.rb
76
89
  - lib/foreman_cve_scanner/version.rb
90
+ - lib/tasks/foreman_cve_scanner_seeds.rake
77
91
  - lib/tasks/foreman_cve_scanner_tasks.rake
92
+ - lib/tasks/rubocop.rake
93
+ - package.json
94
+ - test/actions/foreman_cve_scanner/cve_scanner_job_test.rb
95
+ - test/controllers/api/v2/cve_scans_controller_test.rb
78
96
  - test/fixtures/grype.json
79
97
  - test/fixtures/trivy.json
98
+ - test/models/host_status/cve_status_test.rb
80
99
  - test/services/foreman_cve_scanner/cve_report_scanner_test.rb
100
+ - test/services/foreman_cve_scanner/scan_importer_test.rb
81
101
  - test/test_plugin_helper.rb
102
+ - webpack/components/CveDetailsCard.js
103
+ - webpack/components/CveFindingsModal.js
104
+ - webpack/components/CveHistoryTable.js
105
+ - webpack/components/CveOverviewCard.js
106
+ - webpack/components/CveScansTab.js
107
+ - webpack/components/CveSummaryCell.js
108
+ - webpack/components/SeverityIcon.js
109
+ - webpack/components/__tests__/CveDetailsCard.test.js
110
+ - webpack/components/__tests__/CveFindingsModal.test.js
111
+ - webpack/components/__tests__/CveScansTab.test.js
112
+ - webpack/components/__tests__/cve_helpers.test.js
113
+ - webpack/components/cve_helpers.js
114
+ - webpack/components/cve_scans.scss
115
+ - webpack/fills.js
116
+ - webpack/fills_index.js
117
+ - webpack/index.js
82
118
  homepage: https://github.com/ATIX-AG/foreman_cve_scanner
83
119
  licenses:
84
120
  - GPL-3.0
@@ -101,11 +137,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
137
  - !ruby/object:Gem::Version
102
138
  version: '0'
103
139
  requirements: []
104
- rubygems_version: 3.6.9
140
+ rubygems_version: 4.0.10
105
141
  specification_version: 4
106
142
  summary: Run CVE scan on host and collect report
107
143
  test_files:
144
+ - test/actions/foreman_cve_scanner/cve_scanner_job_test.rb
145
+ - test/controllers/api/v2/cve_scans_controller_test.rb
108
146
  - test/fixtures/grype.json
109
147
  - test/fixtures/trivy.json
148
+ - test/models/host_status/cve_status_test.rb
110
149
  - test/services/foreman_cve_scanner/cve_report_scanner_test.rb
150
+ - test/services/foreman_cve_scanner/scan_importer_test.rb
111
151
  - test/test_plugin_helper.rb
152
+ - webpack/components/__tests__/CveDetailsCard.test.js
153
+ - webpack/components/__tests__/CveFindingsModal.test.js
154
+ - webpack/components/__tests__/CveScansTab.test.js
155
+ - webpack/components/__tests__/cve_helpers.test.js